AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to start GUI with button enabled or dislabed

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
aaffe



Joined: 17 May 2007
Posts: 66

PostPosted: Wed Dec 19, 2007 1:41 pm    Post subject: how to start GUI with button enabled or dislabed Reply with quote

Hy,
I created a Gui which has a special button. Now I want to check if there exists a special filename and if yes, the button has to be active, if not, it has to be inactive.
When another button is clicked I can change the mode of the button via
GuiControl,-enabled,Buttonname
, but directly when the program is started without clicking a button I can´t depend the state of the button reliable of the existing of a file.
Can please someone help me?
Code:




Gui, Add, Button, x86 y70 w290 h50 gSetzen, Button1
Gui, Add, Button, x86 y157 w290 h50 %a% gDasi, Button2
Gui, Add, Button, x126 y247 w210 h40 gBeenden, Beenden
Gui, Font, underline S10 bold
IfExist,D:\S3000\Temp\EK1_EK2_Sicherung.unl
   GuiControl,-enabled,Button2
else
   GuiControl,-disabled,Button2
Gui, Show, x131 y137 h307 w479, mein Fenster


Button1:
  ; I wonder why this command can change the button-state, but not the one by the IfExist-command....
  GuiControl,-disabled,Button2
Return
Back to top
View user's profile Send private message
tonne



Joined: 06 Jun 2006
Posts: 1158
Location: Denmark

PostPosted: Wed Dec 19, 2007 1:52 pm    Post subject: Reply with quote

Snippet
Code:
  Gui, Add, Button, x462 y12 w80 gProgram_OK vProgram_OK Default, OK
  Gui, Add, Button, x462 y52 w80 gProgram_Cancel,                 &Annuller
  If Adding
  {
    GuiControl,Disable,Program_OK
    Gui, Show,, Tilføj program
  }
  Else
  {
    Gui, Add, Button, x462 y92 w80         gProgram_SaveAs vProgram_SaveAs, &Gem som
    GuiControl,Disable,Program_SaveAs
    Gui, Show,, Ret program
  }

_________________
there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face

- Kashmir
Back to top
View user's profile Send private message
aaffe



Joined: 17 May 2007
Posts: 66

PostPosted: Wed Dec 19, 2007 2:01 pm    Post subject: Reply with quote

Hy tonne,
thanks a lot again!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group