Jump to content

How to make ControlTreeView with radio instead of checkbox?


 Share

Recommended Posts

I tried to use 

$BS_AUTORADIOBUTTON

from TreeViewStyles.

Unfortunately it did not worked for me :(.

Could you help to make ControlTreeView  with radio buttons?

 


 

Here is the default example of TreeView with CheckBoxes:

#include <GUIConstantsEx.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
    Local $hGUI = GUICreate("ControlTreeView Example", 212, 212)
    Local $idTreeView_1 = GUICtrlCreateTreeView(6, 6, 200, 160, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE)
    Local $hTreeView_1 = ControlGetHandle($hGUI, "", $idTreeView_1)

    Local $idRoot = GUICtrlCreateTreeViewItem("Root", $idTreeView_1)
    GUICtrlCreateTreeViewItem("Item 1", $idRoot)
    GUICtrlCreateTreeViewItem("Item 2", $idRoot)
    GUICtrlCreateTreeViewItem("Item 3", $idRoot)
    Local $idItem_4 = GUICtrlCreateTreeViewItem("Item 4", $idRoot)
    GUICtrlCreateTreeViewItem("Item 4.1", $idItem_4)
    GUICtrlCreateTreeViewItem("Item 4.2", $idItem_4)
    GUICtrlCreateTreeViewItem("Item 5", $idRoot)

    GUISetState(@SW_SHOW, $hGUI)

    ControlTreeView($hGUI, "", $hTreeView_1, "Expand", "Root")

    ControlTreeView($hGUI, "", $hTreeView_1, "Exists", "Root|Item 4")
    ControlTreeView($hGUI, "", $hTreeView_1, "Check", "Root|Item 4")
    ControlTreeView($hGUI, "", $hTreeView_1, "Select", "Root|Item 4")
    ControlTreeView($hGUI, "", $hTreeView_1, "Expand", "Root|Item 4")

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    GUIDelete($hGUI)
EndFunc   ;==>Example

 

Edited by DannyJ
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...