Sign in to follow this  
Followers 0
lyledg

Gui Enabled Input Box

8 posts in this topic

Guys..

Still learning heaps so apologies for the dumbass question..

I am trying to enable a input box, (which is intially set disabled) through a checkbox..

Basically, If a user chooses the checkbox, the input box should get enabled to accept text..

I know this is simple enough, just been coding all day and not seeing the answer right now...

Cheers! :)

Share this post


Link to post
Share on other sites



Guys..

Still learning heaps so apologies for the dumbass question..

I am trying to enable a input box, (which is intially set  disabled) through a checkbox..

Basically, If a user chooses the checkbox, the input box should get enabled to accept text..

I know this is simple enough, just been coding all day and not seeing the answer right now...

Cheers!  :)

<{POST_SNAPBACK}>

GUICtrlSetState($id,$GUI_ENABLE) :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks, i have already done this, but still not working..

Here is my code this far:

Global $LOGFILLOC = GUICtrlCreateInput ("", 30, 195 , 300, 20) GUICtrlSetState(-1,$GUI_ACCEPTFILES)GUICtrlSetState(-1,$GUI_DISABLE)$LOG = GUICtrlCreateCheckbox ("/LOG :: Output status to LOG file (overwrite existing log)", 25, 400, 300, 20)While 1  $msg = GUIGetMsg()    If GUIRead($LOG) = $GUI_CHECKED Then           GUICtrlSetState ($LOGFILLOC, $GUI_ENABLED)        Else    EndIf        EndIf[code=auto:0]When using this, I get an error saying I have not defined $LOGFILLOC as a variable. But I have declared this as a Global variable already, what am I doing wrong?CheersSee attachment


            
                


    Edited  by lyledg
    
    

            
        

        
            
                

    
        
            
        
    


            
        

        
            
                
                
                
            
            
                
            
        
        
    

    
        
            Share this post
            
Link to post
            
            
            

            
                Share on other sites
                

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    

            
        
    


    

                    
                
                    
                    
                    






    
    
        
SlimShady   

    
        
    
             0
    
        
    

        
            
                AutoIt lover
            
            

            
                

    
        
    

            
            Active Members
            
            
                

    
        
    
             0
    
        
    

                2,276 posts
                
                

            
        
    
    
        


    

    
        
            
            
                
            
            
        

        
    #4 · 
            Posted 
            
                (edited)
            
            
            
        
    

    


            
        
            This should work:
#include <GUIConstants.au3>

Global $LOGFILLOC = GUICtrlCreateInput ("", 30, 195 , 300, 20) 
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
GUICtrlSetState(-1,$GUI_DISABLE)

$LOG = GUICtrlCreateCheckbox ("/LOG :: Output status to LOG file (overwrite existing log)", 25, 400, 300, 20)

While 1
$msg = GUIGetMsg()

If GUIRead($LOG) = $GUI_CHECKED Then
GUICtrlSetState ($LOGFILLOC, $GUI_ENABLE)
Else
EndIf

EndIf
Edited by SlimShady

Share this post


Link to post
Share on other sites

Thanks, i have already done this, but still not working..

Here is my code this far:

Global $LOGFILLOC = GUICtrlCreateInput ("", 30, 195 , 300, 20) GUICtrlSetState(-1,$GUI_ACCEPTFILES)GUICtrlSetState(-1,$GUI_DISABLE)$LOG = GUICtrlCreateCheckbox ("/LOG :: Output status to LOG file (overwrite existing log)", 25, 400, 300, 20)While 1  $msg = GUIGetMsg()    If GUIRead($LOG) = $GUI_CHECKED Then           GUICtrlSetState ($LOGFILLOC, $GUI_ENABLED)        Else    EndIf        EndIf[code=auto:0]When using this, I get an error saying I have not defined $LOGFILLOC as a variable. But I have declared this as a Global variable already, what am I doing wrong?CheersSee attachment[post="43275"]<{POST_SNAPBACK}>[/post]the error come from $GUI_ENABLED and not from $LOGFILLOCthe state variable is $GUI_ENABLE 


            
        

        
            
                

    
        
            
        
    


            
        

        
            
                
                
                
            
            
                
            
        
        
    

    
        
            Share this post
            
Link to post
            
            
            

            
                Share on other sites
                

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    

            
        
    


    

                    
                
                    
                    
                    






    
    
        
lyledg   

    
        
    
             0
    
        
    

        
            
                Universalist
            
            

            
                

    
        
    

            
            Active Members
            
            
                

    
        
    
             0
    
        
    

                287 posts
                
                

            
        
    
    
        


    

    
        
            
            
                
            
            
        

        
    #6 · 
            Posted 
            
            
            
        
    

    


            
        
            Mate

So is the code I am using correct or not? I am a little confused by your answer..

Cheers


            
        

        
            
                

    
        
            
        
    


            
        

        
            
                
                
                
            
            
                
            
        
        
    

    
        
            Share this post
            
Link to post
            
            
            

            
                Share on other sites
                

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    

            
        
    


    

                    
                
                    
                    
                    






    
    
        
MHz   

    
        
    
             71
    
        
    

        
            
                Just simple
            
            

            
                

    
        
    

            
            MVPs
            
                
            
            
                

    
        
    
             71
    
        
    

                5,552 posts
                
                

            
        
    
    
        


    

    
        
            
            
                
            
            
        

        
    #7 · 
            Posted 
            
            
            
        
    

    


            
        
            
I am a little confused by your answer..As SlimShady has done. He has inserted at the top of his rewrite of your script.#include <GUIConstants.au3>
You need to have this in Gui scripts. It contains this
$GUI_ENABLE
This was causing problems. And as jpm described with
$GUI_ENABLED
should be
$GUI_ENABLE
Hope this clears your thoughts on your code.

My advise. lose the else and the extra endif. And add Wend to close the While loop

#include <GUIConstants.au3>

Global $LOGFILLOC = GUICtrlCreateInput ("", 30, 195 , 300, 20) 
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
GUICtrlSetState(-1,$GUI_DISABLE)

$LOG = GUICtrlCreateCheckbox ("/LOG :: Output status to LOG file (overwrite existing log)", 25, 400, 300, 20)

While 1
$msg = GUIGetMsg()

If GUIRead($LOG) = $GUI_CHECKED Then
GUICtrlSetState ($LOGFILLOC, $GUI_ENABLE)
EndIf
Wend

Good luck.

:)

Share this post


Link to post
Share on other sites

Thanks Guys!! I was too tired to see what JPM had actually meant...

Thanks for the explanation!

All working now..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0