Home
Forum
Software
Mouser's Software
NANY: New Apps for the New Year
Friends of DC
Forum Coding Snacks
Editorials
Daily Blog
Monthly Newsletter
Mini Reviews
Favorite Websites
Archives
Articles
Historical Archives
Testimonials: What Folks Say About Us
Licensing
Get a License Key
Commercial Licensing
Help
Search
FAQs
DonationCoder Sitemap
Live Chat (Discord)
Contact Us
About Us
Donate
Home
Forum
Software
Mouser's Software
NANY: New Apps for the New Year
Friends of DC
Forum Coding Snacks
Editorials
Daily Blog
Monthly Newsletter
Mini Reviews
Favorite Websites
Archives
Articles
Historical Archives
Testimonials: What Folks Say About Us
Licensing
Get a License Key
Commercial Licensing
Help
Search
FAQs
DonationCoder Sitemap
Live Chat (Discord)
Contact Us
About Us
Donate
This topic
This board
Entire forum
Website and forum (google)
Member search
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
6 Months
Forever
Login with username, password and session length
Saturday May 10, 2025, 10:23 pm
Proudly celebrating 15+ years online.
Donate now
to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
Forum Home
Search
Login
Register
Recent Topics
Go To..
Recently updated topics
Recent posts (compact)
Recent posts (full text)
DonationCoder.com Forum
»
Removed Areas
»
Programming School
»
AutoHotkey
»
Hide Gui Buttons previously created
« previous
next »
New Topic
Print
Pages: [
1
] •
bottom
Author
Topic: Hide Gui Buttons previously created (Read 9005 times)
justice
Supporting Member
Joined in 2006
Posts:
1,898
Hide Gui Buttons previously created
«
on:
July 29, 2011, 07:37 AM »
In a loop I create a bunch of buttons with the following code:
Code:
Code: Autohotkey
[Select]
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?
skwire
Global Moderator
Joined in 2005
Posts:
5,290
Re: Hide Gui Buttons previously created
«
Reply #1 on:
July 29, 2011, 08:06 AM »
GuiControlGet doesn't handle hiding/showing/disabling/enabling of buttons. GuiControl does. Consider this example:
Code: Autohotkey
[Select]
Loop
,
6
{
Gui
,
Add
,
Button
,
vmyButton
%A_Index%
,
Click
me
}
Gui
,
Show
Sleep
,
1500
; Small delay to show form before changes.
Loop
,
6
{
If
(
Mod
(
A_Index
,
2
)
=
1
)
; Hide odd-numbered buttons.
{
GuiControl
,
Hide
,
myButton
%A_Index%
}
Else
; Disable even-numbered buttons.
{
GuiControl
,
Disable
,
myButton
%A_Index%
}
Sleep
,
500
; Small delay to show changes happening.
}
Return
; End of auto-execute section.
GuiClose
:
GuiEscape
:
{
ExitApp
}
Return
justice
Supporting Member
Joined in 2006
Posts:
1,898
Re: Hide Gui Buttons previously created
«
Reply #2 on:
July 29, 2011, 08:09 AM »
Thanks, sorry that was lazy typing I meant GuiControl. However, my buttons to not have variables assigned to them for a specific reason I cannot remember why, is there a way to do it without?
skwire
Global Moderator
Joined in 2005
Posts:
5,290
Re: Hide Gui Buttons previously created
«
Reply #3 on:
July 29, 2011, 08:26 AM »
In regards to GuiControl -- you have two choices if you don't have variable names assigned to the buttons.
You can use the "classname + instance number" combo. Button1, Button2, etc. I would advise against this method since that enumeration will change if you add other buttons before you add those looped buttons.
You can use the text of the button itself. Obviously, the text would need to be unique for each button (which I don't think it is in your case).
justice
Supporting Member
Joined in 2006
Posts:
1,898
Re: Hide Gui Buttons previously created
«
Reply #4 on:
July 29, 2011, 08:30 AM »
Got it to work
Great.
Code: Autohotkey
[Select]
Errorlevel
=
GuiControl
,
Enable
,
btn1
%a_index%
If
ErrorLevel
Gui
,
Add
,
Button
,
vbtn1
%a_index%
,
%ButtonLabel%
Else
{
GuiControl
,
Text
,
btn1
%a_index%
,
%ButtonLabel%
GuiControl
,
Show
,
btn1
%a_index%
}
I'm still not sure why I removed the variables initially, so will do serious testing.. Thanks so much skwire
sometimes AHK just lacks a simple example.
New Topic
Print
Pages: [
1
] •
top
« previous
next »
DonationCoder.com Forum
»
Removed Areas
»
Programming School
»
AutoHotkey
»
Hide Gui Buttons previously created