Jump to content
Sign in to follow this  
czardas

How to clear queued msg

Recommended Posts

There's nothing wrong with it, apart from I can't tell which buttons have been disabled. I would probably use your method under most circumstances.

That's wrong. Again. You don't pay enough attention to the code. This line of code here:

If BitAnd(GUICtrlGetState($button), $GUI_ENABLE) Then
            GUICtrlSetState($button, $GUI_DISABLE)
        Else
            GUICtrlSetState($button, $GUI_ENABLE)
        EndIf

should give you a pretty good idea of how to get the enabled/disabled state of a button. If you need an array of enabled buttons, then do something like this:

Func _getListOfDisabledButtons()
    ; Using a precalculation here in favor of _ArrayAdd since arrayadd seems more expensive (presumption)
    $total = 0
    For $n = 0 to UBound($toggleButtons)-1
        $button = $toggleButtons[$n]
        If BitAnd(GUICtrlGetState($button), $GUI_DISABLE) Then
            $total += 1
        EndIf
    Next
    
    Local $ret[$total]
    $i = 0
    For $n = 0 to UBound($toggleButtons)-1
        $button = $toggleButtons[$n]
        If BitAnd(GUICtrlGetState($button), $GUI_DISABLE) Then
            $ret[$i] = $button
            $i += 1
        EndIf
    Next
    Return $ret
EndFunc

Share this post


Link to post
Share on other sites

I think you misunderstood. I only want one button to be active, plus I prefer the visual appearance of the other buttons to remain the same - so I can see the (disabled button state) configuration prior to running the process. I could colour code the buttons, but surely it is easier to render all GUI's containing those buttons inactive?

If BitAnd(GUICtrlGetState($button), $GUI_ENABLE) Then
            GUICtrlSetState($button, $GUI_DISABLE)
        Else
            GUICtrlSetState($button, $GUI_ENABLE) ; I don't want this!
        EndIf

What I originally wanted to do was clear the queue of messages sent to all GUI's, but seeing as that seems to be too complicated, I sought an alternative. Is there anything wrong with the method I suggested,

... apart from not being able to minimize the window. :)

Edited by czardas

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...