Jump to content

CoderDude

Members
  • Posts

    2
  • Joined

  • Last visited

CoderDude's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Well that is sneaky.... So I guess the answer is that GUICtrlCreateInput doesn't terminate with 'Enter', but you can cheat with a hidden $BS_DEFPUSHBUTTON button. Thanks guys! Event mode version below. It works great. Note that this does not work if you use GUISetOnEvent on the button, it has to be GUICtrlSetOnEvent... Not sure what the difference is, the descriptions seem pretty identical...(?) #include <GUIConstants.au3> Opt("GUIOnEventMode", 1); Change to OnEvent mode $mainwindow = GUICreate("Title Goes Here", 400, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GuiCtrlCreateLabel("Please Enter:", 150, 20) $card=GuiCtrlCreateInput("", 130, 50, 130, 20) $EnterButton = GUICtrlCreateButton("AButton1", 100, 70, 49, 25, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent($EnterButton,"ScanComplete") GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 Sleep(1000); Idle around WEnd Func ScanComplete() MsgBox(0, "GUI Event", "It works!") EndFunc Func CLOSEClicked() MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...") Exit EndFunc
  2. Newbie here, so possibly stupid question...: Can almost do what I want to with InputBox, but trying to do the same with GUICtrlCreateInput()...: I want to create a GUI with an input field. The user can only enter something and press enter, or kill the window with the little x in the upper right corner. I don't want an 'Ok' button, I want 'Enter' to be all the user has to do. Here is what I have: #include <GuiConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate("Title Goes Here", 400, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GuiCtrlCreateLabel("Please Enter:", 150, 20) $card=GuiCtrlCreateInput("", 130, 50, 130, 20) GUICtrlSetOnEvent($card, "ScanComplete") GUISetState(@SW_SHOW) While 1 Sleep(1000) ; Idle around WEnd Func ScanComplete() MsgBox(0, "GUI Event", "It works!") EndFunc Func CLOSEClicked() MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...") Exit EndFunc The problem is, ScanComplete is never called on any keys, Enter, TAB, nothing makes it go. If you click on the thing to minimize the window, then it is called, but I think only if the input field changed. How do I make it terminate on 'Enter'? Thanks....
×
×
  • Create New...