covaks Posted December 20, 2007 Share Posted December 20, 2007 I'm having a problem with a prog I'm working on. I've re-created the problem below. When I hide radio button controls on a tab item, then show them with a combobox selection, they appear greyed out.. I have to click on another tab, and click back to have them not grayed out. So, run the program. then click on the Combobox and choose Test2. At that point the 2 radio buttons below will be become visible, but they are grayed out. I have to click on the second tab, then click back so I can use them. Am I doing something wrong? #include <GuiConstants.au3> GuiCreate("Test") GUICtrlCreateTab(1,1) GUICtrlCreateTabItem("Tab1") $Combo1 = GUICtrlCreateCombo("",5,30,50) GUICtrlSetData($Combo1,"Test|Test2","Test") $Radio1 = GUICtrlCreateRadio("Radio 1",20,80) $Radio2 = GUICtrlCreateRadio("Radio 2",20,100) GUICtrlSetState($Radio1, $GUI_HIDE) GUICtrlSetState($Radio2, $GUI_HIDE) GUICtrlCreateTabItem("Tab2") GuiSetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $Combo1 Then MyFunc() EndIf Wend Func MyFunc() GUICtrlSetState($Radio1, $GUI_SHOW) GUICtrlSetState($Radio2, $GUI_SHOW) EndFunc Link to comment Share on other sites More sharing options...
xzaz Posted December 20, 2007 Share Posted December 20, 2007 #include <GuiConstants.au3> GuiCreate("Test") GUICtrlCreateTab(1,1) GUICtrlCreateTabItem("Tab1") $Combo1 = GUICtrlCreateCombo("",5,30,50) GUICtrlSetData($Combo1,"Test|Test2","Test") $Radio1 = GUICtrlCreateRadio("Radio 1",20,80) $Radio2 = GUICtrlCreateRadio("Radio 2",20,100) GUICtrlCreateTabItem("Tab2") GuiSetState(@SW_SHOW) GUICtrlSetState($Radio1, $GUI_HIDE) GUICtrlSetState($Radio2, $GUI_HIDE) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $Combo1 Then MyFunc() EndIf Wend Func MyFunc() GUICtrlSetState($Radio1, $GUI_SHOW) GUICtrlSetState($Radio2, $GUI_SHOW) EndFunc Small Color Picker v0.2 | Travian bot Link to comment Share on other sites More sharing options...
covaks Posted December 20, 2007 Author Share Posted December 20, 2007 (edited) Thank you for the response. When I run it now, it is not grayed out at first. however, if I switch to tab2 first, then back to 1, then bring up the combobox and select Test2 to show the radio buttons, they are grayed out again. And I again have to cycle the tabs to get it back. Is there a logic to this that I'm not seeing? I modified it a bit so it more accurately reflects what I'm trying to do in my main program. expandcollapse popup#include <GuiConstants.au3> GuiCreate("Test") GUICtrlCreateTab(1,1) GUICtrlCreateTabItem("Tab1") $Combo1 = GUICtrlCreateCombo("",5,30,50) GUICtrlSetData($Combo1,"Test|Test2","Test") $Radio1 = GUICtrlCreateRadio("Radio 1",20,80) $Radio2 = GUICtrlCreateRadio("Radio 2",20,100) GUICtrlCreateTabItem("Tab2") GuiSetState(@SW_SHOW) GUICtrlSetState($Radio1, $GUI_HIDE) GUICtrlSetState($Radio2, $GUI_HIDE) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $Combo1 Then MyFunc() EndIf Wend Func MyFunc() If GUICtrlRead($Combo1) == "Test2" Then GUICtrlSetState($Radio1, $GUI_SHOW) GUICtrlSetState($Radio2, $GUI_SHOW) Else GUICtrlSetState($Radio1, $GUI_HIDE) GUICtrlSetState($Radio2, $GUI_HIDE) EndIf EndFunc Edited December 20, 2007 by covaks Link to comment Share on other sites More sharing options...
MrCreatoR Posted December 21, 2007 Share Posted December 21, 2007 Hi, Try this: expandcollapse popup#include <GuiConstants.au3> GuiCreate("Test") GUICtrlCreateTab(1,1) GUICtrlCreateTabItem("Tab1") $Combo1 = GUICtrlCreateCombo("",5,30,50) GUICtrlSetData($Combo1,"Test|Test2","Test") $Radio1 = GUICtrlCreateRadio("Radio 1",20,80) $Radio2 = GUICtrlCreateRadio("Radio 2",20,100) GUICtrlSetState($Radio1, $GUI_HIDE) GUICtrlSetState($Radio2, $GUI_HIDE) GUICtrlCreateTabItem("Tab2") GuiSetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $Combo1 Then MyFunc() EndIf Wend Func MyFunc() If GUICtrlRead($Combo1) == "Test2" Then GUICtrlSetState($Radio1, $GUI_SHOW+$GUI_ENABLE) GUICtrlSetState($Radio2, $GUI_SHOW+$GUI_ENABLE) Else GUICtrlSetState($Radio1, $GUI_HIDE) GUICtrlSetState($Radio2, $GUI_HIDE) EndIf EndFuncoÝ÷ ض¬ËÞ¯+-©ày·¡jø¨º·è®gç(ÚèÈhºWg¢ÖÞv+nW§Û!£ Ú~׫èzÔj׺Ú"µÍÚ[ÛYH ÑÝZPÛÛÝ[Ë]LÉÝÂÌÍÑÕRHHÕRPÜX]J ][ÝÕÝ ][ÝÊBÕRPÝÜX]UXKJBÕRPÝÜX]UX][J ][ÝÕXI][ÝÊBÌÍÔY[ÈHÕRPÝÜX]TY[Ê ][ÝÔY[É][ÝË BÕRPÝÙ]Ý]J ÌÍÔY[Ë ÌÍÑÕRWÒQJBÕRPÝÜX]UX][J ][ÝÕX][ÝÊBÝZTÙ]Ý]J BÕRPÝÙ]Ý]J ÌÍÔY[Ë ÌÍÑÕRWÔÒÕÊBÙÐÞ ][ÝÉ][ÝË ][ÝÔY[È]ÛÈ[XYH ][ÝÈ [ÈÛÛÛÛÛ[X[ ÌÍÑÕRK ][ÝÉ][ÝË ÌÍÔY[Ë ][ÝÒÑ[XY ][ÝÊJBÚ[HÕRQÙ]ÙÊ H ÉÝÈ ÌÍÑÕRWÑUSÐÓÔÑBÙ[ But it happens only if we create a second tab. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
therks Posted December 21, 2007 Share Posted December 21, 2007 I can confirm, looks like a bug to me (WinXP Home SP2). Should maybe make an official report (don't just link to this thread, make sure to include some system details), in the meantime MsCreator's workaround should work. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
covaks Posted December 21, 2007 Author Share Posted December 21, 2007 Thanks everyone. :-) I made a bug report as suggested. And thank you MsCreatoR, that worked perfect. :-) Link to comment Share on other sites More sharing options...
GEOSoft Posted December 21, 2007 Share Posted December 21, 2007 Thanks everyone. :-) I made a bug report as suggested. And thank you MsCreatoR, that worked perfect. :-)Not sure it's a bug at all. It seems to me it's doing what you told it to. It showing/hiding the control. It's up to you to enable/disable it. I use several tabs with radio controls and I don't have the problem. What happens when you change GUICtrlSetData($Combo1,"Test|Test2","Test") to GUICtrlSetData($Combo1,"Test|Test2") I also never use the constants so that may have something to do with it. The values would be GUICtrlSetState($Radio1, $GUI_HIDE) = GUICtrlSetState($Radio1, 160) ;; hidden and disabled GUICtrlSetState($Radio1, $GUI_SHOW) = GUICtrlSetState($Radio1, 80) ;; Showing and enabled. Also to avoid flicker is to use code like If GUIGetState($Radio1) < 80 Then GUICtrlSetState($Radio1, 80) In other words, check the state before you change it. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Siao Posted December 21, 2007 Share Posted December 21, 2007 @covaks Tab definition closing GUICtrlCreateTabitem ("") is missing in your code. Follow the manual and the problem is gone. Wonders of the world... "be smart, drink your wine" Link to comment Share on other sites More sharing options...
GEOSoft Posted December 21, 2007 Share Posted December 21, 2007 @covaksTab definition closingGUICtrlCreateTabitem ("")is missing in your code.Follow the manual and the problem is gone. Wonders of the world...Interesting. I have never yet closed my tabs. I do however place my radio controls within groups and close the groups. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
therks Posted December 22, 2007 Share Posted December 22, 2007 (edited) @covaksTab definition closingGUICtrlCreateTabitem ("")is missing in your code.Follow the manual and the problem is gone. Wonders of the world...Actually, it does not fix the problem.*Edit: To clarify, follow these steps exactly:1) Grab the script from post #3 and run it.2) Select Tab23) Select Tab14) Change the combo box to Test2> The two radio controls should appear - but they are disabled.5) Select Tab26) Select Tab1> The previously disabled radio controls should now be enabled.To repeat the bug, select Test from the combobox then continue from step 2. Edited December 22, 2007 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
MrCreatoR Posted December 22, 2007 Share Posted December 22, 2007 (edited) Not sure it's a bug at all. It seems to me it's doing what you told it to. It showing/hiding the control. It's up to you to enable/disable it.If i "say" Show the control, control should be shown, not disabled as well. The same with CheckBox don't "work": #include <GuiConstants.au3> $GUI = GUICreate("Test") GUICtrlCreateTab(1, 1) GUICtrlCreateTabItem("Tab 1") $CheckBox = GUICtrlCreateCheckbox("CheckBox", 20, 80) GUICtrlSetState($CheckBox, $GUI_HIDE) GUICtrlCreateTabItem("Tab 2") GuiSetState() GUICtrlSetState($CheckBox, $GUI_SHOW) MsgBox(64, "", "CheckBox is Enabled = " & ControlCommand($GUI, "", $CheckBox, "IsEnabled")) While GUIGetMsg() <> $GUI_EVENT_CLOSE Wend So it must be something with mixing tabs and radio.. Edited December 22, 2007 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team 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