Sign in to follow this  
Followers 0
Vindicator209

GUI problem

4 posts in this topic

theres 3 objects, an input box, edit box, and a button, i want the edit box to say "something" if the button is pressed with the word "start" in the input box, i had this at first:

$Edit_2 = GuiCtrlCreateEdit('', 20, 30, 450, 390)
$Input_3 = GuiCtrlCreateInput("Commands", 20, 430, 360, 40)
$Button_4 = GuiCtrlCreateButton("ENTER", 400, 430, 70, 40)
$Start = GuiCtrlRead($Edit_2)
$start2 = ("start")
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $Button_4
        If $Start = $start2 Then
            GUICtrlSetData($Edit_2,' SOMETHING ')
            EndIf
    EndSelect
WEnd
Exit

after that, and i couldnt make it work, i tore off a bit of a gui from the gui help file in the encryption device, and it still wouldnt work, can this be done another way?


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites



First of all, you're not reading the value of the input, but the edit ! Secondly, you're reading

the value even before the GUI is shown, meaning that if the user changes the value after the

GUI is shown, it will not matter as $Start will always equal the default text. Those paranthesis

around "start" aren't needed btw..

This should work :

$Edit_2 = GuiCtrlCreateEdit('', 20, 30, 450, 390)
$Input_3 = GuiCtrlCreateInput("Commands", 20, 430, 360, 40)
$Button_4 = GuiCtrlCreateButton("ENTER", 400, 430, 70, 40)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $Button_4
        If  GUICtrlRead($Input_3) = "start" Then
            GUICtrlSetData($Edit_2,' SOMETHING ')
            EndIf
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites

hahaha, oh sorry im new to this scripting thing hehe, but thanks! wow i cant believe i missed that...


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

You might be interested in something like this, too. It'll check for the word "start" at the beginning of the command, and input the rest of the editbox's contents. Plus, it will scroll down all the commands in the editbox.

#include <GUIConstants.au3>

GUICreate('', 500, 500)

$Edit_2 = GUICtrlCreateEdit('', 20, 30, 450, 390)
$Input_3 = GUICtrlCreateInput("Commands", 20, 430, 360, 40)
$Button_4 = GUICtrlCreateButton("ENTER", 400, 430, 70, 40)

GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Button_4
            $read = GUICtrlRead($Input_3)
            If Stringleft($read, 5) = "start" Then GUICtrlSetData($Edit_2, $read & @CRLF & GUICtrlRead($Edit_2))
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Don't mean to step on Helge's post... Just figured I'd post it since I went to the trouble of trying it out. :P

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