Jump to content

releasing GUICtrlCreateButton's command ?


MariusN
 Share

Recommended Posts

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)"...

Link to comment
Share on other sites

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

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

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.

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