Jump to content

how to use $GUI_INDETERMINATE?


rudi
 Share

Recommended Posts

Hi.

Checkboxes FAIK can have three states:

1.) checked

2.) unchecked

3.) neither checked nor unchecked. The Checkbox then is "filled with gray". From the help files I expected that one to be called "INDETERMINATED".

; autoit 3.3.4.0
#include <GUIConstantsEx.au3>

$w = 300
$h = 80
GUICreate("test", $w, $h)
GUICtrlCreateCheckbox("indeterminate", 20, 20, $w - 40, 20)
GUICtrlSetState(-1, $GUI_INDETERMINATE)
GUISetState()

Sleep(3000)

What I want to do:

For a registry tweak I want to show, if the value is set active (checked), is set inactive (unchecked), or is not present ("grayed" checkbox, just the checkboxes status, NOT the checkbox control's status = $GUI_DISABLE)

Howto?

Other, better approaches?

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Style $BS_AUTO3STATE needs to be set.

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

$w = 300
$h = 80
GUICreate("test", $w, $h)
GUICtrlCreateCheckbox("1", 20, 10, $w - 40, 20, $BS_AUTO3STATE)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlCreateCheckbox("2", 20, 30, $w - 40, 20,$BS_AUTO3STATE)
GUICtrlSetState(-1, $GUI_INDETERMINATE)
GUICtrlCreateCheckbox("4", 20, 50, $w - 40, 20,$BS_AUTO3STATE)
GUICtrlSetState(-1, $GUI_UNCHECKED)
GUISetState()

Sleep(10000)
Link to comment
Share on other sites

The $BS_AUTO3STATE style needs to be added to the CheckBox function, and the ButtonConstants include too. I've edited the code a bit more than needed, but..

; autoit 3.3.4.0
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

$w = 300
$h = 80
GUICreate("test", $w, $h)
GUICtrlCreateCheckbox("indeterminate", 20, 20, $w - 40, 20, $BS_AUTO3STATE)
;GUICtrlSetState(-1, $GUI_INDETERMINATE) ; commented so not indeterminate at first..
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Hi.

The $BS_AUTO3STATE style needs to be added to the CheckBox function, and the ButtonConstants include too. I've edited the code a bit more than needed, but..

; autoit 3.3.4.0
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
$w = 300
$h = 80
GUICreate("test", $w, $h)
GUICtrlCreateCheckbox("indeterminate", 20, 20, $w - 40, 20, $BS_AUTO3STATE)
;GUICtrlSetState(-1, $GUI_INDETERMINATE) ; commented so not indeterminate at first..
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()

That's it -- almost...

clicking the check box now cycles the states "Checked", "Unchecked", "Indeterminated Checked".

How to get "indeterminated UNchecked" ?

From the help file I worry that this "indeterminated unchecked" is not available with autoit?

$BS_AUTO3STATE 0x0006: 
Creates a three-state check box in which the state cycles through selected, unavailable, 
and cleared each time the user selects the check box.

Thanks, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

; autoit 3.3.4.0
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>

$w = 300
$h = 80
GUICreate("test", $w, $h)
Local $Label = GUICtrlCreateLabel(" ", 10, 10)
Local $Checkbox = GUICtrlCreateCheckbox("indeterminate", 30, 30, $w - 40, 20, $BS_AUTO3STATE)
;GUICtrlSetState(-1, $GUI_INDETERMINATE) ; commented so not indeterminate at first..
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    GUICtrlSetData($Label, GUICtrlRead($Checkbox))
WEnd
GUIDelete()

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Hi.

That's it -- almost...

clicking the check box now cycles the states "Checked", "Unchecked", "Indeterminated Checked".

How to get "indeterminated UNchecked" ?

From the help file I worry that this "indeterminated unchecked" is not available with autoit?

$BS_AUTO3STATE 0x0006: 
Creates a three-state check box in which the state cycles through selected, unavailable, 
and cleared each time the user selects the check box.

Thanks, Rudi.

Hi,

From MSDN

BS_3STATE

Creates a button that is the same as a check box, except that the box can be grayed as well as checked or cleared. Use the grayed state to show that the state of the check box is not determined.

BS_AUTO3STATE

Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, indeterminate, and cleared.

IMO, indeterminate means uncertain to determine state thus it is checked with doubt (greyed). "indeterminated unchecked" does not seem logical to exist. Holger did some functions to set pictures in the checkboxes to set a tri-state which may come as useful for this. Search for TristateTreeViewLib.au3 if you are interested.
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...