Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Top-Level form doesn't get focus??
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00950551
Message ID:
00951230
Views:
8
Victor,

This code:
dodefault()
with thisform
   .AutoCenter = .t.
   .refreshform
endwith
application.Visible = .f.  && Here's the important line
will help you get the focus set right, but this assumes that you don't set SCREEN=OFF in the CONFIG.FPW file. So then you get the focus set, but you have to deal with the VFP main window "flashing" into and out of view before your toplevel form is displayed.

Are you a Premier Member of the UT? This has been discussed before with other suggestions for solutions, I believe. I ask about the membership, because you can only get search features with the PUTM. I had this problem and decided to just deal with the "flashing", however I think there is a solution that may work to get the VFP main window invisible from the very start, yet still let your form get the focus properly. It's buried in a thread somewhere and I'd like to find it, though it's not that big of a deal to me (and I'm not guaranteeing it will work).

Another note on the focus issue. When using your technique of turning the SCREEN=OFF in CONFIG.FPW, I found that on some machines the toplevel form would get focus properly and on others it would not. I think you were seeing that, since you said it worked yesterday and not today.

HTH,

Russell Campbell


>>>>i put this in my login form (activate())
>>>>
>>>>
>>>>DECLARE INTEGER SetForegroundWindow IN USER32 INTEGER
>>>>DECLARE INTEGER FindWindow IN USER32 STRING @ , STRING @
>>>>lnHWND=FindWindow(0, _Screen.Caption)
>>>>IF lnHWND>0
>>>>	SetForegroundWindow(lnHWND)
>>>>ENDIF
>>>>
>>>>
>>>>
>>>>>I have an app that shows a splash screen (as-top-level form, with Screen = Off in my config.fpw file)...
>>>>>then when it's done, the login screen pops up (also a top-level-form). I've set always-on-top to .T., yet the user still has to click on the form (which is acutally a vcx) to be able to type in their passowrd, the form never gets focus.
>>>>>Obviously this will be rather anoying. Anyone know a way around this???
>>>>>Thanks!
>>>
>>>Well...strange thing. Worked yesterday - but not today. Now what happens is the top-level login screen pops up...the thing in the task bar for it flashes 3 times and it turns blue (just in the taskbar, not the form itself) - but the ((*@&#*# login screen doesn't get focus (again). ARRRRGGGHHH!
>>
>>
>>
>>I am sorry, but i do not know what that could be. one thing, i have never figured it out, i used to have a time (win xp) when i used to work in vfp (or anything else for that matter), and every 5 minutes or so, while typing, the focus would for no reason at all get lost. no other windows got the focus. it was a pain in the 'you know where'.
>>
>>i believe it was caused by spy/ad ware. i never figured it out for sure. maybe something to look at?
>>
>>sorry i can not be of further help. let me know if you come up with something.
>
>I'm sure the machine is free of any spy/adware - I'll keep tinkering with it each time I get a few extra minutes - sooner or later I'll come up with something....I'm sure this SetForegroundWindow is part of the solution so I'm at least on the right path.
eCost.com continues to rip people off
Check their rating at ResellerRatings.com
Previous
Reply
Map
View

Click here to load this message in the networking platform