Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Focus is getting lost

Status
Not open for further replies.

Serincino

Programmer
Jun 13, 2003
61
US
In my current application I have a textbox that the user will enter an account number in. When the user hits <enter> the valid method runs on the test box and pulls up the information for that account number if one exists and populates the other textboxes in the form. (this form is for posting account information like debit and credits and that the account was serviced) There is a dummy account number for services rendered to non-regular customers. This information is posted to a different database.

What is supposed to happen is that when the dummy account number 9999 is entered a new form pops up for them to post that info into. My problem is that the form pops, but then immediately gets moved to the back by the regular posting form. I've also tried placing the code in the lostfocus method by still the same thing happens. Below is my code:

IF thisform.txtaccount.Value = 9999
frmoddjobpost.show
RETURN .t.
ENDIF

I would like the regular customer form to stay visible in the background. Can some one please help me with this. I'm new to FoxPro so I very well my iggnorant of a command that will do this easily, but have found nothing yet.

I'm using VFP 8.0 on Windows 2000 for development. The app will be running in 2000 and 98 machines.

-Serincino
 
frmoddjobpost.show(1)

...and if you absolutely have to set frmoddjobpost AlwaysOnTop property to .t.


Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Slighthaze,

Thanks for the help. That makes the window appear on top, but the focus still switches back to the form that called it and you have to click on the form to make it the active form. It seems to me that for some reason it pops the window and since focus on the calling form is switching from one textbox to the next is happening it switches back to perform that. Is there away to make the show() happen after that event so that when the form pops that it keeps focus?

-Serincino
 
Serincino,

The windowtype of frmoddjobpost is currently set to modeless that is why the focus jumps back to the other form...either set the frmoddjobpost.WindowType = 1 in design before compiling your app or make sure you use frmoddjobpost.show(1) when making the form visible.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
I have used show(1) like your code stated earlier. the calling form is still grabbing control. I also read up on settng the windowtype to 1 where it is modal like Show(1) does and it says that you shouldn't be able to enter data into any other forms until that form is hidden or released and I can still do that. Could this be another glitch in VFP8? Also all my windows are set to be form.showwindow = 2
will this have an effect?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top