Fabry Posted December 16, 2007 Share Posted December 16, 2007 Try to press enter to choose the color: expandcollapse popup#include <GUIConstants.au3> $coloreA = 0xff0000 $Form12 = GUICreate("Choose color", 292, 133, 399, 254) $Buttonn1 = GUICtrlCreateButton("&A", 24, 40, 97, 73, 0) GUICtrlSetFont(-1, 32, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, $coloreA) GUICtrlSetState(-1, $GUI_FOCUS) $Buttonn2 = GUICtrlCreateButton("&B", 160, 40, 97, 73, 0) GUICtrlSetFont(-1, 32, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0x00ff00) GUICtrlCreateLabel("Choose the color", 32, 8, 100, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Buttonn1 $squadra = 'A' ExitLoop Case $Buttonn2 $squadra = 'B' ExitLoop EndSwitch WEnd GUIDelete($Form12) MsgBox(0, 'Color', $squadra) ;-------------example 2 $coloreA = 0xff0000 $Form12 = GUICreate("Choose color", 292, 133, 399, 254) $Buttonn1 = GUICtrlCreateButton("&A", 24, 40, 97, 73, 0) GUICtrlSetFont(-1, 32, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, $coloreA) GUICtrlSetState(-1, $GUI_FOCUS) $Buttonn2 = GUICtrlCreateButton("&B", 160, 40, 97, 73, 0) GUICtrlSetFont(-1, 32, 400, 0, "MS Sans Serif") ;~ GUICtrlSetBkColor(-1,0x00ff00) GUICtrlCreateLabel("Choose the color", 32, 8, 100, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Buttonn1 $squadra = 'A' ExitLoop Case $Buttonn2 $squadra = 'B' ExitLoop EndSwitch WEnd GUIDelete($Form12) MsgBox(0, 'Color', $squadra) A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 16, 2007 Moderators Share Posted December 16, 2007 #include <GUIConstantsEx.au3> ;-------------example 2 $coloreA = 0xff0000 $Form12 = GUICreate("Choose color", 292, 133, 399, 254) $Buttonn1 = GUICtrlCreateButton("&A", 24, 40, 97, 73, $BS_DEFPUSHBUTTON) GUICtrlSetFont(-1, 32, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, $coloreA) GUICtrlSetState(-1, $GUI_FOCUS) $Buttonn2 = GUICtrlCreateButton("&B", 160, 40, 97, 73, 0) GUICtrlSetFont(-1, 32, 400, 0, "MS Sans Serif") ;~ GUICtrlSetBkColor(-1,0x00ff00) GUICtrlCreateLabel("Choose the color", 32, 8, 100, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Buttonn1 $squadra = 'A' ExitLoop Case $Buttonn2 $squadra = 'B' ExitLoop EndSwitch WEnd GUIDelete($Form12) MsgBox(0, 'Color', $squadra) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Fabry Posted December 16, 2007 Author Share Posted December 16, 2007 I would press the color button in the first example. At the moment I found it to press {SPACE}. A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 17, 2007 Moderators Share Posted December 17, 2007 I would press the color button in the first example. At the moment I found it to press {SPACE}.Absolutely no idea what that means. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Generator Posted December 17, 2007 Share Posted December 17, 2007 I would press the color button in the first example. At the moment I found it to press {SPACE}.You will have to capture the {ENTER} in some other way, default way to push a button is {SPACE}, not {ENTER}.Correct me if i am wrong. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 17, 2007 Moderators Share Posted December 17, 2007 I wonder if anyone bothered to try the script I posted, let alone read the style definition for $BS_DEFPUSHBUTTON that I added to the script. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Fabry Posted December 17, 2007 Author Share Posted December 17, 2007 I want both color buttons, and it works only with {space}. A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
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