Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Timer Event on fire bring back form to front

Timer Event on fire bring back form to front

Timer Event on fire bring back form to front

I have a form which refreshes grid data in 1 min. using timer. On drilldown another form is opened showing details of that record.
Now, while viewing 2 form if timer event of first form is fired then it comes above 2nd form. How can I avoid such behaviour . I want timer to just update data in that grid but that form should not come in front of any other form opened.

RE: Timer Event on fire bring back form to front

Well, Disable the timer on form.deactivate and enable it on activate, that would be one simple solution.

I'm not sure you could Refresh() without that causing to let focus go to the grid, but the other way around, if you set focus to the grid, you sure cause the form to become active, too. So avoid that.

Bye, Olaf.

RE: Timer Event on fire bring back form to front

The way I would do this would be to NOT refresh the grid. In your timer, update the grid's underlying data, that is, the cursor or table that is used to populate the grid, but don't refresh to grid or the form. If the user is working in Form 1, that won't be a problem because the grid will show the fresh data as soon as it receives focus. If you are working on Form 2, nothing will appear to happen, but when you close Form 2, focus will return to Form 1 and the grid will automatically be refreshed.


Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Timer Event on fire bring back form to front

I think a difference is still possible in Refresh() vs Setfocus(), so you might even be able to show new data in the form if it's inactive and only partially showing.

But anyway, just requerying data is enough and if you only aim for the form becoming active again, that's easiest to do when disabling/enabling the timer as it is programmed currently. A Timer has an Enabled property, and that's all you toggle.

Bye, Olaf.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close