How to hide this? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Jonas353
Posts: 64
Joined: 13 Oct 2017, 06:37

How to hide this?

21 Oct 2017, 02:56

How do i hide it with GuiControl, Hide, ?

Code: Select all

#NoEnv
#SingleInstance Force

;/////Variables
DeleteCookies := 0
Shop := 0
DeleteCookiesProducerCost = 10
FastDeleterCost = 50
Perclick := 1
Cps := 0

;/////Gui
Gui, Add, Text, x1200 y10, Cookie Deleter
Gui, Add, Button, x100 y100 w100 h100 gDeleteCookiesUpgrade, Automatic Deleter ;--------------------------------------This one!
Gui, Add, Button, x250 y40 w100 h100 gCookiePerClick, Fast Deleter
Gui, Add, Button, x400 y100 w500 h500 gClickMe, ClickMe
Gui, Add, Button, x250 y200 w100 h100 gUpgrades, Upgrades
Gui, +AlwaysOnTop +MinimizeBox
Gui, Add, Text, x592 y50 w150 vDeleteCookies, Cookies Deleted: %DeleteCookies%
Gui, Add, Text, x650 y20 w150 vDeleteCookiesProducerCost, Cost: %DeleteCookiesProducerCost%
Gui, Add, Text, x247 y25 w150 vFastDeleterCost, Cost: %FastDeleterCost%
Gui, Add, Text, x600 y10 w150 vCps, CPS: %Cps%
Gui, Show, w1300 h650
return

;/////SetTimer
ClickMe:
DeleteCookies+=Perclick
SetTimer, CookiesCounter, 50
SetTimer, CookiesPerSecond, 1000
return

;/////Labels
CookiesCounter:
GuiControl,, DeleteCookies, Cookies Deleted: %DeleteCookies%
GuiControl,, DeleteCookiesProducerCost, Automatic Deleter Price: $%DeleteCookiesProducerCost%
GuiControl,, FastDeleterCost, Fast Deleter Price: $%FastDeleterCost%
GuiControl,, Cps, CPS: %Cps%
return

CookiesPerSecond:
DeleteCookies+=Cps
return

CookiePerClick:
if DeleteCookies >= %FastDeleterCost%
{
    DeleteCookies -= FastDeleterCost
    FastDeleterCost *= 4
    Perclick *= 2
}
return

DeleteCookiesUpgrade:
if DeleteCookies >= %DeleteCookiesProducerCost%
{
    DeleteCookies -= DeleteCookiesProducerCost
    DeleteCookiesProducerCost += 20
    Cps += 1
}
return

Upgrades:
Shop := 1

;/////Something
F12::Reload
GuiClose:
Esc::ExitApp

teadrinker
Posts: 4331
Joined: 29 Mar 2015, 09:41
Contact:

Re: How to hide this?

21 Oct 2017, 03:35

An example:

Code: Select all

Gui, Add, Button, w150 gHide, Click me to hide Button
Gui, Add, Button, yp x+5 wp vButtonToBeHidden, Button
Gui, Show
Return

Hide()  {
   GuiControl, 1:Hide, ButtonToBeHidden
}
Also consider this:

Code: Select all

Gui, Add, Button, w170 gHideShow, Click me to hide/show Button
Gui, Add, Button, yp x+5 wp vButtonToBeHidden, Button
Gui, Show
Return

HideShow()  {
   Gui, %A_Gui%: Default
   GuiControlGet, ButtonToBeHidden, Visible
   GuiControl, % ButtonToBeHidden ? "Hide" : "Show", ButtonToBeHidden
}
Jonas353
Posts: 64
Joined: 13 Oct 2017, 06:37

Re: How to hide this?

21 Oct 2017, 08:14

How to hide more than one?
teadrinker
Posts: 4331
Joined: 29 Mar 2015, 09:41
Contact:

Re: How to hide this?  Topic is solved

21 Oct 2017, 08:31

Like to hide one.

Code: Select all

Gui, Add, Button, vControlVariable1, Button1
Gui, Add, Button, vControlVariable2, Button2
Gui, Add, Button, vControlVariable3, Button3
Gui, Show

Sleep, 1000

GuiControl, Hide, ControlVariable1
GuiControl, Hide, ControlVariable2
GuiControl, Hide, ControlVariable3
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
Location: France
Contact:

Re: How to hide this?

21 Oct 2017, 08:39

Depending on how you intend to build your GUI consider that you also can make all controls in such a way that they belong to a tab and show/hide this one:

Code: Select all

visible := true
Gui, 1:Add, Tab3, +Buttons -Theme vTabControl y-25 w400 h400, test

Gui, 1:Tab, test
Gui, 1:Add, Progress,, 100
Gui, 1:Add, Radio,, test
Gui, 1:Add, Combobox, Text,, a||b
Gui, 1:Add, DropDownList, Text,, a||b
Gui, 1:Add, Button, Text,, test
Gui, 1:Add, ListBox,, Red|Green|Blue|Black|White
Gui, 1:Add, Hotkey, CTRL+I
Gui, 1:Add, Edit,, test
Gui, 1:Add, UpDown, Range1-10, 5
Gui, 1:Add, ListView,, ColumnTitle1|ColumnTitle2|...
Gui, 1:Show, Autosize
return

!i::
if (visible:=!visible)
	GuiControl, 1:Show, TabControl
else
	GuiControl, 1:Hide, TabControl
; GuiControl, % "1:" . ((visible:=!visible) ? "Show" : "Hide"), TabControl ; inline alternative using an expression and the ternary operator
return
my scripts

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, gsxr1300, mikeyww, PsysimSV and 280 guests