Jump to content
Sign in to follow this  

GUIGetMsg for button control

Recommended Posts


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 )
$y += 28

while 1
$msg = GUIGetMsg()

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

... 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?



Share this post

Link to post
Share on other sites

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
  • Like 1

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     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