xcal Posted October 27, 2006 Share Posted October 27, 2006 Sample -#include <GUIConstants.au3> #Include <GuiTreeView.au3> GUICreate('TreeView Test', 120, 160) $tv_main = GUICtrlCreateTreeView(10, 10, 100, 110, -1, $WS_EX_CLIENTEDGE) $tvi_1 = GUICtrlCreateTreeViewItem('Parent', $tv_main) _GUICtrlTreeViewSetState($tv_main, $tvi_1, $TVIS_EXPANDED) _GUICtrlTreeViewSetState($tv_main, $tvi_1, $TVIS_BOLD) GUICtrlCreateTreeViewItem('Child 1', $tvi_1) GUICtrlCreateTreeViewItem('Child 2', $tvi_1) $tvc_3 = GUICtrlCreateTreeViewItem('Child 3', $tvi_1) GUICtrlCreateTreeViewItem('Child 4', $tvi_1) GUICtrlCreateTreeViewItem('Child 5', $tvi_1) _GUICtrlTreeViewSetState($tv_main, $tvc_3, $TVIS_SELECTED) $btn = GUICtrlCreateButton('Selected', 10, 130, 100, 20) GUISetState() Do $msg = GUIGetMsg() If $msg = $btn Then $tv_msg = GUICtrlSendMsg($tv_main, $TVM_GETNEXTITEM, $TVGN_CARET, 0) MsgBox(0, '', _GUICtrlTreeViewGetText($tv_main, $tv_msg)) EndIf Sleep(50) Until $msg = $GUI_EVENT_CLOSEWith _GUICtrlTreeViewSetState($tv_main, $tvc_3, $TVIS_SELECTED) set, $tvc_3 (Child 3) seems to be selected when the script starts, but if you click the 'selected' button, it says the parent is selected. If you click any item other than 'Child 3,' the 'selected' button returns the proper item, but 'Child 3' remains selected. Clicking 'Child 3' then causes expected behavior. Am I misunderstanding how $TVIS_SELECTED is supposed to work? How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
GaryFrost Posted October 27, 2006 Share Posted October 27, 2006 GUICtrlSetState($tvc_3, $GUI_FOCUS) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
xcal Posted October 27, 2006 Author Share Posted October 27, 2006 Excellent, thank you. How To Ask Questions The Smart Way 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