Swimming_Bird Posted June 30, 2005 Share Posted June 30, 2005 I've tried a bunch of different ways but i cant figure out how to make rado buttons change what image is being displayed within a GUI. Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 30, 2005 Share Posted June 30, 2005 Show some code... that way we can help. We arent going to write the code for you. Also explain the problem a bit more. Like are you wanting the pic to change as soon as someone selects the radio button, or wait for them to do something else, then check the value and perform the change? These are all details that should be described in your question. If you had your script in here with a detailed question I am sure I would have had your answer in a shorter amount of time than it took me to write this reply. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Swimming_Bird Posted June 30, 2005 Author Share Posted June 30, 2005 i would post some code if i had any idea of what to do with this, this is ment to be a preview of what the output file will be. my script will generate an HTML email signature. I have screenshots of generic versions of it and would like the radio buttons to give a preview of what the signature will look like. also the radio buttion would designate which HTML file is generated. I really have looked and expereimented but my familiarty with autoit gui is still very poor. I understand that you dont want to write the code for me, but if you could give a suggestion on how to go about it that would be helpful. thanks Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 30, 2005 Share Posted June 30, 2005 The sample below is if you are using a button to change... I will provide another sample (further below) that will change when you click it. Submit Button Sample #include <GuiConstants.au3> GuiCreate("Sample GUI", 400, 400) $btn_SUBMIT = GuiCtrlCreateButton("Submit Button", 10, 330, 100, 30) GUICtrlCreateGroup ("Describe the buttons", 270, 120, 90, 140) $radio_1 = GUICtrlCreateRadio ("Some Text", 290, 140, 50, 20) $radio_2 = GUICtrlCreateRadio ("Blah blah blah", 290, 160, 60, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $btn_SUBMIT If GUICtrlRead($radio_1) = $GUI_CHECKED Then;Checks to see if $radio_1 was selected ;Do something with code here... (ex Change the picture) Look at GUISetData(). ElseIf GUICtrlRead($radio_2) = $GUI_CHECKED Then ;Do some other thing... EndIf Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Change onclick... #include <GuiConstants.au3> GuiCreate("Sample GUI", 400, 400) $btn_SUBMIT = GuiCtrlCreateButton("Submit Button", 10, 330, 100, 30) GUICtrlCreateGroup ("Describe the buttons", 270, 120, 90, 140) $radio_1 = GUICtrlCreateRadio ("Some Text", 290, 140, 50, 20) $radio_2 = GUICtrlCreateRadio ("Blah blah blah", 290, 160, 60, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $radio_1 ;Do something useful such as changing the picture here. Case $msg = $radio_2 ;Change the picture to the second one... blah blah blah Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd I hope the above samples will help you with your GUI. Be sure to do some helpfile research. I am leaving the pictures thing up to you. Its not that complicated. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Swimming_Bird Posted June 30, 2005 Author Share Posted June 30, 2005 (edited) beautiful, except with this it caused the image to go on both tabs. expandcollapse popup#include <GUIConstants.au3> GUICreate("Signature Generator"); will create a dialog box that when displayed is centered GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) $tab=GUICtrlCreateTab (-1,-1, 2000,1000) $tab0=GUICtrlCreateTabitem ("Template") $plain = GUICtrlCreateRadio ("Plain", 3, 40, 120, 20) $fbropen = GUICtrlCreateRadio ("Radio 2", 3, 65, 120, 20) $investor = GUICtrlCreateRadio ("Radio 3", 3, 90, 120, 20) ;~ $tab0input=GUICtrlCreateInput ("default", 80,50,70,20) $tab1=GUICtrlCreateTabitem ( "User Information") $branchin=GUICtrlCreateCombo ("", 3,45,260) GUICtrlSetData(-1,"Friedman, Billings, Ramsey & Co., Inc.|Friedman, Billings, Ramsey Group, Inc.|FBR Investment Management, Inc.|Friedman, Billings, Ramsey International, Ltd.", "Friedman, Billings, Ramsey & Co., Inc."); default Jon GUICtrlCreateLabel ("Branch Which You Work With", 3,25,500,20) $officein=GUICtrlCreateCombo ("", 3,95,260) GUICtrlSetData(-1,"Arlington - Nineteenth|Arlington - Kent Street|Austria|Bethesda|Boston|Cleveland|Dallas|Denver|Houston|Irvine|London|New York|Phoenix|San Francisco", "Arlington") GUICtrlCreateLabel ("Office", 3,75,500,20) $namein = GUICtrlCreateInput ("", 40,125,140,20) GUICtrlCreateLabel ("Name", 3,127,50,20) $titlein = GUICtrlCreateInput ("", 40,155,140,20) GUICtrlCreateLabel ("Title", 3,157,50,20) $phonein = GUICtrlCreateInput ("", 40,185,140,20) GUICtrlCreateLabel ("Phone", 3,187,50,20) $faxin = GUICtrlCreateInput ("", 40,215,140,20) GUICtrlCreateLabel ("Fax", 3,217,50,20) $phonein = GUICtrlCreateInput ("", 40,245,140,20) GUICtrlCreateLabel ("Email", 3,247,50,20) GUICtrlCreateTabitem (""); end tabitem definition $done=GUICtrlCreateButton ("Done", 150,300,50,20) $branch = GUICtrlRead( $branchin ) GUISetState () ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $plain GUICtrlCreatePic ( "Plain.jpg" , 90 ,25,300,150) Case $msg = $fbropen GUICtrlCreatePic ( "06open.jpg" , 90 ,25,300,150) Case $msg = $investor GUICtrlCreatePic ( "inv_conf_05.jpg" , 90 ,25,300,150) EndSelect If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $done Then ExitLoop Wend I also tried placing the while loop within the tab but that didnt work (as i expected it wouldnt) expandcollapse popup#include <GUIConstants.au3> GUICreate("Signature Generator"); will create a dialog box that when displayed is centered GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) $tab=GUICtrlCreateTab (-1,-1, 2000,1000) $tab0=GUICtrlCreateTabitem ("Template") $plain = GUICtrlCreateRadio ("Plain", 3, 40, 120, 20) $fbropen = GUICtrlCreateRadio ("Radio 2", 3, 65, 120, 20) $investor = GUICtrlCreateRadio ("Radio 3", 3, 90, 120, 20) ;~ $tab0input=GUICtrlCreateInput ("default", 80,50,70,20) While 1 $msg = GUIGetMsg() Select Case $msg = $plain GUICtrlCreatePic ( "Plain.jpg" , 90 ,25,300,150) Case $msg = $fbropen GUICtrlCreatePic ( "06open.jpg" , 90 ,25,300,150) Case $msg = $investor GUICtrlCreatePic ( "inv_conf_05.jpg" , 90 ,25,300,150) EndSelect WEnd $tab1=GUICtrlCreateTabitem ( "User Information") $branchin=GUICtrlCreateCombo ("", 3,45,260) GUICtrlSetData(-1,"Friedman, Billings, Ramsey & Co., Inc.|Friedman, Billings, Ramsey Group, Inc.|FBR Investment Management, Inc.|Friedman, Billings, Ramsey International, Ltd.", "Friedman, Billings, Ramsey & Co., Inc."); default Jon GUICtrlCreateLabel ("Branch Which You Work With", 3,25,500,20) $officein=GUICtrlCreateCombo ("", 3,95,260) GUICtrlSetData(-1,"Arlington - Nineteenth|Arlington - Kent Street|Austria|Bethesda|Boston|Cleveland|Dallas|Denver|Houston|Irvine|London|New York|Phoenix|San Francisco", "Arlington") GUICtrlCreateLabel ("Office", 3,75,500,20) $namein = GUICtrlCreateInput ("", 40,125,140,20) GUICtrlCreateLabel ("Name", 3,127,50,20) $titlein = GUICtrlCreateInput ("", 40,155,140,20) GUICtrlCreateLabel ("Title", 3,157,50,20) $phonein = GUICtrlCreateInput ("", 40,185,140,20) GUICtrlCreateLabel ("Phone", 3,187,50,20) $faxin = GUICtrlCreateInput ("", 40,215,140,20) GUICtrlCreateLabel ("Fax", 3,217,50,20) $phonein = GUICtrlCreateInput ("", 40,245,140,20) GUICtrlCreateLabel ("Email", 3,247,50,20) GUICtrlCreateTabitem (""); end tabitem definition $done=GUICtrlCreateButton ("Done", 150,300,50,20) $branch = GUICtrlRead( $branchin ) GUISetState () ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() ;~ Select ;~ Case $msg = $plain ;~ GUICtrlCreatePic ( "Plain.jpg" , 90 ,25,300,150) ;~ Case $msg = $fbropen ;~ GUICtrlCreatePic ( "06open.jpg" , 90 ,25,300,150) ;~ Case $msg = $investor ;~ GUICtrlCreatePic ( "inv_conf_05.jpg" , 90 ,25,300,150) ;~ EndSelect If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $done Then ExitLoop Wend Thanks, and lemme know if i should trim the code for posting purboses. Edited June 30, 2005 by Swimming_BIrd Link to comment Share on other sites More sharing options...
Swimming_Bird Posted June 30, 2005 Author Share Posted June 30, 2005 I also just noticed that when clicking the radio buttons the image displayed was lagged by one click. meaning nothing is clicked, i click radio1, nothing happens, i click radio3 pic for radio1 shows up. Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 30, 2005 Share Posted June 30, 2005 Okay. Below is some code. I have been unable to test as I dont have the pictures. Let me know if it works for you... expandcollapse popup#include <GUIConstants.au3> GUICreate("Signature Generator"); will create a dialog box that when displayed is centered GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) $tab=GUICtrlCreateTab (-1,-1, 2000,1000) $tab0=GUICtrlCreateTabitem ("Template") $plain = GUICtrlCreateRadio ("Plain", 3, 40, 120, 20) $fbropen = GUICtrlCreateRadio ("Radio 2", 3, 65, 120, 20) $investor = GUICtrlCreateRadio ("Radio 3", 3, 90, 120, 20) ;~ $tab0input=GUICtrlCreateInput ("default", 80,50,70,20) $tab1=GUICtrlCreateTabitem ( "User Information") $branchin=GUICtrlCreateCombo ("", 3,45,260) GUICtrlSetData(-1,"Friedman, Billings, Ramsey & Co., Inc.|Friedman, Billings, Ramsey Group, Inc.|FBR Investment Management, Inc.|Friedman, Billings, Ramsey International, Ltd.", "Friedman, Billings, Ramsey & Co., Inc."); default Jon GUICtrlCreateLabel ("Branch Which You Work With", 3,25,500,20) $officein=GUICtrlCreateCombo ("", 3,95,260) GUICtrlSetData(-1,"Arlington - Nineteenth|Arlington - Kent Street|Austria|Bethesda|Boston|Cleveland|Dallas|Denver|Houston|Irvine|London|New York|Phoenix|San Francisco", "Arlington") GUICtrlCreateLabel ("Office", 3,75,500,20) $namein = GUICtrlCreateInput ("", 40,125,140,20) GUICtrlCreateLabel ("Name", 3,127,50,20) $titlein = GUICtrlCreateInput ("", 40,155,140,20) GUICtrlCreateLabel ("Title", 3,157,50,20) $phonein = GUICtrlCreateInput ("", 40,185,140,20) GUICtrlCreateLabel ("Phone", 3,187,50,20) $faxin = GUICtrlCreateInput ("", 40,215,140,20) GUICtrlCreateLabel ("Fax", 3,217,50,20) $phonein = GUICtrlCreateInput ("", 40,245,140,20) GUICtrlCreateLabel ("Email", 3,247,50,20) $plain_pic = GUICtrlCreatePic ("Plain.jpg", 90, 25, 300, 150) $fbropen_pic = GUICtrlCreatePic ("06open.jpg", 90, 25, 300, 150) $investor_pic = GUICtrlCreatePic ("inv_conf_05.jpg", 90, 25, 300, 150) GUICtrlSetState($plain_pic, $GUI_HIDE) GUICtrlSetState($fbropen_pic, $GUI_HIDE) GUICtrlSetState($investor_pic, $GUI_HIDE) GUICtrlCreateTabitem (""); end tabitem definition $done=GUICtrlCreateButton ("Done", 150,300,50,20) $branch = GUICtrlRead( $branchin ) GUISetState () ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $plain GUICtrlSetState($fbropen_pic, $GUI_HIDE) GUICtrlSetState($investor_pic, $GUI_HIDE) GUICtrlSetState($plain_pic, $GUI_SHOW) Case $msg = $fbropen GUICtrlSetState($plain_pic, $GUI_HIDE) GUICtrlSetState($investor_pic, $GUI_HIDE) GUICtrlSetState($fbropen_pic, $GUI_SHOW) Case $msg = $investor GUICtrlSetState($plain_pic, $GUI_HIDE) GUICtrlSetState($fbropen_pic, $GUI_HIDE) GUICtrlSetState($investor_pic, $GUI_SHOW) EndSelect If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $done Then ExitLoop Wend I also thought of another way to do it as well. Below is the code for that. (It is untested as well). I am not sure that the GUICtrlSetImage() can be used for the pic, but I figured I would try it and let you test it. expandcollapse popup#include <GUIConstants.au3> GUICreate("Signature Generator"); will create a dialog box that when displayed is centered GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) $tab=GUICtrlCreateTab (-1,-1, 2000,1000) $tab0=GUICtrlCreateTabitem ("Template") $plain = GUICtrlCreateRadio ("Plain", 3, 40, 120, 20) $fbropen = GUICtrlCreateRadio ("Radio 2", 3, 65, 120, 20) $investor = GUICtrlCreateRadio ("Radio 3", 3, 90, 120, 20) ;~ $tab0input=GUICtrlCreateInput ("default", 80,50,70,20) $tab1=GUICtrlCreateTabitem ( "User Information") $branchin=GUICtrlCreateCombo ("", 3,45,260) GUICtrlSetData(-1,"Friedman, Billings, Ramsey & Co., Inc.|Friedman, Billings, Ramsey Group, Inc.|FBR Investment Management, Inc.|Friedman, Billings, Ramsey International, Ltd.", "Friedman, Billings, Ramsey & Co., Inc."); default Jon GUICtrlCreateLabel ("Branch Which You Work With", 3,25,500,20) $officein=GUICtrlCreateCombo ("", 3,95,260) GUICtrlSetData(-1,"Arlington - Nineteenth|Arlington - Kent Street|Austria|Bethesda|Boston|Cleveland|Dallas|Denver|Houston|Irvine|London|New York|Phoenix|San Francisco", "Arlington") GUICtrlCreateLabel ("Office", 3,75,500,20) $namein = GUICtrlCreateInput ("", 40,125,140,20) GUICtrlCreateLabel ("Name", 3,127,50,20) $titlein = GUICtrlCreateInput ("", 40,155,140,20) GUICtrlCreateLabel ("Title", 3,157,50,20) $phonein = GUICtrlCreateInput ("", 40,185,140,20) GUICtrlCreateLabel ("Phone", 3,187,50,20) $faxin = GUICtrlCreateInput ("", 40,215,140,20) GUICtrlCreateLabel ("Fax", 3,217,50,20) $phonein = GUICtrlCreateInput ("", 40,245,140,20) GUICtrlCreateLabel ("Email", 3,247,50,20) $pic = GUICtrlCreatePic("", 90, 25, 300, 150) GUICtrlCreateTabitem (""); end tabitem definition $done=GUICtrlCreateButton ("Done", 150,300,50,20) $branch = GUICtrlRead( $branchin ) GUISetState () ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $plain GUICtrlSetImage($pic, "Plain.jpg") Case $msg = $fbropen GUICtrlSetImage($pic, "06open.jpg") Case $msg = $investor GUICtrlSetImage($pic, "inv_conf_05.jpg") EndSelect If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $done Then ExitLoop Wend I hope one of the above methods helps. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Swimming_Bird Posted July 1, 2005 Author Share Posted July 1, 2005 your first code works great, i only had to move some of the code into the tab so that it wouldnt show on both of them Thanks a lot man. Link to comment Share on other sites More sharing options...
JSThePatriot Posted July 1, 2005 Share Posted July 1, 2005 your first code works great, i only had to move some of the code into the tab so that it wouldnt show on both of them Thanks a lot man.<{POST_SNAPBACK}>Not a problem. Glad I could help.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) 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