tree view
BlitzPlus Forums/BlitzPlus Programming/tree view
| ||
Any one know if their is a way to detect if a treeview node is expanded or collapsed? Ta Mr Brine |
| ||
Maybe through userlibs, but not natively |
| ||
I'm not sure, but I think that expanding/collapsing a treeview node generates an event, $401 (gadget) probably. Im not sure if you can tell if it just got expanded or collapsed from eventdata(), but you will probably just have to track it from each event to the next, or write a TreeViewNodeStatus(handle) userlib. Hope it helps |
| ||
treeview events are only generated when a node is selected that is not currently selected, but not when a treeview node that is selected is expanded or closed. Does anybody know where you can get complete documentation for the user32.dll?? Brine |
| ||
Does anybody know where you can get complete documentation for the user32.dll?? I use Api Guide |
| ||
MSDN is good. Of course it's not organized that way (i.e. sections by DLL or something) but you can use dumpbin or PEview to get a list of the exported functions of the DLL, then look those up, OR just follow the "User Interface" section in the contents view. |
| ||
Maybe this will help you out. Click on (change the selected) node and it will tell you whether it's expanded or not.; Example code: Is the selected TreeView node currently expanded? ; Only works Win95/NT4 with IE5 or later ; .lib "user32.dll" ; SendMessage%(hwnd%, wMsg%, wParam%, lParam%):"SendMessageA" Const TV_FIRST = $1100 Const TVM_GETNEXTITEM = TV_FIRST + 10 Const TVM_GETITEMSTATE = TV_FIRST + 39 Const TVIS_EXPANDED = $20 Const TVGN_CARET = $9 w = CreateWindow("TreeView isExpanded Example", 10, 10, 300, 300, 0, 9) tv = CreateTreeView(0, 0, ClientWidth(w), ClientHeight(w), w) tvRoot = AddTreeViewNode("Root", TreeViewRoot(tv)) tv1 = AddTreeViewNode("1", tvRoot) tv2 = AddTreeViewNode("2", tv1) tv3 = AddTreeViewNode("3", tv2) tv4 = AddTreeViewNode("4", tvRoot) Repeat Select WaitEvent() Case $803 End Case $401 Select EventSource() Case tv If isExpanded(tv) Then SetStatusText(w, "Expanded") Else SetStatusText(w, "Not Expanded") EndIf End Select End Select Forever Function isExpanded(tv) selectedNodeHwnd% = SendMessage(QueryObject(tv,1), TVM_GETNEXTITEM, TVGN_CARET, 0) Return TVIS_EXPANDED And SendMessage(QueryObject(tv,1), TVM_GETITEMSTATE, selectedNodeHwnd, TVIS_EXPANDED) End Function |
| ||
Cheers all! Soja: - It also works with XP pro SP1, nice one!!! - where can I find peview and dumpbin Mr Brine |
| ||
Glad it works for you. Yeah, it just needs an updated version of comctl32.dll which isn't included in the base install of NT4 or Win95, but is in every other OS, and IE5. PEView Dumpbin: comes with VC++\Visual Studio, but I think it might be included if you download the free Win32 Platform SDK from Microsoft. I prefer this one simple because it just spits all the functions out into a text file. |