Sign in to follow this  
Followers 0
themax90

TreeViewItems with Checkboxs

5 posts in this topic

#1 ·  Posted (edited)

(Sorry for double posting but no one answered so I moved it 2 the appropriate location)

Hello I am working on an updater for my mchat project thats universal, in a way. And I want to make list views, with checkboxs.

- MChat Updates/Plugins
  -Updates
      [CHECKBOX] Some update
  -Plugins
      [CHECKBOX] Some Plugin
______________________________

Can someone help? Heres the script:

FileDelete(@ScriptDir & "\update.ini")
SplashTextOn( "Loading....", "Loading Update Information. Please be patient as our updater organizes this data.", 300, 45)
Dim $GUI_EVENT_CLOSE = -3, $TVS_HASBUTTONS = 0x0001, $TVS_HASLINES = 0x0002, $TVS_LINESATROOT = 0x0004, $TVS_DISABLEDRAGDROP = 0x0010, $TVS_SHOWSELALWAYS = 0x0020, $TVS_CHECKBOXES = 0x0100, $WS_EX_CLIENTEDGE = 0x00000200, $GUI_SHOW = 16, $GUI_HIDE = 32
$updater = GUICreate("Realm-Max Updater", 410, 335, (@DesktopWidth - 428) / 2, (@DesktopHeight - 351) / 2);, -1, -1, $parent )
$update_view = GUICtrlCreateTreeView(5, 80, 400, 250, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$update_button = GUICtrlCreateButton("Download and Install", 265, 10, 140, 30)
$info1 = GUICtrlCreateLabel("View the MChat Website", 267.5, 50, 135, 20)
$info2 = GUICtrlCreateLabel("Welcome to the MChat Updater. Please look over the updates and plugins and check the ones you wish. When finished, hit download and install.", 10, 15, 245, 45)
$main_view = GUICtrlCreateTreeViewitem("MChat Updates/Plugins", $update_view)
$updates = GUICtrlCreateTreeViewitem("Updates", $main_view)
$plugins = GUICtrlCreateTreeViewitem("Plugins", $main_view)
GUICtrlSetColor($info1, 0x0000ff)
GUICtrlSetFont($info1, 9, 400, 4)
GUICtrlSetTip($info1, "http://www.realm-max.net/mchat/")
InetGet( "http://www.realm-max.net/mchat/update.ini", @ScriptDir & "\update.ini", 1, 1)
Do
    Sleep(100)
Until FileExists(@ScriptDir & "\update.ini")
$update_check = IniRead(@ScriptDir & "\update.ini", "Update Info", "Updates", "-1")
If $update_check = -1 Then
    MsgBox(0, "Failure", "We are sorry, the update server is down.")
ElseIf $update_check <> - 1 Then
    Do
        $uinfoa = GUICtrlCreateTreeViewitem(IniRead(@ScriptDir & "\update.ini", "Updates", "Update" & $update_check & "A", ""), $updates)
        $update_check = $update_check - 1
    Until $update_check = 0
;Do the list stuff
EndIf
$plugin_check = IniRead(@ScriptDir & "\update.ini", "Update Info", "Plugins", "-1")
If $plugin_check = -1 Then
    MsgBox(0, "Failure", "We are sorry, the update server is down.")
ElseIf $plugin_check <> - 1 Then
    Do
        $pinfoa = GUICtrlCreateTreeViewitem(IniRead(@ScriptDir & "\update.ini", "Plugins", "Plugin" & $plugin_check & "A", ""), $plugins)
        $plugin_check = $plugin_check - 1
    Until $plugin_check = 0
;Do the list stuff
EndIf
SplashOff()
GUISetState()
While 1
    $msg = GUIGetMsg(1)
    $msg_event = $msg[0]
    $msg_win = $msg[1]
    If $msg_event = $GUI_EVENT_CLOSE And $msg_win = $updater Then
        FileDelete(@ScriptDir & "\update.ini")
        Exit
    EndIf
    If $msg_event = $info1 Then
        OpenSite("http://www.realm-max.net/mchat/")
    EndIf
Wend
Exit
Func OpenSite($SitePath)
    If @OSTYPE = 'WIN32_NT' Then
        $Str = @ComSpec & ' /c start "" '
    Else
        $Str = @ComSpec & ' /c start '
    EndIf
    SplashTextOn( "Opening", "Website " & $SitePath & " opening.", 400, 25)
    Run($Str & $SitePath, '', @SW_HIDE)
    Sleep(1500)
    SplashOff()
EndFunc  ;==>OpenSite

Please help if you can. If you notice, I Dimmed all the values so I dont have to include THE INTIRE GuiConstant file.

Edited by AutoIt Smith

Share this post


Link to post
Share on other sites



I don't think it can be done.

You have to apply the checkbox style to the main TreeView, and once you do that it applies to every item within it.

This is the best I could come up with.

#include <GUIConstants.au3>

$gui_Main = GUICreate("Treeview Test: No Checkboxes", 350, 212)
    
$tv_Main = GuiCtrlCreateTreeView(5, 5, 340, 150, BitOr($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_CHECKBOXES))
    
$ti_Title = GuiCtrlCreateTreeViewItem("MChat Updates/Plugins", $tv_Main)
$ti_Updates = GuiCtrlCreateTreeViewItem("Updates", $ti_Title)
$ti_Update1 = GuiCtrlCreateTreeViewItem("Update 1", $ti_Updates)
$ti_Update2 = GuiCtrlCreateTreeViewItem("Update 2", $ti_Updates)
$ti_Update3 = GuiCtrlCreateTreeViewItem("Update 3", $ti_Updates)

$ti_Plugins = GuiCtrlCreateTreeViewItem("Plugins", $ti_Title)
$ti_Plugin1 = GuiCtrlCreateTreeViewItem("Plugin 1", $ti_Plugins)
$ti_Plugin2 = GuiCtrlCreateTreeViewItem("Plugin 2", $ti_Plugins)
$ti_Plugin3 = GuiCtrlCreateTreeViewItem("Plugin 3", $ti_Plugins)

GuiSetState()
Do
    $i_Msg = GUIGetMsg()
Until $i_Msg = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites

Thats awesome, thats what I needed, cause if they check the above one it will check all the other ones, fantastic dude!

Share this post


Link to post
Share on other sites

Heh, neat idea that.

Share this post


Link to post
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
Sign in to follow this  
Followers 0