Jump to content

Monitor CheckBox events?


Recommended Posts

I wish to keep a live running-total of the status of a group of GUICtrlCreateCheckbox() controls within a GUI.

I've run a couple searches on the forum with no luck.

I'd rather not be constantly testing all the checkboxes to see how many are checked.

Does anyone know of a WM_NOTIFY that would help to only trigger my "count how many are checked" function when there was checkbox activity?

Thanks.

Edit: I'm scratching my head... I can determine the hwnd of a checkbox control event, but that doesn't correspond to an autoit control id, so I don't have the luxury of using a "Case $Checkbox[0] To $Checkbox[31]" statement to catch activity from any checkbox with a single line of code. I wish I could force checkboxes to return an event when changed, so I could process them in my main GUIGetMsg() loop... Anyone had to monitor totals in real time for a large group of checkboxes? Any ideas?

Edited by Spiff59
Link to comment
Share on other sites

Just a thought and it may not be what you need or even a good thought. Create dunny controls before and after the checkboxes.

$cbx_Start = GUICtrlCreateDummy()
    ;; create the checkboxes here
$cbx_End = GUICtrlCreateDummy()

In the loop

Case $cbx_Start to $cbx_End
  $iCount = 0
  For $i = $cbx_Start to $cbx_End
      If BitAND(GUICtrlGetState($i), $GUI_CHECKED) = $GUI_CHECKED Then $iCount += 1
  Next

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Just a thought and it may not be what you need or even a good thought. Create dunny controls before and after the checkboxes.

$cbx_Start = GUICtrlCreateDummy()
    ;; create the checkboxes here
$cbx_End = GUICtrlCreateDummy()

In the loop

Case $cbx_Start to $cbx_End
  $iCount = 0
  For $i = $cbx_Start to $cbx_End
      If BitAND(GUICtrlGetState($i), $GUI_CHECKED) = $GUI_CHECKED Then $iCount += 1
  Next

I don't seem to be able to capture any sort of event related to the checkboxes via GUIGetMsg().

Would wrapping the batch of CheckBox controls in the dummy controls have an affect on that?

Edit: Oh!!!!! I just threw together a little example script, and changing a checkbox status is reported via GUIGetMsg!!!

I have a bug somewhere, I'll find it. Thanks all.

Edited by Spiff59
Link to comment
Share on other sites

I don't seem to be able to capture any sort of event related to the checkboxes via GUIGetMsg().

Would wrapping the batch of CheckBox controls in the dummy controls have an affect on that?

Edit: Oh!!!!! I just threw together a little example script, and changing a checkbox status is reported via GUIGetMsg!!!

I have a bug somewhere, I'll find it. Thanks all.

I'd say you have a bug. I've often used the event from a checkbox to set the state of other checkboxes, similar to using Radio controls but I can have more than 1 checked at a time.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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