Sign in to follow this  
Followers 0
jftuga

GUIGetMsg for button control

3 posts in this topic

If I use:

for $i=1 to 10
$entry = IniRead( $ini_file, "main", "input" & $i, "")
$g_inp[$i] = GUICtrlCreateInput($entry, $x+30, $y-2, 260 )
$g_btn[$i] = GUICtrlCreateButton("submit", $x+300, $y-6, 100 )
$btn_num.add($g_btn[$i],$i)
$y += 28
next

while 1
$msg = GUIGetMsg()

switch $msg
case $GUI_EVENT_CLOSE
         exitloop
     case $g_btn[1] to $g_btn[10]
         ; do more stuff
         $i = $btn_num.item($msg)
endswitch
wend

... everything works well. The problem I have is that 'do more stuff' case section executes when focus is tabbed from the input to the button. I only want this case section activated when the button is clicked, not simply getting focus. How can I fix this?

Thanks,

-John

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

You need to do the inputs first and the buttons next in separate loops because else the input handles are within the button handle range.

Jos :)

Edited by Jos
1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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