Sign in to follow this  
Followers 0
Gene

In EVENT mode, I know how to execute code on click &

1 post in this topic

#1 ·  Posted (edited)

I'm adding context sensitive help. To do that, as data is being entered the user tabs from field to field or clicks on fields as needed. I'd, like to set a variable to the context of the field with the foucus when it gets the focus in case the user presses the F1 key. I can make code execute when I tab out of a field or when I click out of a field, but not on tabbing or clicking into a field. Some example code is below. The line tabbed in above the ellipsis and the 4th UDF below it (also tabbed in) are examples of something like what I want to do, but don't know how. I could be approaching it from the wrong direction too.

Gene

Edit 2007/03/16 I discovered ControlGetFocus ( "title" [, "text"] ), I think I can use it to set the Help Topic and to run any other code that would benefit from GotFocus. If there is a better way, I'd like to know it.

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Local $sT0LName = GUICtrlCreateInput("", 14, 84, 121, 21)
             GUICtrlSetOnEvent(-1, "sT0LNameChange")
 #cs
 GUICtrlSetOnEvent($sT0LName, sT0LNameonfocus)       ; Functionality I'm looking for.
 #ce
             Local $sT0Fname = GUICtrlCreateInput("", 145, 84, 121, 21)  
             GUICtrlSetOnEvent(-1, "sT0FnameChange")
             Local $sT0Initial = GUICtrlCreateInput("", 270, 84, 35, 21)
             GUICtrlSetOnEvent(-1, "sT0InitialChange")
             
             . . .
             
             Func sT0LNameChange()
           $sT0_LName = GUICtrlRead($sT0LName)
                 _StringProper($sT0_LName)
                 GUICtrlSetData($sT0LName, $sT0_LName)
             EndFunc  ;==>sT0LNameChange
             
             Func sT0FnameChange()
                 $sT0_Fname = GUICtrlRead($sT0Fname)
                 _StringProper($sT0_Fname)
                 GUICtrlSetData($sT0Fname, $sT0_Fname)
             EndFunc  ;==>sT0FnameChange
             
             Func sT0InitialChange()
                 $sT0_Initial = GUICtrlRead($sT0Initial)
                 $sT0_Initial = StringUpper($sT0_Initial)
                 GUICtrlSetData($sT0Initial, $sT0_Initial)
             EndFunc  ;==>sT0InitialChange
       
 #cs
 Func sT0LNameonfocus()
     $sHelpTopic = '"LName"'
 EndFunc  ;==>sT0LNameChange
   #ce<!--c2--></div><!--ec2-->
Edited by Gene

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0