Lakes Posted February 23, 2006 Posted February 23, 2006 $Form1 = GUICreate("Meetcam Text to Speech", 421, 68, 190, 188) GUISetBkColor(0x000080) $InputBox = GUICtrlCreateInput("!s Type anything here", 8, 16, 313, 28, -1, $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $SEND = GUICtrlCreateButton("SEND", 328, 16, 73, 30) I can use the send button fine, but I also want to type in the text and send it with the Enter Key. How can I make this send the text when the Enter Key is pressed? If I try to use Case $Enter = _IsPressed("0D", $dll) that does not work... Thanks! 2015 - Still no flying cars, instead blankets with sleeves.
GaryFrost Posted February 23, 2006 Posted February 23, 2006 $Form1 = GUICreate("Meetcam Text to Speech", 421, 68, 190, 188) GUISetBkColor(0x000080) $InputBox = GUICtrlCreateInput("!s Type anything here", 8, 16, 313, 28, -1, $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $SEND = GUICtrlCreateButton("SEND", 328, 16, 73, 30) I can use the send button fine, but I also want to type in the text and send it with the Enter Key. How can I make this send the text when the Enter Key is pressed? If I try to use Case $Enter = _IsPressed("0D", $dll) that does not work... Thanks! $Form1 = GUICreate("Meetcam Text to Speech", 421, 68, 190, 188) GUISetBkColor(0x000080) $InputBox = GUICtrlCreateInput("!s Type anything here", 8, 16, 313, 28, -1, $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $SEND = GUICtrlCreateButton("SEND", 328, 16, 73, 30) GUICtrlSetState(-1, $GUI_DEFBUTTON) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
BigDod Posted February 23, 2006 Posted February 23, 2006 My feeble attempt #include <GUIConstants.au3> $Form1 = GUICreate("Meetcam Text to Speech", 421, 68, 190, 188) GUISetBkColor(0x000080) $InputBox = GUICtrlCreateInput("!s Type anything here", 8, 16, 313, 28, -1, $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $SEND = GUICtrlCreateButton("SEND", 328, 16, 73, 30) GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $SEND Then msgbox(0,"You typed",GUICtrlRead($InputBox)) EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
seandisanti Posted February 23, 2006 Posted February 23, 2006 $Form1 = GUICreate("Meetcam Text to Speech", 421, 68, 190, 188) GUISetBkColor(0x000080) $InputBox = GUICtrlCreateInput("!s Type anything here", 8, 16, 313, 28, -1, $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $SEND = GUICtrlCreateButton("SEND", 328, 16, 73, 30) GUICtrlSetState(-1, $GUI_DEFBUTTON) My feeble attempt #include <GUIConstants.au3> $Form1 = GUICreate("Meetcam Text to Speech", 421, 68, 190, 188) GUISetBkColor(0x000080) $InputBox = GUICtrlCreateInput("!s Type anything here", 8, 16, 313, 28, -1, $WS_EX_CLIENTEDGE) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $SEND = GUICtrlCreateButton("SEND", 328, 16, 73, 30) GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $SEND Then msgbox(0,"You typed",GUICtrlRead($InputBox)) EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend$BS_DEFPUSHBUTTON is the way to go, but it's a style, not a state, so the setstate won't work. just add it as a style in your GuiCtrlCreateButton() line. then when enter is pressed in the input box it will be sent to the button; as long as you don't have $ES_WANTRETURN style on your input/edit
GaryFrost Posted February 23, 2006 Posted February 23, 2006 (edited) $BS_DEFPUSHBUTTON is the way to go, but it's a style, not a state, so the setstate won't work. just add it as a style in your GuiCtrlCreateButton() line. then when enter is pressed in the input box it will be sent to the button; as long as you don't have $ES_WANTRETURN style on your input/edit better re-read the help file for GuiCtrlSetState, scroll down you'll find $GUI_DEFBUTTON Control will be set as the default button on the window Edited February 23, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
seandisanti Posted February 23, 2006 Posted February 23, 2006 (edited) better re-read the help file for GuiCtrlSetState, scroll down you'll find $GUI_DEFBUTTON Control will be set as the default button on the window$GUI_DEFBUTTON is a state, but that's not what i was talking about, i was talking about the style $BS_DEFPUSHBUTTON that could be added to set it as default without the extra line... but thanks ***edit***re-reading this today, it looks to me like i may have appeared to take offense at your comment gary. i just wanted to make sure you know that wasn't the case; your advice is always appreciated. I was just trying to point out that we were talking about 2 different possible solutions. Edited February 24, 2006 by cameronsdad
Lakes Posted February 23, 2006 Author Posted February 23, 2006 $GUI_DEFBUTTON is a state, but that's not what i was talking about, i was talking about the style $BS_DEFPUSHBUTTON that could be added to set it as default without the extra line... but thanks Thanks, but this only works after I have pressed the send button, typing text into the input box and pressing enter does not work. Heres the line now.. $InputBox = GUICtrlCreateInput("!s Type anything here", 8, 16, 313, 28, -1, $BS_DEFPUSHBUTTON ) 2015 - Still no flying cars, instead blankets with sleeves.
GaryFrost Posted February 23, 2006 Posted February 23, 2006 Thanks, but this only works after I have pressed the send button, typing text into the input box and pressing enter does not work. Heres the line now.. $InputBox = GUICtrlCreateInput("!s Type anything here", 8, 16, 313, 28, -1, $BS_DEFPUSHBUTTON ) Both ways should work the same expandcollapse popup#include <GUIConstants.au3> GUICreate(" My GUI", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES GUICtrlCreateInput("", 10, 35, 300, 20) ; will not accept drag&drop files $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUICtrlSetState($btn, $GUI_DEFBUTTON) $another = GUICtrlCreateButton("another", 120, 75, 60, 20) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn GUIDelete() MsgBox(0, "Default Button", "Pushed") ExitLoop EndSelect WEnd #include <GUIConstants.au3> GUICreate(" My GUI 2", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES GUICtrlCreateInput("", 10, 35, 300, 20) ; will not accept drag&drop files $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20, $BS_DEFPUSHBUTTON) $another = GUICtrlCreateButton("another", 120, 75, 60, 20) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn GUIDelete() MsgBox(0, "Default Button", "Pushed") ExitLoop EndSelect WEnd SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Lakes Posted February 23, 2006 Author Posted February 23, 2006 Both ways should work the same #include <GUIConstants.au3> GUICreate(" My GUI 2", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES GUICtrlCreateInput("", 10, 35, 300, 20) ; will not accept drag&drop files $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20, $BS_DEFPUSHBUTTON) $another = GUICtrlCreateButton("another", 120, 75, 60, 20) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn GUIDelete() MsgBox(0, "Default Button", "Pushed") ExitLoop EndSelect WEndThanks for the examples!, I made a silly mistake, I was applying the style to the input box instead of the Button, Doh! Thanks for the help! 2015 - Still no flying cars, instead blankets with sleeves.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now