Sign in to follow this  
Followers 0

Changing A Ctrl In A Function

3 posts in this topic

Func MainGui()
$maingui =GUICreate("CrewKit",240,180)
Draw();Creates the 1-6 butttons, not the back

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg() 
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $1filemanager Then FileManager()
    If $msg = $2links Then Links()
    If $msg = $3misc Then Misc()
    If $msg = $4send2tray Then Hide()
    If $msg = $5about Then About()
    If $msg = $6close Then ExitLoop
    If $msg = $6back Then ExitLoop

$6back is a button created in the function FileManager() after I click the $1filemanager button created in Draw(). It deletes the Draw Controls and re-creates buttons.(One of which being $6back). I'm getting "variable used without being declared". After I try to run it.

If I add Global $6back to the top, it automatically closes the loop.


This is my close button creation in Draw()

GLOBAL $6close = GUICtrlCreateButton ("Close", 200,0,40,40,$BS_ICON)
GUICtrlSetImage (-1, "CrewKit.icl",0)

This is my back button creation in FileManager()

GLOBAL $6back = GUICtrlCreateButton ("Back", 200,0,40,40,$BS_ICON)
GUICtrlSetImage (-1, "CrewKit.icl",0)

Share this post

Link to post
Share on other sites


Create the Button $6back in Draw()

then use GUICtrlSetState( -1, $GUI_HIDE)


because eyou have already used GuiSetState() to show the is difficult to create new controls for that GUI

however you can chage the data and control tip ( looks like the pic is the same )

do this in the FileManager()

GuiCtrlSetData( $6back, "back")
GUICtrlSetTip( $6back, "back")

however in you while/wend loop you will need to use

GuiCtrlRead($6back) to see if is "close" or "back" to use it correctly



Share this post

Link to post
Share on other sites

why not just create both buttons and instead of creating/deleting just show/hide the buttons desired.

SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.


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