Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Display and Refresh a Form without taking focus
Message
From
24/04/2011 05:40:18
 
 
To
23/04/2011 21:15:37
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01508151
Message ID:
01508233
Views:
61
>>>>>Is there a way to do this? I have data coming in that gets displayed in a form that is open (one of many) but I do not want it to take focus away from the other forms in an app that are open unless the user intentionally clicks on the form. Whenever I refresh the form (it has two grids of data), it takes focus.
>>>>
>>>>Are you sure there's no .SetFocus() in the code? Also, when that form is deactivated, was the focus on the grid? Refreshing a grid which has the focus, while busy elsewhere, has some weird side effects sometimes (i.e. I have no clue what it may do, but moving focus off it may help).
>>>
>>>Pretty sure. I searched through all levels for any setfocus and activate.... I found a way to set focus back to the form that was open and had focus when the other form launches or refreshes the grids. I would rather the updating and efresh of the grid didn't grab focus at all...
>>
>>Couldn't it be that you have a setfocus in the grid's superclass on refresh? I know, it wouldn't make sense, but a refresh alone should not activate the form. I have a similar form also with a grid that works well on refresh.
>
>No parent class (other than grid) for the grids, but the form has a parent class and I checked all methods of it and of the form itself. No activate or setfocus anywhere. I have handled it by returning focus to the calling object in the code behind the form (it is only updated by a prg in the background and refreshed from there). That way if they click on the grid, it does gain focus like it should. However, when the form loads, it still grabs focus and I'd like to stop that. I cannot make it alwaysonbottom because I do need it to come to the front of all forms when it initially loads. The position is saved so every time it loads it is displayed in it's correct position (this app stretches across 2-3 monitors and the user can set each form's position and it always loads there), but with alwaysonbottom set to .t. it will load behind other forms. I need it to load in front but not grab focus. Lots of position settings take place on form load, but no setfocus anywhere.
>
>I'm testing some conditional form.activate() now...

The one other thing I can imaging that activates a form is the calling of the Show() method, perhaps you can check that out as well.
Christian Isberner
Software Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform