Page 1 of 1

Hide Button on a Named GUI - ARGGGHHHH

Posted: 13 May 2019, 11:48
by cdjagain
I'm trying to develop a gui that presents users with a list of browser tabs where the tab contains a certain phrase. Clicking one of the gui buttons will activate that tab in a browser. Used in a work context.

I can get the list of tabs and show in a gui. Great !

The trick is to how to handle a tab being closed. If I destroy and then recreate periodically the gui winks in and out, which is visually annoying. I'd rather HIDE a button and let the window resize.

I cannot :wtf: get the code correct to hide a button with text "xyz" on a GUI named "mygui"

Code: Select all

guicontrol, Hide, mygui%A_loopfield% 

Code: Select all


Gui, mygui:+LastFound                                                                                 ;<------------------- GUI is named "mygui"
myguiID := WinExist()	;store the ID of "mygui" window

wingettext, buttonlist, %myTitle%           ;get the text off the buttons

loop, parse, buttonlist, `n, `r
{
if (instr(tablist , A_Loopfield)>0)                       ;tablist is from Acc, pulls the list of tabs correctly
	{
	;tab still exists, do nothing to this button
	}	
	else
	{
	msgbox Need to delete/hide %A_loopfield%
	guicontrol, Hide, mygui%A_loopfield%             ;<----------HOW TO HIDE THE BUTTON  ARRRRGGHHHH !!!! 
	tablist:=strreplace(tablist,A_loopfield) ;tidy up the list
	}
}

}   ;loop

Re: Hide Button on a Named GUI - ARGGGHHHH

Posted: 14 May 2019, 05:43
by kyuuuri
You need to write a ":" After gui's name.
It should be like this: GuiControl, hide, MyGui:<ReplaceMeWithControl'sAssociated Variable>