Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LostFocus Native Behaviour
Message
From
10/08/2001 13:22:31
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
06/08/2001 08:50:55
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00540072
Message ID:
00542400
Views:
17
>>I'm sure there is something in my code causing this, but...
>>
>>I'm setting the focus from a command button Click on one page to the first object on another page. When the object receives the focus it immediately gives it away to the second object. I can stop the focus on the first object by putting NoDefault in the LostFocus, but this also keeps the cursor from moving away from the first object. Even if I remove the SetFocus line from the command button on the first page, the behaviour is the same. This focus stuff is killing me lately - and my project timelines... Any ideas on what I should be looking for? Thanks!
>>
>>Regards, Renoir
>
>Renoir,
>It shouldn't have something with commandbutton's setfocus. Are you sure in Gotfocus, When etc or target object doesn't have some code to lend focus to next ?
>If code is already complex enough to find where i stems from you could still use Lostfocus with a flag :
>
>
if this.Tag ='keepfocus'
> nodefault
> this.Tag = ''
>endif
Commandbutton click or some UIEnable would set Tag to 'keepfocus' for the first object. A quick-temp fix :)
>Cetin

Cetin,

I'm going to post a version of the following in other threads I've started recently as it addresses those issues as well.

The solution to the combobox/focus problem had a lot to do with a very simple thing. As I broke it apart and started doing some research I found a very obvious reason that it wouldn't hold focus. The Enabled was initially set to False and only when it was refreshed would it be set to True and accept the focus. Since it was on a different page, and ThisForm.Refresh will only affect the current active page, the combobox.Enabled was not reset to True until that page was refreshed. This also expains why there was a difference when the form ran the first time as opposed to any subsequent time. It also reacted differently depending on whether ActivePage or SetFocus was called first. By my recent experience, ActivePage should be set first.

Thank you all for your input. I'm afraid I made the problem appear much more complex than it was and in the process throwing you all off the scent...

Bottom line: Make sure an object is Enabled before setting focus to it.

Renoir
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform