Blitz UI editing - Need help (you do the hard bit)
Blitz3D Forums/Blitz3D Programming/Blitz UI editing - Need help (you do the hard bit)
| ||
I am using BlitzUI for my program. Recently, I have required to add a TreeView gadget for a particular list. I have, however, required (by the way, required is my word of the day) to play about with the code a bit for the gadget to match my needs and I have become rather lost. I've successfully added a TM_GETCOUNT, and TM_GETSELECTED (recieving the index, not the handle of a node). I have also set the treeview gadget to return a gadget event when something on it is selected. Now, I am getting lost when I need to delete nodes and set the index selected on the TreeView. Presently I have attempted adding the following to the blitzUI source code around lines 1900 to 1941 (and these do not work at all): Case "TM_SETSELECTED" tree\currentindex = Param1 tree\Selected = tree\CurrentIndex and Case "NM_DELETE" if node\hasChildren blacklist = handle(node.node) for node.node = each node if handle(node\ParentNode.Node) = blacklist node\owner\count = node\owner\count - 1 node\parentNode\count = node\parentNode\count - 1 delete node endif next node.node = object.node(blacklist) delete node node\owner\count = node\owner\count - 1 node\parentNode\count = node\parentNode\count - 1 else delete node node\owner\count = node\owner\count - 1 node\parentNode\count = node\parentNode\count - 1 endif Can you please help me figure out how to get this working? |
| ||
Actually, have you tried just deleting the nodes? I did that with BlitzUI back when I used it for LotusEd (r1), and it worked fine. Node.Node = Object.Node(ENode\Node) Delete Node That'd be the somewhat exact code. You have to make sure that you delete all children nodes as well. If you don't, BlitzUI will either freak out and have a panic attack and probably result in a MAV, or you'll end up with a very strange effect going on with the treeview nodes. I'm going to guess that tree\Selected (first codebox) refers to the handle of a node and not the index of the node. Only a guess though. |
| ||
Works almost fine now. I've altered a bit of it now:node\owner\count = node\owner\count - 1 node\parentNode\count = node\parentNode\count - 1 if node\parentNode\count = 0 then node\parentNode\haschildren = false delete nodeto tell blitzUI how many spaces to leave or something. I think it's mostly my own program's end that's going crazy now so that's good :) Still can't figure out how to set the selected node. Thanks for the help so far. |
| ||
/me casts life2 on "Blitz UI editing - Need help (you do the hard bit)" I apologize for resurrecting a 3 year old thread, but it is pertinent to my current problem. TM_GETHANDLE does not seem to function with the TreeView gadget. I messed around with the BlitzUI.bb file @ 1862ish " Return tree\CHandle " does not seem to work here. I was able to add the two commands that Picklesworth added himself above, but I can not get the handle of the seleted node to return despite my tinkering. tree.TreeView = Object.TreeView( ID ) If tree <> Null Select Message Case "TM_SETHANDLE" tree\CHandle = Param1 Case "TM_GETHANDLE" Return tree\CHandle ; <--- This guy doesnt work like hes supposed to? Case "TM_GETSELECTED" Return tree\Selected Case "TM_GETCAPTION", "TM_GETTEXT" Return tree\Caption Case "TM_GETPARENTCAPTION" Return tree\ParentCaption Case "TM_SETPOS" If Param1 > "" tree\X = Param1 If Param2 > "" tree\Y = Param2 Case "TM_GETPOS" If Param1 > "" Return tree\X If Param2 > "" Return tree\Y Case "TM_SETSIZE" If Param1 > "" tree\W = Param1 If Param2 > "" tree\H = Param2 Case "TM_GETSIZE" If Param1 > "" Return tree\W If Param2 > "" Return tree\H Case "TM_DISABLE" tree\Disabled = True For node.Node = Each Node If node\Owner = tree node\Disabled = True EndIf Next Case "TM_ENABLE" tree\Disabled = False For node.Node = Each Node If node\Owner = tree node\Disabled = False EndIf Next Case "TM_GETENABLED" Return 1 - tree\Disabled End Select EndIf EndIf Does anyone know of any way to get a node handle to return in a treelist? My current work-around-strategy is to just use the TM_GETCAPTION command, (which does work) using the captions like handles. It would work I guess, but it would be nice to get treeview to perform the way it was inteded. |
| ||
The Tree object was never finished by the original author. I had to abandon my use of it, and just use lists. |
| ||
Thanks for the reply. That is good to know. |