Overlord Posted March 19, 2009 Share Posted March 19, 2009 I saw a post here that had a GUI which had 2 radiobuttons and if 1 was checked a label would show. I tried to implement that for me but somewhere I went wrong. They are showing, but not hiding. expandcollapse popupDim Const $navOpenInNewTab = 0x0800 Global $sURL1 = "http://apps.facebook.com/inthemafia/remote/html_server.php?xw_time=1237431239&xw_exp_sig=c6797f3043ff094e132d44986eb9d1b4&xw_controller=recruit&xw_action=view" Global $friendslist = "http://www.facebook.com/friends/?ref=tn" Global $sSearch = "http://www.facebook.com/profile.php?id=" Global $sReplace = "http://apps.facebook.com/inthemafia/status_invite.php?from=" Global $oIE, $oLinks, $new_link, $FLID_input #Region ### START Koda GUI section ### Form=d:\documents and settings\evil_elf\my documents\form1_1.kxf $Form1_1 = GUICreate("Mafia Wars friendslist inviter", 338, 340, 334, 158) GUISetBkColor(0xC0C0C0) $txt1 = GUICtrlCreateLabel("This application will automatically add", 28, 16, 289, 20) GUICtrlSetFont(-1, 10, 800, 0, "Georgia") GUICtrlSetColor(-1, 0x800000) $txt2 = GUICtrlCreateLabel("your uninvited friends to mafia wars.", 37, 48, 271, 20) GUICtrlSetFont(-1, 10, 800, 0, "Georgia") GUICtrlSetColor(-1, 0x800000) $Button1 = GUICtrlCreateButton("THANK YOU!!!", 99, 288, 147, 41, 0) GUICtrlSetFont(-1, 12, 800, 2, "Georgia") GUICtrlSetColor(-1, 0xFF0000) $txt5 = GUICtrlCreateLabel("How many seconds sleep between adding", 23, 80, 299, 20) GUICtrlSetFont(-1, 10, 800, 0, "Georgia") GUICtrlSetColor(-1, 0x800000) $txt6 = GUICtrlCreateLabel("every person?", 23, 112, 105, 20) GUICtrlSetFont(-1, 10, 800, 0, "Georgia") GUICtrlSetColor(-1, 0x800000) $sleep = GUICtrlCreateInput("", 135, 104, 57, 24, BitOR($ES_AUTOHSCROLL,$ES_NUMBER)) GUICtrlSetLimit(-1, 4) GUICtrlSetFont(-1, 10, 800, 0, "Georgia") $txt3 = GUICtrlCreateLabel("Your ID?", 24, 144, 69, 20) GUICtrlSetFont(-1, 10, 800, 0, "Georgia") GUICtrlSetColor(-1, 0x800000) $ID = GUICtrlCreateInput("", 160, 144, 145, 24, BitOR($ES_AUTOHSCROLL,$ES_NUMBER)) GUICtrlSetFont(-1, 10, 800, 0, "Georgia") $txt4 = GUICtrlCreateLabel("Friendslist ID?", 24, 176, 110, 20) GUICtrlSetFont(-1, 10, 800, 0, "Georgia") GUICtrlSetColor(-1, 0x800000) $FLID = GUICtrlCreateInput($FLID_input, 160, 176, 145, 24, BitOR($ES_AUTOHSCROLL,$ES_NUMBER)) GUICtrlSetFont(-1, 10, 800, 0, "Georgia") $INCLUDE = GUICtrlCreateRadio("INCLUDE only this friendlist", 24, 216, 233, 17) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetFont(-1, 10, 800, 0, "Georgia") GUICtrlSetColor(-1, 0x800000) $EXCLUDE = GUICtrlCreateRadio("EXCLUDE this friendlist", 24, 240, 201, 17) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetFont(-1, 10, 800, 0, "Georgia") GUICtrlSetColor(-1, 0x800000) $remove = GUICtrlCreateCheckbox("Remove them after processing?", 24, 264, 249, 17) GUICtrlSetFont(-1, 10, 800, 0, "Georgia") GUICtrlSetColor(-1, 0x800000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button1 START() Case $GUI_EVENT_CLOSE Exit EndSwitch If GUICtrlRead($FLID) <> $FLID_input Then If $FLID <> $FLID_input Then GUICtrlSetState($INCLUDE, $GUI_SHOW) GUICtrlSetState($EXCLUDE, $GUI_SHOW) Else GUICtrlSetState($INCLUDE, $GUI_HIDE) GUICtrlSetState($EXCLUDE, $GUI_HIDE) EndIf EndIf WEnd as usual, I screwed up again. Yet I keep trying and learning, I hope :-) Link to comment Share on other sites More sharing options...
ResNullius Posted March 19, 2009 Share Posted March 19, 2009 Your nested if statement If $FLID <> $FLID_input Then will always evaluate to true, since you are testing the Input's GuiCtrlID ($FLID, which is 12 in this case) against the variable $FLID_input which is empty.Remove the nested IF and the code will work as you expect.If GUICtrlRead($FLID) <> $FLID_input Then GUICtrlSetState($INCLUDE, $GUI_SHOW) GUICtrlSetState($EXCLUDE, $GUI_SHOW) Else GUICtrlSetState($INCLUDE, $GUI_HIDE) GUICtrlSetState($EXCLUDE, $GUI_HIDE) EndIfNote: you will still experience some flicker because you are constantly setting the states of $INCLUDE and $EXCLUDE even when they may not need to be changed.But I'll bet you can figure out a way around that, right? Link to comment Share on other sites More sharing options...
Overlord Posted March 19, 2009 Author Share Posted March 19, 2009 Your nested if statement If $FLID <> $FLID_input Then will always evaluate to true, since you are testing the Input's GuiCtrlID ($FLID, which is 12 in this case) against the variable $FLID_input which is empty.Remove the nested IF and the code will work as you expect.DOH, I tried that, but forgot to remove the EndIf at the end so I got a error...Note: you will still experience some flicker because you are constantly setting the states of $INCLUDE and $EXCLUDE even when they may not need to be changed.But I'll bet you can figure out a way around that, right? err, nope? Like I said in several posts already... I'm a total dumbass but I keep trying :-)btw, thx for help :-) Link to comment Share on other sites More sharing options...
GEOSoft Posted March 19, 2009 Share Posted March 19, 2009 HINT: The solution to the flicker is to ALWAYS test the state of a control before setting its state again. 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...
Overlord Posted March 19, 2009 Author Share Posted March 19, 2009 HINT: The solution to the flicker is to ALWAYS test the state of a control before setting its state again. ok, call me a moron if you want... I suppose it got something to do with GUICtrlGetState($INCLUDE) and GUICtrlSetState($EXCLUDE) but I don't see where I should add them? I'm setting the control back to visual in this part: If GUICtrlRead($FLID) <> $FLID_input Then GUICtrlSetState($INCLUDE, $GUI_SHOW) GUICtrlSetState($EXCLUDE, $GUI_SHOW) Else GUICtrlSetState($INCLUDE, $GUI_HIDE) GUICtrlSetState($EXCLUDE, $GUI_HIDE) EndIf I'm dumb.... Link to comment Share on other sites More sharing options...
GEOSoft Posted March 19, 2009 Share Posted March 19, 2009 If GUICtrlRead($FLID) <> $FLID_input Then If GUICtrlGetState($INCLUDE) <> $GUI_SHOW Then GUICtrlSetState($INCLUDE, $GUI_SHOW) If GUICtrlGetState($EXCLUDE) <> $GUI_SHOW Then GUICtrlSetState($EXCLUDE, $GUI_SHOW) Else If GUICtrlGetState($INCLUDE) <> $GUI_HIDE Then GUICtrlSetState($INCLUDE, $GUI_HIDE ) If GUICtrlGetState($EXCLUDE) <> $GUI_HIDE Then GUICtrlSetState($EXCLUDE, $GUI_HIDE ) EndIf 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...
Overlord Posted March 19, 2009 Author Share Posted March 19, 2009 A humble THANK YOU! but it's still flickering lol 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