AutoHotkey Community

It is currently May 27th, 2012, 12:51 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: July 29th, 2011, 1:33 pm 
Offline

Joined: October 27th, 2008, 12:25 pm
Posts: 24
In a loop I create a bunch of buttons with the following code:
Code:
Gui, Add, Button, gButtonDestinationSelect HWNDButtonDestinationSelect%a_index%, %ButtonLabel%


Later on I want to hide/disable all these buttons using GuiControlGet, Hide but I'm not able to 'point' to these buttons, could anyone write a quick example?

Thanks

_________________
Cheers


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2011, 4:56 pm 
Offline
User avatar

Joined: September 5th, 2009, 2:06 pm
Posts: 1718
Location: Somewhere near you
Code:
; Press F1 to hide, F2 to show.
Loop, 10
{
Gui, Add, Button, gLabel vButton%A_Index%, Button Name %A_Index%
GuiControlGet, var%A_Index%,, Button%A_Index%
}
Gui, Show,, Gui Test
return

Label:
Msgbox OK
return

F1::
Loop, 10
{
currentvar := var%A_Index%
GuiControl, Hide, %currentvar%
}
return

F2::
Loop, 10
{
currentvar := var%A_Index%
GuiControl, Show, %currentvar%
}
return

_________________
Image
The quick onyx goblin jumps over the lazy dwarf


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 25th, 2012, 11:40 am 
Offline
User avatar

Joined: May 16th, 2012, 11:33 pm
Posts: 6
I have another Question
How do i do it with more buttons.

I have 5 buttons all different names.
Those i want to hide like you did here..

This seems to be working
only 1 problem
When i use the last button
it has to restart.
Then the buttons dont disapear again.

Press ok
works fine.
when finised
Press ok again
buttons dont disapear

Code:
;#NoTrayIcon
#NoEnv
SetWorkingDir %A_ScriptDir%

Menu, Tray, Icon, wow.ico
Gui_x =Center ; (Default = Center)
Gui, Add, Picture,x0 y0 w151 h101 BackgroundTrans, lotr.jpg
Gui, font, s10, Arial
Gui, Add, Button, W50 H20 Y0 X0 +BackgroundTrans gAction, OK
Gui, Show,w151 h101,test
return

Action:
Gui, Add, Button, W100 H25 Y50 X0 , Button A
sleep 500
GuiControl, Hide, Button A
sleep 500
Gui, Add, Button, W100 H25 Y50 X0 , Button B
sleep 500
GuiControl, Hide, Button B
sleep 500
Gui, Add, Button, W100 H25 Y50 X0 , Button C
sleep 500
GuiControl, Hide, Button C
sleep 500
Gui, Add, Button, W100 H25 Y50 X0 , Button D
sleep 500
GuiControl, Hide, Button D
sleep 500
Gui, Add, Button, W100 H25 Y50 X0 , Button E
sleep 500
GuiControl, Hide, Button E
sleep 500
return



Last edited by Tegno on May 25th, 2012, 8:31 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 25th, 2012, 2:16 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
it is best to add all your buttons at once, and then only show and hide later on.

Code:
;#NoTrayIcon
#NoEnv
SetWorkingDir %A_ScriptDir%

;Menu, Tray, Icon, wow.ico
Gui_x =Center ; (Default = Center)
Gui, Add, Picture,x0 y0 w151 h101 BackgroundTrans, lotr.jpg
Gui, font, s10, Arial
Gui, Add, Button, W50 H20 Y0 X0 +BackgroundTrans gAction, OK
Gui, Add, Button, W100 H25 Y50 X0 vLoading  Hidden, Button A
Gui, Add, Button, W100 H25 Y50 X0 vCopy     Hidden, Button B
Gui, Add, Button, W100 H25 Y50 X0 vDelete   Hidden, Button C
Gui, Add, Button, W100 H25 Y50 X0 vtroep    Hidden, Button D
Gui, Add, Button, W100 H25 Y50 X0 vWissen   Hidden, Button E
Gui, Show,w151 h101,test
return

Action:
GuiControl, Show, Loading
sleep 500
GuiControl, Hide, Loading
sleep 500
GuiControl, Show, Copy
sleep 500
GuiControl, Hide, Copy
sleep 500
GuiControl, Show, Delete
sleep 500
GuiControl, Hide, Delete
sleep 500
GuiControl, Show, troep
sleep 500
GuiControl, Hide, troep
sleep 500
GuiControl, Show, Wissen
sleep 500
GuiControl, Hide, Wissen
sleep 500
return

GuiClose:
GuiEscape:
Exitapp

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 25th, 2012, 8:54 pm 
Offline
User avatar

Joined: May 16th, 2012, 11:33 pm
Posts: 6
Thx This is working perfect.
Its match easyer this way.

_________________
Greetings to all !
Image
"You have to be a little Crazy to live a Normal life !"


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, chaosad, jrav, MSN [Bot] and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group