Jump to content
Sign in to follow this  
lsakizada

GUITreeView question

Recommended Posts

lsakizada

When I check a checkbox of an item that is not in focus, the selected mark is not set to this checkbox.

If i Click on the item itself then its mark the item correctly.

Can you please let me know why its behave like that?

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiImageList.au3>
#include <TreeViewConstants.au3>
#include <GuiTreeView.au3>
#include <ButtonConstants.au3>
#include <GuiButton.au3>
#include <GuiListView.au3>
#include <GuiStatusBar.au3>
;Global $SGUI = GUICreate("Configuration", 340, 200, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_MDICHILD), $Form1)
Global $SGUI = GUICreate("Configuration", 340, 200, -1, -1, -1, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xE0F0FE)
Global $hStatusBar2
Global $aParts2[2] = [40, -1]
Global $hHeader = _GUICtrlHeader_Create($SGUI)
_GUICtrlHeader_AddItem($hHeader, "Set Files To Search", 140)
_GUICtrlHeader_AddItem($hHeader, "", -1)
$hStatusBar2 = _GUICtrlStatusBar_Create($SGUI, $aParts2)
Global $Configtree = _GUICtrlTreeView_Create($SGUI, 0, 25, 160, 100, BitOR($TVS_CHECKBOXES, $TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVIS_DROPHILITED, $TVS_LINESATROOT, $TVS_SHOWSELALWAYS, $WS_TABSTOP), $TVS_CHECKBOXES);, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetTextColor($Configtree, 0x003D79)
_GUICtrlTreeView_SetBkColor($Configtree, 0xE0F0FE)
Global $hImage5 = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage5, "shell32.dll", 166)
_GUIImageList_AddIcon($hImage5, "shell32.dll", 199)
_GUIImageList_AddIcon($hImage5, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage5, "shell32.dll", 137)
_GUICtrlTreeView_SetNormalImageList($Configtree, $hImage5)
_GUICtrlTreeView_SetInsertMarkColor($Configtree, 13005581)
_GUICtrlTreeView_BeginUpdate($Configtree)
Global $ROOT = _GUICtrlTreeView_Add($Configtree, 0, StringFormat("General", 4), 2, 1)
Global $FileTypeTreeINI = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("INI", 1))
Global $FileTypeTreeCFG = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("CFG", 1))
Global $FileTypeTreeCONFIG = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("CONFIG", 1))
Global $FileTypeTreeDAT = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("DAT", 1))
Global $FileTypeElseTree = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("Other File Type", 1))
$GetButton = GUICtrlCreateButton("Get selected", 10, 150, 80, 23)
_GUICtrlTreeView_EndUpdate($Configtree)
_GUICtrlTreeView_Expand($Configtree)
GUISetState(@SW_SHOW, $SGUI)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            Sleep(50)
    EndSwitch
WEnd

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites
Authenticity

According to what picaxe posted here

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiImageList.au3>
#include <TreeViewConstants.au3>
#include <GuiTreeView.au3>
#include <ButtonConstants.au3>
#include <GuiButton.au3>
#include <GuiListView.au3>
#include <GuiStatusBar.au3>
;Global $SGUI = GUICreate("Configuration", 340, 200, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_MDICHILD), $Form1)
Global $SGUI = GUICreate("Configuration", 340, 200, -1, -1, -1, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xE0F0FE)
Global $hStatusBar2
Global $aParts2[2] = [40, -1]
Global $hHeader = _GUICtrlHeader_Create($SGUI)
_GUICtrlHeader_AddItem($hHeader, "Set Files To Search", 140)
_GUICtrlHeader_AddItem($hHeader, "", -1)
$hStatusBar2 = _GUICtrlStatusBar_Create($SGUI, $aParts2)
Global $Configtree = _GUICtrlTreeView_Create($SGUI, 0, 25, 160, 100, BitOR($TVS_CHECKBOXES, $TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVIS_DROPHILITED, $TVS_LINESATROOT, $TVS_SHOWSELALWAYS, $WS_TABSTOP), $TVS_CHECKBOXES);, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetTextColor($Configtree, 0x003D79)
_GUICtrlTreeView_SetBkColor($Configtree, 0xE0F0FE)
Global $hImage5 = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage5, "shell32.dll", 166)
_GUIImageList_AddIcon($hImage5, "shell32.dll", 199)
_GUIImageList_AddIcon($hImage5, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage5, "shell32.dll", 137)
_GUICtrlTreeView_SetNormalImageList($Configtree, $hImage5)
_GUICtrlTreeView_SetInsertMarkColor($Configtree, 13005581)
_GUICtrlTreeView_BeginUpdate($Configtree)
Global $ROOT = _GUICtrlTreeView_Add($Configtree, 0, StringFormat("General", 4), 2, 1)
Global $FileTypeTreeINI = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("INI", 1))
Global $FileTypeTreeCFG = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("CFG", 1))
Global $FileTypeTreeCONFIG = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("CONFIG", 1))
Global $FileTypeTreeDAT = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("DAT", 1))
Global $FileTypeElseTree = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("Other File Type", 1))
$GetButton = GUICtrlCreateButton("Get selected", 10, 150, 80, 23)
_GUICtrlTreeView_EndUpdate($Configtree)
_GUICtrlTreeView_Expand($Configtree)
GUISetState(@SW_SHOW, $SGUI)


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $GUI_EVENT_PRIMARYDOWN
            Local $tMPos = _WinAPI_GetMousePos(True, $Configtree)
            Local $tHitTest = _GUICtrlTreeView_HitTestEx($Configtree, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2))
            Local $iFlags = DllStructGetData($tHitTest, "Flags")
            If BitAND($iFlags, $TVHT_ONITEMSTATEICON) <> 0 Then
                Local $hItem = _GUICtrlTreeView_HitTestItem($Configtree, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2))
                If $hItem Then _GUICtrlTreeView_SelectItem($Configtree, $hItem)
            EndIf
    EndSwitch
WEnd

_GUICtrlStatusBar_Destroy($hStatusBar2)
_GUIImageList_Destroy($hImage5)
_GUICtrlTreeView_Destroy($Configtree)
_GUICtrlHeader_Destroy($hHeader)
GUIDelete()
Exit
Edited by Authenticity

Share this post


Link to post
Share on other sites
lsakizada

According to what picaxe posted here

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiImageList.au3>
#include <TreeViewConstants.au3>
#include <GuiTreeView.au3>
#include <ButtonConstants.au3>
#include <GuiButton.au3>
#include <GuiListView.au3>
#include <GuiStatusBar.au3>
;Global $SGUI = GUICreate("Configuration", 340, 200, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_MDICHILD), $Form1)
Global $SGUI = GUICreate("Configuration", 340, 200, -1, -1, -1, $WS_EX_TOOLWINDOW)
GUISetBkColor(0xE0F0FE)
Global $hStatusBar2
Global $aParts2[2] = [40, -1]
Global $hHeader = _GUICtrlHeader_Create($SGUI)
_GUICtrlHeader_AddItem($hHeader, "Set Files To Search", 140)
_GUICtrlHeader_AddItem($hHeader, "", -1)
$hStatusBar2 = _GUICtrlStatusBar_Create($SGUI, $aParts2)
Global $Configtree = _GUICtrlTreeView_Create($SGUI, 0, 25, 160, 100, BitOR($TVS_CHECKBOXES, $TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVIS_DROPHILITED, $TVS_LINESATROOT, $TVS_SHOWSELALWAYS, $WS_TABSTOP), $TVS_CHECKBOXES);, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetTextColor($Configtree, 0x003D79)
_GUICtrlTreeView_SetBkColor($Configtree, 0xE0F0FE)
Global $hImage5 = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage5, "shell32.dll", 166)
_GUIImageList_AddIcon($hImage5, "shell32.dll", 199)
_GUIImageList_AddIcon($hImage5, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage5, "shell32.dll", 137)
_GUICtrlTreeView_SetNormalImageList($Configtree, $hImage5)
_GUICtrlTreeView_SetInsertMarkColor($Configtree, 13005581)
_GUICtrlTreeView_BeginUpdate($Configtree)
Global $ROOT = _GUICtrlTreeView_Add($Configtree, 0, StringFormat("General", 4), 2, 1)
Global $FileTypeTreeINI = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("INI", 1))
Global $FileTypeTreeCFG = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("CFG", 1))
Global $FileTypeTreeCONFIG = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("CONFIG", 1))
Global $FileTypeTreeDAT = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("DAT", 1))
Global $FileTypeElseTree = _GUICtrlTreeView_AddChild($Configtree, $ROOT, StringFormat("Other File Type", 1))
$GetButton = GUICtrlCreateButton("Get selected", 10, 150, 80, 23)
_GUICtrlTreeView_EndUpdate($Configtree)
_GUICtrlTreeView_Expand($Configtree)
GUISetState(@SW_SHOW, $SGUI)


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $GUI_EVENT_PRIMARYDOWN
            Local $tMPos = _WinAPI_GetMousePos(True, $Configtree)
            Local $tHitTest = _GUICtrlTreeView_HitTestEx($Configtree, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2))
            Local $iFlags = DllStructGetData($tHitTest, "Flags")
            If BitAND($iFlags, $TVHT_ONITEMSTATEICON) <> 0 Then
                Local $hItem = _GUICtrlTreeView_HitTestItem($Configtree, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2))
                If $hItem Then _GUICtrlTreeView_SelectItem($Configtree, $hItem)
            EndIf
    EndSwitch
WEnd

_GUICtrlStatusBar_Destroy($hStatusBar2)
_GUIImageList_Destroy($hImage5)
_GUICtrlTreeView_Destroy($Configtree)
_GUICtrlHeader_Destroy($hHeader)
GUIDelete()
Exit

Authenticity, you are the man! Fantastic! I lost some hair :) , Thanks alot!


Be Green Now or Never (BGNN)!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.