Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SetFocus Method for Control Not executing
Message
From
16/03/1998 13:37:18
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00084832
Message ID:
00084868
Views:
35
>>>>I have a form with 2 labels, 2 text boxes and 2 command buttons. The form's ShowWindow is set to 1, and WindowType is set to modal. When I try and call the SetFocus Method for the TextBoxes or Command Buttons, the SetFocus is NOT seen as a VFP Keyword. In code, ThisForm.txtPassWord.SetFocus, ThisForm is keyword color, txtPassWord is string color and SetFocus is string Color. I tried nmoving my code from the LostFocus Method into the Valid Method but then I get and error on not being able to use SetFocus in the WHEN or VALID methods. In the debugger, this error comes from a custom messagebox form which uses setfocus.
>>>>
>>>>Any ideas for this?
>>>>
>>>>Fred Lauckner
>>>><>
>>>
>>>Some More Info.
>>>
>>> VFP is not recognizing the SetFocus method as a valid VFP keyword. I am attempting to SetFocus to the last control if a validation routine failes. The validation routine is a method in a class which is loaded in the main program. The SetFocus method with the validation routine on a separate form work fine. The SetFocus method is not recognized on this form with the above setup. I have switched the form between Modal and Non modal with no effect. I have tried adding a DODefault() in the LostFocus Method with no result and there are no error routines intercepting any errors.
>>>
>>>
>>>Fred Lauckner
>>><>
>>
>>Fred, what does it mean 'not recognizing'. Do you get an error? Remember, that if you call text.setfocus from outside then you should provide absolute reference to your form ('thisform' will not work here). SetFocus is proven VFP method and doesn't fail itself. Sometimes, you should add NODEFAULT to provide right effect.
>
>
>
>By 'Not Recognizing' I mean, that in the code widow for the LostFocus Method. This , thisform, enable (......) are seen as Foxpro Keywords and are displayed with the keyword color. SetFocus is NOT seen as a keyword. When I type it in, it is displayed in the String color. If I only type in the first four character of SetFocus, it is displayed in the Keyword color, but when I type in the Full Method Name, it is displayed in the string color.
>
>The line of code, when you look at in the debuger, is executed without any errors but focus is not set to the control that is specified. If have tried the following ways of calling the SetFocus Method.
>
>This.SetFocus
>ThisForm.txtPassword.SetFocus
>frmValPwd.txtPassword.SetFocus
>
>In all cases, the setfocus Method does not appear to do what is expected. In all cases focus in set to the next control in the tab order whether I attempt to issue a setfocus or not.
>
>Fred Lauckner

Does it matter what color is this? If it works properly, it's enough. To provide proper functionality, you should issue NODEFAULT:
***Text1.Lostfocus event
Thisform.Text2.Setfocus
NODEFAULT
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform