jennico Posted October 11, 2006 Share Posted October 11, 2006 hello, this program is really good stuff, i am so impressed. my first post in this forum. i've been coding around for a while with autoit using the programm and forum help, but now getting on to gui i'am stucked in a problem that i cant seem to solve. it is a configuration skript and i want a gui with 5 checkboxes to de-/activate certain options. since my script is made for a touchscreen i want big buttons with images instead of the checkboxes. ok so far so easy. e.g. $Checkbox_1 = GUICtrlCreateCheckbox("Zoombar Buttons (left)", 20, 40, 150, 180,$BS_PUSHLIKE+$BS_bitmap) GUICtrlSetImage (-1,"no.bmp") ; if unchecked furthermore i want the images in the checkboxes now to change when checked and rechange when unchecked, so that you cant distinguish the state of the checkbox. like this GUICtrlSetImage (-1,"yes.bmp") ; if checked can anyone help me how to change the image when clicked? i tried to enter a variable instead of the bmp file and redefining this variable on GUICtrlSetOnEvent, but it didn't change the image. maybe the mistake is that you have to enter GUISetState() afterwards, but it doesn't accept a second setstate command. i wouldnt mind using the GUICtrlCreateButton instead of checkboxes if it helps to solve my problem. i hope someone might be able to give me a working clue. i think i have come to a dead end, please lead me out. thanx j. Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Link to comment Share on other sites More sharing options...
GaryFrost Posted October 11, 2006 Share Posted October 11, 2006 (edited) hello, this program is really good stuff, i am so impressed. my first post in this forum. i've been coding around for a while with autoit using the programm and forum help, but now getting on to gui i'am stucked in a problem that i cant seem to solve. it is a configuration skript and i want a gui with 5 checkboxes to de-/activate certain options. since my script is made for a touchscreen i want big buttons with images instead of the checkboxes. ok so far so easy. e.g. $Checkbox_1 = GUICtrlCreateCheckbox("Zoombar Buttons (left)", 20, 40, 150, 180,$BS_PUSHLIKE+$BS_bitmap) GUICtrlSetImage (-1,"no.bmp") ; if unchecked furthermore i want the images in the checkboxes now to change when checked and rechange when unchecked, so that you cant distinguish the state of the checkbox. like this GUICtrlSetImage (-1,"yes.bmp") ; if checked can anyone help me how to change the image when clicked? i tried to enter a variable instead of the bmp file and redefining this variable on GUICtrlSetOnEvent, but it didn't change the image. maybe the mistake is that you have to enter GUISetState() afterwards, but it doesn't accept a second setstate command. i wouldnt mind using the GUICtrlCreateButton instead of checkboxes if it helps to solve my problem. i hope someone might be able to give me a working clue. i think i have come to a dead end, please lead me out. thanx j. case $msg = $Checkbox_1 if GuiCtrlRead($Checkbox_1) = $GUI_CHECKED then GUICtrlSetImage ($Checkbox_1,"yes.bmp") ; if checked else GUICtrlSetImage ($Checkbox_1,"no.bmp") ; if unchecked endif Edited October 11, 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. Link to comment Share on other sites More sharing options...
jennico Posted October 11, 2006 Author Share Posted October 11, 2006 thanx so much for your fast help. it works ! i solved it like this for the first checkbox: #include <GuiConstants.au3> ;Opt("GUIOnEventMode",1) GUICreate("Multy-functions", 400, 600) ;GUISetOnEvent($GUI_EVENT_CLOSE,"Terminate") $Checkbox_1 = GUICtrlCreateCheckbox("Zoombar Buttons (links)", 20, 40, 150, 180,$BS_PUSHLIKE+$BS_bitmap) GUICtrlSetImage (-1,"no.bmp") ;GUICtrlSetImage (1,"yes.bmp") $Checkbox_2 = GUICtrlCreateCheckbox("Shortcut Buttons (oben)", 20, 230, 150, 100) $Checkbox_3 = GUICtrlCreateCheckbox("Winamp und Lautstärke Buttons (rechts)", 20, 340, 150, 100) $Checkbox_4 = GUICtrlCreateCheckbox("Frontend Funktionen (unten)", 20, 450, 150, 100) $Checkbox_5 = GUICtrlCreateCheckbox("Home und Menü Button (links unten)", 20, 560, 150, 20) GUISetState() While 1 $msg = GUIGetMsg() Select case $msg = $Checkbox_1 if GuiCtrlRead($Checkbox_1) = $GUI_CHECKED then GUICtrlSetImage ($Checkbox_1,"yes.bmp") ; if checked else GUICtrlSetImage ($Checkbox_1,"no.bmp") ; if unchecked endif EndSelect ;Sleep( 10 ) WEnd Exit thats the way you ment it to be? j. :-) :-) Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Link to comment Share on other sites More sharing options...
GaryFrost Posted October 11, 2006 Share Posted October 11, 2006 yw, try using the [ code ] and [ / code] without the spaces or the A3 button in the post bar when posting code SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
jennico Posted October 11, 2006 Author Share Posted October 11, 2006 (edited) thats what i was just wondering about. thanx, good to know. i will just try it, sorry for wasting space. #include <GuiConstants.au3> ;Opt("GUIOnEventMode",1) GUICreate("Multy-functions", 400, 600) ;GUISetOnEvent($GUI_EVENT_CLOSE,"Terminate") $Checkbox_1 = GUICtrlCreateCheckbox("Zoombar Buttons (links)", 20, 40, 150, 180,$BS_PUSHLIKE+$BS_bitmap) GUICtrlSetImage (-1,"no.bmp") ;GUICtrlSetImage (1,"yes.bmp") $Checkbox_2 = GUICtrlCreateCheckbox("Shortcut Buttons (oben)", 20, 230, 150, 100) $Checkbox_3 = GUICtrlCreateCheckbox("Winamp und Lautstärke Buttons (rechts)", 20, 340, 150, 100) $Checkbox_4 = GUICtrlCreateCheckbox("Frontend Funktionen (unten)", 20, 450, 150, 100) $Checkbox_5 = GUICtrlCreateCheckbox("Home und Menü Button (links unten)", 20, 560, 150, 20) GUISetState() While 1 $msg = GUIGetMsg() Select case $msg = $Checkbox_1 if GuiCtrlRead($Checkbox_1) = $GUI_CHECKED then GUICtrlSetImage ($Checkbox_1,"yes.bmp"); if checked else GUICtrlSetImage ($Checkbox_1,"no.bmp"); if unchecked endif EndSelect ;Sleep( 10 ) WEnd Exit Edit: okay, now i got it working Edited October 11, 2006 by jennico Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Link to comment Share on other sites More sharing options...
jennico Posted October 13, 2006 Author Share Posted October 13, 2006 hello i've got a second question on that issue. my script changes the image of the checkbutton (konfig0/1) correctly, but doesn't change the "pic" (wa1/0) in the same way. the pic is not changed on the first click, but on the second and more click everything works fine. i don't get the logic, why my pic will not be changed on first click. what is wrong ? j. #include <file.au3> #include <GuiConstants.au3> GUICreate("(c)jennico2006",800,600,-1,-1,BitOR($WS_POPUP,$WS_THICKFRAME)) GUICtrlCreatePic ("konfig.jpg",0,0,800,600) GuiCtrlSetState(-1,$GUI_DISABLE) $Checkbox_3 = GUICtrlCreateCheckbox("Winamp",728,143,58,57,$BS_PUSHLIKE+$BS_bitmap) GUICtrlSetState (-1, $GUI_CHECKED) GUICtrlSetImage (-1,"konfig1.bmp") $desti_3 = ",LoadSkin(Destimap:winamp)" $Exit = GUICtrlCreateButton("",446,550,112,42,$BS_bitmap,$WS_EX_TRANSPARENT) GUICtrlSetImage (-1,"fertig.bmp") GUISetState() While 1 $msg = GUIGetMsg() Select case $msg = $Checkbox_3 if GuiCtrlRead($Checkbox_3) = $GUI_CHECKED then GUICtrlSetImage ($Checkbox_3,"konfig1.bmp") $desti_3 = ",LoadSkin(Destimap:winamp)" GUICtrlCreatePic ("wa0.jpg",679,115,39,256) else GUICtrlSetImage ($Checkbox_3,"konfig0.bmp") $desti_3 = "" GUICtrlCreatePic ("wa1.jpg",680,119,38,247) endif case $msg = $Exit ExitLoop EndSelect WEnd i omitted the other checkbuttons and pasted only the important lines . thanx Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Link to comment Share on other sites More sharing options...
GaryFrost Posted October 13, 2006 Share Posted October 13, 2006 try using GUICtrlSetImage to change the image, not creating new pic controls everytime That's one problem, haven't looked over the rest. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
jennico Posted October 13, 2006 Author Share Posted October 13, 2006 okay, but the "pic" is outside of the checkbutton and inside the background. that doesn't matter? the other thing is that "image" requires a bmp and a jpg consumes less disk space (better to upload in a forum). or can i use any type of image ? but still stays the "first click" problem. thanx j. Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Link to comment Share on other sites More sharing options...
GaryFrost Posted October 13, 2006 Share Posted October 13, 2006 not tested #include <file.au3> #include <GuiConstants.au3> GUICreate("©jennico2006", 800, 600, -1, -1, BitOR($WS_POPUP, $WS_THICKFRAME)) GUICtrlCreatePic("konfig.jpg", 0, 0, 800, 600) GUICtrlSetState(-1, $GUI_DISABLE) $Checkbox_3 = GUICtrlCreateCheckbox("Winamp", 728, 143, 58, 57, $BS_PUSHLIKE + $BS_bitmap) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetImage(-1, "konfig1.bmp") $desti_3 = ",LoadSkin(Destimap:winamp)" $pic = GUICtrlCreatePic("wa0.jpg", 680, 119, 38, 247) $Exit = GUICtrlCreateButton("", 446, 550, 112, 42, $BS_bitmap, $WS_EX_TRANSPARENT) GUICtrlSetImage(-1, "fertig.bmp") GUISetState() While 1 $Msg = GUIGetMsg() Select Case $Msg = $Checkbox_3 If GUICtrlRead($Checkbox_3) = $GUI_CHECKED Then GUICtrlSetImage($Checkbox_3, "konfig1.bmp") $desti_3 = ",LoadSkin(Destimap:winamp)" GUICtrlSetImage($pic, "wa0.jpg") Else GUICtrlSetImage($Checkbox_3, "konfig0.bmp") $desti_3 = "" GUICtrlSetImage($pic, "wa1.jpg") EndIf Case $Msg = $Exit 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. Link to comment Share on other sites More sharing options...
jennico Posted October 13, 2006 Author Share Posted October 13, 2006 thank you, wow, your answer did it all. i really appreciate the ultra fast help here. thanx again j. Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 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