Sign in to follow this  
Followers 0
Emerica

Unload / Destroy Gui Object

4 posts in this topic

#1 ·  Posted (edited)

Im looking for a gui object destroy command or something similar.

I've been messing with another application I am working on which loaded different media players.

The problem i am running into is that I cant seem to remove the player once loaded. So additionnal players just overlap.

Here is an examle using a button.

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$loaded = False
$Form1 = GUICreate("AForm1", 300, 340, 192, 125)
$Button2 = GUICtrlCreateButton("Load / Unload", 104, 256, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button2
        onoff()
    Case Else
;;;;;;;
    EndSelect
WEnd
Exit

Func onoff()
    If $loaded ==False Then
        $Button1 = 0
        $Button1 = GUICtrlCreateButton("AButton1", 64, 24, 169, 81)
        $loaded=True
    ElseIf $loaded ==True Then
        $Button1 = 0
;;WHY WONT IT GO AWAY!
        $loaded = False
    EndIf
EndFunc
Edited by Emerica

Share this post


Link to post
Share on other sites



GUIDelete($Form1)? GUISetState(@SW_HIDE)?

Share this post


Link to post
Share on other sites

maybe

#include <GUIConstants.au3>
; == GUI generated with Koda ==

Dim $AButton1

$loaded = False
$Form1 = GUICreate("AForm1", 300, 340, 192, 125)
$Button2 = GUICtrlCreateButton("Load / Unload", 104, 256, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button2
        onoff()
    Case Else
;;;;;;;
    EndSelect
WEnd
Exit

Func onoff()
    If $loaded ==False Then
        $Button1 = 0
        $AButton1 = GUICtrlCreateButton("AButton1", 64, 24, 169, 81)
        $loaded=True
    ElseIf $loaded ==True Then
        $Button1 = 0
        GUICtrlDelete($AButton1)
;;WHY WONT IT GO AWAY!
        $loaded = False
    EndIf
EndFunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Ok.. I went for a walk around the building... and you guys made it happen.

Kudos!

Now to apply that to the media player :think:

Thanks.

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