James Posted April 18, 2008 Share Posted April 18, 2008 Hi all,Currently working on an INI file viewer/editor. I have all of the generating from INI done so now it displays like this:FILENAMESection1 Key1 Value1 Key2 Value2Section2 Key 1 Value 1 Key 2 Value 2Works well Now, I need to know how to get a context menu on the right click of an item. I need to be able to edit the value of the item.After that's all done, I can work on saving the tree into *.INI format Thanks,James Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted April 18, 2008 Author Share Posted April 18, 2008 I feel like I am in a loop here. There must be away of doing this simply. I seem to be having to call the same commands but nothing works Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted April 19, 2008 Author Share Posted April 19, 2008 (edited) Solved it Thanks to whoever made WM_NOTIFY() expandcollapse popupFunc WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview $hWndTreeview = $hTreeView If Not IsHWnd($hTreeView) Then $hWndTreeview = GUICtrlGetHandle($hTreeView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeview Switch $iCode Case $NM_RCLICK TreeView_RClick() EndSwitch EndSwitch EndFunc Func TreeView_RClick() Local $Hit, $MousePos, $hMenu $MousePos = MouseGetPos() $Hit = _GUICtrlTreeView_HitTestItem($hTreeView, $MousePos[0], $MousePos[1]) If ($Hit <> 0) Then $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_AddMenuItem($hMenu, "Rename", $idMenuRename) _GUICtrlMenu_AddMenuItem($hMenu, "Delete", $idMenuDelete) Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $hTreeView, -1, -1, 1, 1, 2) Case $idMenuRename ConsoleWrite("Rename" & @CRLF) Case $idMenuDelete $mConf = MsgBox(0x4+0x40, "InsideNI | INedisnI", "Are you sure you wish to remove:" & @CRLF & _GUICtrlTreeView_GetText($hTreeView, $Hit) & "?") If $mConf = 4 Then _GUICtrlTreeView_Delete($hTreeView, $Hit) EndIf EndSwitch _GUICtrlMenu_DestroyMenu($hMenu) EndIf EndFunc ;==>ListView_RClick I found it somewhere along with TreeView_RClick() Thanks whoever made those functions. How do I edit the text of a node now? I have tried to use _GUICtrlTreeView_EditText(), but it doesn't edit the text. I found the right style for editing the nodes but the change doesn't stay how it should be. Let's say I have a nod, I edit it from 1 to 2 I click off and it changes back to 1. Edited April 19, 2008 by JamesB Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Zedna Posted April 19, 2008 Share Posted April 19, 2008 How do I edit the text of a node now? I have tried to use _GUICtrlTreeView_EditText(), but it doesn't edit the text.I found the right style for editing the nodes but the change doesn't stay how it should be. Let's say I have a nod, I edit it from 1 to 2 I click off and it changes back to 1.After editing from 1 to 2 you must press Enter. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
James Posted April 19, 2008 Author Share Posted April 19, 2008 I have tried that, it doesn't do anything. This is the style I am using: Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS) Just an edited one from the helpfile. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Zedna Posted April 19, 2008 Share Posted April 19, 2008 Post simple reproducing script. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
James Posted April 19, 2008 Author Share Posted April 19, 2008 (edited) #include <GUIConstants.au3> #include <GUITreeView.au3> Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS) $GUI = GUICreate("", 266, 277, 371, 266) $Tree = _GUICtrlTreeView_Create($GUI, 8, 8, 249, 265, $iStyle) $Test1 = _GUICtrlTreeView_Add($Tree, 0, "Change me") $Test2 = _GUICtrlTreeView_AddChild($Tree, $Test1, "Change me") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Pressing enter or clicking off does not work. Even the helpfile example doesn't work. Edited April 19, 2008 by JamesB Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Zedna Posted April 19, 2008 Share Posted April 19, 2008 Look here Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted April 19, 2008 Share Posted April 19, 2008 I tried that but no success on WIN98 #include <GUIConstants.au3> #include <GUITreeView.au3> Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS) $GUI = GUICreate("", 266, 277, 371, 266) $TreeId = GUICtrlCreateTreeView (8, 8, 249, 265, $iStyle) ;~ $Tree = GUICtrlGetHandle($TreeId) $Test1 = GUICtrlCreateTreeViewitem("Change me", $TreeId) $Test2 = GUICtrlCreateTreeViewitem("Change me", $Test1) ;~ $Tree = _GUICtrlTreeView_Create($GUI, 8, 8, 249, 265, $iStyle) ;~ $Test1 = _GUICtrlTreeView_Add($Tree, 0, "Change me") ;~ $Test2 = _GUICtrlTreeView_AddChild($Tree, $Test1, "Change me") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
James Posted April 19, 2008 Author Share Posted April 19, 2008 Look hereThanks Zedna! I have it working using a modified version of WM_NOTIFY Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ 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