Jump to content
Sign in to follow this  
MariusN

releasing GUICtrlCreateButton's command ?

Recommended Posts

MariusN

Hi fellow scripters. Does anyone here know how i can release a GUICtrlCreateButton's command? Let's say i have a

function in my script that THIS GUICtrlCreateButton calls...It will usely release itself AFTER the function has

completed. Thing is, i want it to release as soon as the function starts. So to my knowlege, I have to put something

in the very beginning of the function called, to release the button...

something that might look like "GUIDelete($button5)"...

Share this post


Link to post
Share on other sites
Dolemite50

GUICtrlDelete?

Help file example:

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $date, $del, $msg
    
    GUICreate("My GUI delete control", 200, 200, 800, 200)
    $date = GUICtrlCreateDate("1953/04/25", 10, 10, 185, 20)
    $del = GUICtrlCreateButton("Delete control", 50, 50, 70, 20)
    GUISetState()

    ; Run the GUI until the dialog is closed
    Do
        $msg = GUIGetMsg()
        If $msg = $del Then
            GUICtrlDelete($date)
            GUICtrlDelete($del)
        EndIf
    Until $msg = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

Share this post


Link to post
Share on other sites
MariusN

GUICtrlDelete?

Help file example:

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $date, $del, $msg
    
    GUICreate("My GUI delete control", 200, 200, 800, 200)
    $date = GUICtrlCreateDate("1953/04/25", 10, 10, 185, 20)
    $del = GUICtrlCreateButton("Delete control", 50, 50, 70, 20)
    GUISetState()

    ; Run the GUI until the dialog is closed
    Do
        $msg = GUIGetMsg()
        If $msg = $del Then
            GUICtrlDelete($date)
            GUICtrlDelete($del)
        EndIf
    Until $msg = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

Thanks for the reply Dolemite50, but that wasnt actually what i meant...Lets say for instance you got a menu with 2 buttons...You click the first, and have to wait till its finished before using the 2nd button...I want to use butto 2 WHILE button 1 is still in progress...Is this possible? Edited by MariusN

Share this post


Link to post
Share on other sites
Dolemite50

Uggh, now you're getting into a grey area for me. I may be wrong, but as far as I know AutoIt can't run multiple funcs simultaneously by default. If you search for "multithreading" you'll find more info and a few workarounds. Like I said, don't quote me on that.

If you just want to run func1 until button2 is pressed then check out _IsPressed and _ControlGetHovered. With those two you can create a func such as "_CheckPressed()" that you'll call from within the Button1 func. It will tell you when another button has been pressed and you can take it from there.

I'm still not sure what you're trying to do so if you hit me up with some code I might be able to help further.

Share this post


Link to post
Share on other sites
jvanegmond

You can simply use GUIOnEventMode.

Or place your GUI event processing in a function and call that continuously while executing the function that's being called on button 1.

Share this post


Link to post
Share on other sites
MariusN

Ok...will take it from here...thx to both of you guys...

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.