Sign in to follow this  
Followers 0
superbosu

GuiCreateImput Problem

3 posts in this topic

#1 ·  Posted (edited)

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $Button_1, $Button_2, $msg, $set1
    GUICreate("BOSU TM", 300, 460) ; will create a dialog box that when displayed is centered

    Opt("GUICoordMode", 3)
    $Button_1 = GUICtrlCreateButton("Import", 50, 280, 100)
    $Button_2 = GUICtrlCreateButton("GES", 50, 320, 100)
    $set1 = GUICtrlCreateInput("CR", 180, 281, 70, 23)
    GUISetState()      ; will display an  dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                $set1 = GUICtrlRead($set1, 0)
                MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$set1' & @lf & @lf & 'Return:' & @lf & $set1) ;### Debug MSGBOX


            Case $msg = $Button_2
                MsgBox(0, 'Testing', 'Button 2 was pressed')    ; Will demonstrate Button 2 being pressed
        EndSelect
    WEnd
EndFunc   ;==>Example
Hi all, I have a probelm with my simple code.....

This application works only the first time

if I write something on the imput box after click on button 1 again, the msg is always 0 .... why?

Who can help me?

Edited by superbosu

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You are re-declaring $set1 so it is no longer the handle for the control

simply change

$set1 = GUICtrlRead($set1, 0)

to

$set2 = GUICtrlRead($set1, 0)

and

MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$set1' & @lf & @lf & 'Return:' & @lf & $set1)

to

MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$set1' & @lf & @lf & 'Return:' & @lf & $set2)

and add $set2 to your local variables

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

You are re-declaring $set1 so it is no longer the handle for the control

simply change

$set1 = GUICtrlRead($set1, 0)

to

$set2 = GUICtrlRead($set1, 0)

and

MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$set1' & @lf & @lf & 'Return:' & @lf & $set1)

to

MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$set1' & @lf & @lf & 'Return:' & @lf & $set2)

and add $set2 to your local variables

Tnx it works :)

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