Jump to content

set text for from and input


toothyXdip
 Share

Recommended Posts

===edit===

sorry for double post i ment to post this on general help but i clicked this and they look like exactly the same (after you click it) so mods dont get mad (or any1)

ok can i set a inputbox on a window and have a ReadInput button and when you press that it reads it and then go to the next window with a next button and it disables old one and have a lable (or whatever works) and it will take whatevers in teh input box and put it in the lable (or whatever works) where i want it to...

Heres my script:

#include <GUIConstants.au3>
Global $name_input

;window---------------------
GUICreate("Welcome", 300, 200 , 390, 240, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUICtrlSetCursor(-1, 3)
$dummy = GUICtrlCreateDummy()
GUICtrlSetCursor(-1, 3)
GUISetBkColor(0x000000)
GUICtrlSetOnEvent($GUI_EVENT_CLOSE, 'send_dummy')
GUICtrlSetCursor(-1, 3)
GUICtrlSetCursor(-1, 3)
GUICtrlSetCursor(-1, 3)
GUICtrlSetState(-1, $GUI_DISABLE)
;lables---------------------
GUISetFont(14, 700)
$main_lable = GUICtrlCreateLabel("my question press start", 10, 10)
GUICtrlSetCursor(-1, 3)
$main_lable2 = GUICtrlCreateLabel("for me to show", 50, 30)
GUICtrlSetCursor(-1, 3)
GUISetFont(12, 400)
;colorsets------------------
GUICtrlSetBkColor($main_lable, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($main_lable2, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($main_lable, 0xFFFFFF)
GUICtrlSetColor($main_lable2, 0xFFFFFF)
GUISetState(@SW_SHOW)
;buttons--------------------
$start_button = GUICtrlCreateButton("Start", 70, 150, 70, 20)
GUICtrlSetCursor(-1, 3)
$exit_button = GUICtrlCreateButton("Exit", 170, 150, 70, 20)
GUICtrlSetCursor(-1, 3)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE or $msg = $exit_button
            OnButtonExit()
        Case $msg = $start_button
            start_button()
    EndSelect
WEnd

;functions-----------------

Func send_dummy()
    GUICtrlSendToDummy($dummy)
EndFunc

Func OnButtonExit()
    While 1
    $anwser = MsgBox(36, "Quit?", "Do you want to quit?")
    If $anwser = 6 Then
        Exit
    ElseIf $anwser = 7 Then
        ExitLoop
    EndIf
WEnd
EndFunc

Func start_button()
    GUIDelete()
    ;window-----------------
    GUICreate("Set name", 300, 200 , 390, 240, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    GUISetBkColor(0x000000)
    GUICtrlSetState(-1, $GUI_DISABLE)
    ;lable------------------
    GUISetFont(13, 900)
    $name_lable = GUICtrlCreateLabel("Set name here", 10, 20)
    $name_lable2 = GUICtrlCreateLabel("", 120, 40)
    ;button-----------------
    $next_button2 = GUICtrlCreateButton("Next", 210, 170, 70, 20)
    $pick_name = GUICtrlCreateButton("SetName", 105, 170, 100, 20)
    ;input-------------------
    $name_input = GUICtrlCreateInput("Pick Name", 110, 90, 100, 20)
    ;colorsets--------------
    GUICtrlSetBkColor($name_lable, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetBkColor($name_lable2, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor($name_lable, 0xFFFFFF)
    GUICtrlSetColor($name_lable2, 0xFFFFFF)
    
    GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            OnButtonExit()
        Case $msg = $pick_name
            readnameinput()
        Case $msg = $next_button2
            next_()
    EndSelect
WEnd
EndFunc

Func readnameinput()
    $read_name = GUICtrlRead($name_input)
EndFunc

Func next_()
    GUIDelete()
    ;window-----------------
    GUICreate("Set name", 300, 200 , 390, 240, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    GUISetBkColor(0x000000)
    GUICtrlSetState(-1, $GUI_DISABLE)
    ;lable------------------
    GUISetFont(13, 900)
    $name_lable = GUICtrlCreateLabel("Show name here", 10, 20)
    $name_lable2 = GUICtrlCreateLabel("$name_input, here", 120, 40)
    ;colorsets--------------
    GUICtrlSetBkColor($name_lable, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetBkColor($name_lable2, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor($name_lable, 0xFFFFFF)
    GUICtrlSetColor($name_lable2, 0xFFFFFF)
    
    GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            OnButtonExit()
    EndSelect
WEnd
EndFunc

Whats my problem????

Edited by toothyXdip
---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
Link to comment
Share on other sites

Try to "pretty up" your code with comments etc

#include <GUIConstants.au3>
Global $name_input

;window---------------------
GUICreate("Welcome", 300, 200 , 390, 240, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUICtrlSetCursor(-1, 3)
$dummy = GUICtrlCreateDummy()
GUICtrlSetCursor(-1, 3)
GUISetBkColor(0x000000)
GUICtrlSetOnEvent($GUI_EVENT_CLOSE, 'send_dummy')
GUICtrlSetCursor(-1, 3)
GUICtrlSetCursor(-1, 3)
GUICtrlSetCursor(-1, 3)
GUICtrlSetState(-1, $GUI_DISABLE)
;lables---------------------
GUISetFont(14, 700)
$main_lable = GUICtrlCreateLabel("my question press start", 10, 10)
GUICtrlSetCursor(-1, 3)
$main_lable2 = GUICtrlCreateLabel("for me to show", 50, 30)
GUICtrlSetCursor(-1, 3)
GUISetFont(12, 400)
;colorsets------------------
GUICtrlSetBkColor($main_lable, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($main_lable2, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($main_lable, 0xFFFFFF)
GUICtrlSetColor($main_lable2, 0xFFFFFF)
GUISetState(@SW_SHOW)
;buttons--------------------
$start_button = GUICtrlCreateButton("Start", 70, 150, 70, 20)
GUICtrlSetCursor(-1, 3)
$exit_button = GUICtrlCreateButton("Exit", 170, 150, 70, 20)
GUICtrlSetCursor(-1, 3)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE or $msg = $exit_button
            OnButtonExit()
        Case $msg = $start_button
            start_button()
    EndSelect
WEnd

;functions-----------------

Func send_dummy()
    GUICtrlSendToDummy($dummy)
EndFunc

Func OnButtonExit()
    While 1
    $anwser = MsgBox(36, "Quit?", "Do you want to quit?")
    If $anwser = 6 Then
        Exit
    ElseIf $anwser = 7 Then
        ExitLoop
    EndIf
WEnd
EndFunc

Func start_button()
    GUIDelete()
    ;window-----------------
    GUICreate("Set name", 300, 200 , 390, 240, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    GUISetBkColor(0x000000)
    GUICtrlSetState(-1, $GUI_DISABLE)
    ;lable------------------
    GUISetFont(13, 900)
    $name_lable = GUICtrlCreateLabel("Set name here", 10, 20)
    $name_lable2 = GUICtrlCreateLabel("", 120, 40)
    ;button-----------------
    $next_button2 = GUICtrlCreateButton("Next", 210, 170, 70, 20)
    $pick_name = GUICtrlCreateButton("SetName", 105, 170, 100, 20)
    ;input-------------------
    Global $name_input = GUICtrlCreateInput("Pick Name", 110, 90, 100, 20)
    ;colorsets--------------
    GUICtrlSetBkColor($name_lable, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetBkColor($name_lable2, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor($name_lable, 0xFFFFFF)
    GUICtrlSetColor($name_lable2, 0xFFFFFF)
   
    GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            OnButtonExit()
        Case $msg = $pick_name
            readnameinput()
        Case $msg = $next_button2
            next_()
    EndSelect
WEnd
EndFunc

Func readnameinput()
    $read_name = GUICtrlRead($name_input)
EndFunc

Func next_()
    $tempname = GUICtrlRead($name_input)
    GUIDelete()
    ;window-----------------
    GUICreate("Set name", 300, 200 , 390, 240, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    GUISetBkColor(0x000000)
    GUICtrlSetState(-1, $GUI_DISABLE)
    ;lable------------------
    GUISetFont(13, 900)
    $name_lable = GUICtrlCreateLabel("Show name here", 10, 20)
    $name_lable2 = GUICtrlCreateLabel($tempname, 120, 40)
    ;colorsets--------------
    GUICtrlSetBkColor($name_lable, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetBkColor($name_lable2, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor($name_lable, 0xFFFFFF)
    GUICtrlSetColor($name_lable2, 0xFFFFFF)
   
    GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            OnButtonExit()
    EndSelect
WEnd
EndFunc

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...