tbaror Posted May 3, 2011 Share Posted May 3, 2011 Hello I am trying to mage TreeViewItem with checkbox and single selection only cant find the right GUI Control Styles Please advice Thanks #include <GUIConstantsEx.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 623, 449, 192, 114) $TreeView1 = GUICtrlCreateTreeView(32, 112, 521, 273, BitOR($GUI_SS_DEFAULT_TREEVIEW,$TVS_CHECKBOXES,$TVS_NOSCROLL,$WS_CLIPSIBLINGS)) $TreeView1_0 = GUICtrlCreateTreeViewItem("xzcz", $TreeView1) $TreeView1_1 = GUICtrlCreateTreeViewItem("xczx", $TreeView1) $TreeView1_2 = GUICtrlCreateTreeViewItem("xcz", $TreeView1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
funkey Posted May 3, 2011 Share Posted May 3, 2011 The only way I know is using pics for the radiobuttons. expandcollapse popup#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiTreeView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) _Unradiobmp("UnRadio.bmp", @ScriptDir, 0) _Radiobmp("Radio.bmp", @ScriptDir, 0) _Main() Func _Main() Local $hItem, $hImage, $hTreeView Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS) GUICreate("TreeView Create Solid BitMap", 400, 300) $hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) GUISetState() $hImage = _GUIImageList_Create() _GUIImageList_AddBitmap($hImage, "Radio.bmp") _GUIImageList_AddBitmap($hImage, "UnRadio.bmp") _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage) For $x = 0 To 7 $hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), 1, 0) Next ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func _Radiobmp ( $_Name, $_OutputPath, $_OverWrite=1 ) If Not FileExists ( $_OutputPath ) Then DirCreate ( $_OutputPath ) If StringRight ( $_OutputPath, 1 ) <> "\" Then $_OutputPath = $_OutputPath & "\" Local $_FilePath = $_OutputPath & $_Name If FileExists ( $_FilePath ) Then If $_OverWrite = 1 Then $_Filedelete = Filedelete ( $_FilePath ) If Not $_Filedelete Then MsgBox ( 0, "Error", "Unable to overwrite the file.", 5 ) Return SetError ( 1, 0, 0 ) EndIf Else Return EndIf EndIf Local $_FileBin $_FileBin = "0x424D360300000000000036000000280000001000000010000000010018000000000000030000C30E0000C30E00000000000000000000C8D0D4C8D0D4C8D0D4" $_FileBin &= "C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8" $_FileBin &= "D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4FFFFFFFFFFFFFFFFFFFFFFFFC8D0D4C8D0D4C8D0D4C8D0" $_FileBin &= "D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4FFFFFFFFFFFFC8D0D4C8D0D4C8D0D4C8D0D4FFFFFFFFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4" $_FileBin &= "808080C8D0D4C8D0D4FFFFFFFFFFFFFFFFFFFFFFFFC8D0D4C8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFF" $_FileBin &= "FFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFC8D0D4FFFF" $_FileBin &= "FFC8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFF000000000000000000000000FFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4808080" $_FileBin &= "404040FFFFFFFFFFFF000000000000000000000000FFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFF00000000" $_FileBin &= "0000FFFFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0" $_FileBin &= "D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040404040FFFFFFFFFFFFFFFFFFFFFFFF404040404040FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4" $_FileBin &= "C8D0D4808080808080404040404040404040404040808080808080C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D480808080808080" $_FileBin &= "8080808080C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0" $_FileBin &= "D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4" Local $_File = FileOpen ( $_FilePath, 17 ) If $_File = -1 Then MsgBox ( 0, "Error", "Unable to recreate the file.", 5 ) Return SetError ( 1, 1, 0 ) EndIf FileWrite ( $_File, $_FileBin ) FileClose ( $_File ) EndFunc ;==> _Radiobmp ( ) Func _Unradiobmp ( $_Name, $_OutputPath, $_OverWrite=1 ) If Not FileExists ( $_OutputPath ) Then DirCreate ( $_OutputPath ) If StringRight ( $_OutputPath, 1 ) <> "\" Then $_OutputPath = $_OutputPath & "\" Local $_FilePath = $_OutputPath & $_Name If FileExists ( $_FilePath ) Then If $_OverWrite = 1 Then $_Filedelete = Filedelete ( $_FilePath ) If Not $_Filedelete Then MsgBox ( 0, "Error", "Unable to overwrite the file.", 5 ) Return SetError ( 1, 0, 0 ) EndIf Else Return EndIf EndIf Local $_FileBin $_FileBin = "0x424D360300000000000036000000280000001000000010000000010018000000000000030000C30E0000C30E00000000000000000000C8D0D4C8D0D4C8D0D4" $_FileBin &= "C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8" $_FileBin &= "D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4FFFFFFFFFFFFFFFFFFFFFFFFC8D0D4C8D0D4C8D0D4C8D0" $_FileBin &= "D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4FFFFFFFFFFFFC8D0D4C8D0D4C8D0D4C8D0D4FFFFFFFFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4" $_FileBin &= "808080C8D0D4C8D0D4FFFFFFFFFFFFFFFFFFFFFFFFC8D0D4C8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFF" $_FileBin &= "FFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC8D0D4FFFF" $_FileBin &= "FFC8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4808080" $_FileBin &= "404040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFFFFFFFF" $_FileBin &= "FFFFFFFFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0" $_FileBin &= "D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040404040FFFFFFFFFFFFFFFFFFFFFFFF404040404040FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4" $_FileBin &= "C8D0D4808080808080404040404040404040404040808080808080C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D480808080808080" $_FileBin &= "8080808080C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0" $_FileBin &= "D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4" Local $_File = FileOpen ( $_FilePath, 17 ) If $_File = -1 Then MsgBox ( 0, "Error", "Unable to recreate the file.", 5 ) Return SetError ( 1, 1, 0 ) EndIf FileWrite ( $_File, $_FileBin ) FileClose ( $_File ) EndFunc ;==> _Unradiobmp ( ) mesale0077 1 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
tbaror Posted May 4, 2011 Author Share Posted May 4, 2011 The only way I know is using pics for the radiobuttons. expandcollapse popup#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiTreeView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) _Unradiobmp("UnRadio.bmp", @ScriptDir, 0) _Radiobmp("Radio.bmp", @ScriptDir, 0) _Main() Func _Main() Local $hItem, $hImage, $hTreeView Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS) GUICreate("TreeView Create Solid BitMap", 400, 300) $hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) GUISetState() $hImage = _GUIImageList_Create() _GUIImageList_AddBitmap($hImage, "Radio.bmp") _GUIImageList_AddBitmap($hImage, "UnRadio.bmp") _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage) For $x = 0 To 7 $hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), 1, 0) Next ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func _Radiobmp ( $_Name, $_OutputPath, $_OverWrite=1 ) If Not FileExists ( $_OutputPath ) Then DirCreate ( $_OutputPath ) If StringRight ( $_OutputPath, 1 ) <> "\" Then $_OutputPath = $_OutputPath & "\" Local $_FilePath = $_OutputPath & $_Name If FileExists ( $_FilePath ) Then If $_OverWrite = 1 Then $_Filedelete = Filedelete ( $_FilePath ) If Not $_Filedelete Then MsgBox ( 0, "Error", "Unable to overwrite the file.", 5 ) Return SetError ( 1, 0, 0 ) EndIf Else Return EndIf EndIf Local $_FileBin $_FileBin = "0x424D360300000000000036000000280000001000000010000000010018000000000000030000C30E0000C30E00000000000000000000C8D0D4C8D0D4C8D0D4" $_FileBin &= "C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8" $_FileBin &= "D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4FFFFFFFFFFFFFFFFFFFFFFFFC8D0D4C8D0D4C8D0D4C8D0" $_FileBin &= "D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4FFFFFFFFFFFFC8D0D4C8D0D4C8D0D4C8D0D4FFFFFFFFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4" $_FileBin &= "808080C8D0D4C8D0D4FFFFFFFFFFFFFFFFFFFFFFFFC8D0D4C8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFF" $_FileBin &= "FFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFC8D0D4FFFF" $_FileBin &= "FFC8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFF000000000000000000000000FFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4808080" $_FileBin &= "404040FFFFFFFFFFFF000000000000000000000000FFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFF00000000" $_FileBin &= "0000FFFFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0" $_FileBin &= "D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040404040FFFFFFFFFFFFFFFFFFFFFFFF404040404040FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4" $_FileBin &= "C8D0D4808080808080404040404040404040404040808080808080C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D480808080808080" $_FileBin &= "8080808080C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0" $_FileBin &= "D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4" Local $_File = FileOpen ( $_FilePath, 17 ) If $_File = -1 Then MsgBox ( 0, "Error", "Unable to recreate the file.", 5 ) Return SetError ( 1, 1, 0 ) EndIf FileWrite ( $_File, $_FileBin ) FileClose ( $_File ) EndFunc ;==> _Radiobmp ( ) Func _Unradiobmp ( $_Name, $_OutputPath, $_OverWrite=1 ) If Not FileExists ( $_OutputPath ) Then DirCreate ( $_OutputPath ) If StringRight ( $_OutputPath, 1 ) <> "\" Then $_OutputPath = $_OutputPath & "\" Local $_FilePath = $_OutputPath & $_Name If FileExists ( $_FilePath ) Then If $_OverWrite = 1 Then $_Filedelete = Filedelete ( $_FilePath ) If Not $_Filedelete Then MsgBox ( 0, "Error", "Unable to overwrite the file.", 5 ) Return SetError ( 1, 0, 0 ) EndIf Else Return EndIf EndIf Local $_FileBin $_FileBin = "0x424D360300000000000036000000280000001000000010000000010018000000000000030000C30E0000C30E00000000000000000000C8D0D4C8D0D4C8D0D4" $_FileBin &= "C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8" $_FileBin &= "D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4FFFFFFFFFFFFFFFFFFFFFFFFC8D0D4C8D0D4C8D0D4C8D0" $_FileBin &= "D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4FFFFFFFFFFFFC8D0D4C8D0D4C8D0D4C8D0D4FFFFFFFFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4" $_FileBin &= "808080C8D0D4C8D0D4FFFFFFFFFFFFFFFFFFFFFFFFC8D0D4C8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFF" $_FileBin &= "FFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC8D0D4FFFF" $_FileBin &= "FFC8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4808080" $_FileBin &= "404040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFFFFFFFF" $_FileBin &= "FFFFFFFFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC8D0D4FFFFFFC8D0" $_FileBin &= "D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4808080404040404040FFFFFFFFFFFFFFFFFFFFFFFF404040404040FFFFFFC8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4" $_FileBin &= "C8D0D4808080808080404040404040404040404040808080808080C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D480808080808080" $_FileBin &= "8080808080C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0" $_FileBin &= "D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4C8D0D4" Local $_File = FileOpen ( $_FilePath, 17 ) If $_File = -1 Then MsgBox ( 0, "Error", "Unable to recreate the file.", 5 ) Return SetError ( 1, 1, 0 ) EndIf FileWrite ( $_File, $_FileBin ) FileClose ( $_File ) EndFunc ;==> _Unradiobmp ( ) Thanks :0) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now