Jump to content

Changing A Ctrl In A Function


CrewXp
 Share

Recommended Posts

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

; 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
Wend
GUIDelete()
EndFunc

$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.

Thanks.

This is my close button creation in Draw()

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

This is my back button creation in FileManager()

GUICtrlDelete($6close)
GLOBAL $6back = GUICtrlCreateButton ("Back", 200,0,40,40,$BS_ICON)
GUICtrlSetImage (-1, "CrewKit.icl",0)
GUICtrlSetTip(-1,"Back")
Link to comment
Share on other sites

1

Create the Button $6back in Draw()

then use GUICtrlSetState( -1, $GUI_HIDE)

2

because eyou have already used GuiSetState() to show the GUI...it 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

8)

NEWHeader1.png

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...