Notifications
Clear all

[Closed] How to get the state of a checkbox

I know that I can set the state of a checkbox ( like the “Show Statistics in Active View” checkbox in the Viewport Configuration) using the uiaccessor.sendmessage command. But i cant figure out how to check wether the checkbox is already checked or not.
Does anyone know how to check this?

2 Replies

You can use “windows.Sendmessage” to send BM_GETCHECK to the checkbox
That returns the current state of the checkbox

here’s an excerpt of some code i implemented to get the state of the progressive refinement checkbox for Nitrous’s viewport config (befor this got exposed to maxscript )

-- Some defines from Winuser.h
BM_GETCHECK=0x00F0
BST_UNCHECKED=0 
BST_CHECKED=1
BST_INDETERMINATE=2

currentState = windows.sendMessage <cb_handle> BM_GETCHECK 0 0

case currentState  of 
(
	BST_UNCHECKED : <do your unchecked stuff>
	BST_CHECKED:     <do your checked stuff>
        BST_INDETERMINATE: < do nothing ? >
)

Thank you. That works perfect.