Refresh a TreeView?

BlitzMax Forums/MaxGUI Module/Refresh a TreeView?

Gabriel(Posted 2006) [#1]
How can I force a TreeView to refresh or update? Currently, I open up my window with a treeview and start adding nodes with the right click menus, but they're completely invisible because the root node is closed and there is no check mark next it so the user cannot expand it. If I click on the area it would be if there was one, it expands, but that's not suitable for a professional app. I could also force the nodes open in that situation too, but that's not professional either. I just want to see the little "expand me" icon appear as soon as the node has child nodes to expand. I can't seem to find anything like a RefreshTreeView command though.


fredborg(Posted 2006) [#2]
Expand/CollapseTreeViewNode should do the trick.


Gabriel(Posted 2006) [#3]
Nope, I'm afraid that won't do it either, unless there's a command to tell me whether the node is currently expanded or collapsed. For the same reason that it's not very professional to go around opening nodes which were closed, it's not very professional to close nodes which were open.

The only other command I can find for TreeViewNodes is SelectTreeViewNode, which appears to be undocumented ( or the hotlink is just broken ) but I guess that's not what I need.


skidracer(Posted 2006) [#4]
It may well be a bug. I would never have considered coders closing the rootnode, users certainly can't.


Gabriel(Posted 2006) [#5]
Sorry, when I said "root node" I meant my own root node, which is parented to the actual root node. I don't use the actual root node for anything at all. The same thing is true of all nodes all the way down the chain. If you create child nodes for them in code while the treeview is displayed, they are not updated to indicate that they can be opened. You can click on them, and they are opened, but there is nothing visible until you do that, at which point they are updated.


skidracer(Posted 2006) [#6]
Gotcha, sorry for the confusion. Will look more into it but best fix I can come up with for now which doesn't seem to glitch and shouldn't slow things down but feels a bit like kickin old bill in the ribs:

brl.mod/win32maxgui.mod/win32gui.bmx[783]:
	Method InsertNode:TGadget(index,label$,icon)
		Local	parenthandle,nodehandle
		Local	node:TGadget
		parenthandle=handle
		If class=GADGET_TREEVIEW parenthandle=bbTreeViewRoot(handle)
		nodehandle=bbInsertTreeViewNode(index,Localize(label),parenthandle,icon)
		node=Create(GADGET_NODE,nodehandle,Self)
		node.name=label		
		If handle=parenthandle
			If CountKids()=1 
				bbExpandTreeViewNode handle
				bbCollapseTreeViewNode handle
			EndIf
		EndIf
		Return node
	End Method



Gabriel(Posted 2006) [#7]
Thanks. Unfortunately, I can't get Win32MaxGUI to compile ( not because of this change, it wouldn't compile before either. )

It complains of a redefinition of struct IHTMLFramesCollection2 in mshtml.h : 461 and points to line 478 with the same error in the same file for IHTMLWindow2.

These both occur trying to compile win32htmlview.cpp

I'm not sure if another module is conflicting, but if so, it's definitely not one of mine.

EDIT: On closer inspection, the errors seems to be because MinGW's headers have already defined these structs. Am I using an incorrect version of MinGW to build modules? What's the recommended version for that now? I think I'm using 3.4.2 as older versions couldn't be used to compile my TV3D wrapper.


skidracer(Posted 2006) [#8]
win32htmlview.cpp needs one extra pair of #ifndef #endif for later releases of mingw, i'm not sure which constant to base it from, the ones in there now is I think due to me erroneously thinking you could use struct names with an #ifndef...

for now, I would try remming out from line 35 or so down until you stop getting errors with a /* */ pair.


Dreamora(Posted 2006) [#9]
Recommended version for MingW is 3.1(.0.1)


Gabriel(Posted 2006) [#10]
Recommended version for MingW is 3.1(.0.1)

I still have that installed ( but not pointed to in Environment Variables ) but I just tried it, and it won't compile TV3D, so I can't go back to that.

win32htmlview.cpp needs one extra pair of #ifndef #endif for later releases of mingw, i'm not sure which constant to base it from, the ones in there now is I think due to me erroneously thinking you could use struct names with an #ifndef...


Ahhh, got it. Thanks.

EDIT: Nope, I thought I had it, but I don't. I got it compiling just fine, but now it won't link.

C:/Program Files/BlitzMax/mod/brl.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(group.cpp.debug.win32.x86.o)(.text+0x322):group.cpp: undefined reference to `std::_List_node_base::hook(std::_List_node_base*)'
C:/Program Files/BlitzMax/mod/brl.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(group.cpp.debug.win32.x86.o)(.text$_ZNSt4listIP8BBGadgetSaIS1_EE5eraseESt14_List_iteratorIS1_E+0xc):group.cpp: undefined reference to `std::_List_node_base::unhook()'
C:/Program Files/BlitzMax/mod/brl.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(treeview.cpp.debug.win32.x86.o)(.text+0x379):treeview.cpp: undefined reference to `std::_List_node_base::hook(std::_List_node_base*)'
C:/Program Files/BlitzMax/mod/brl.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(treeview.cpp.debug.win32.x86.o)(.text+0x3d3):treeview.cpp: undefined reference to `std::_List_node_base::hook(std::_List_node_base*)'
C:/Program Files/BlitzMax/mod/brl.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(treeview.cpp.debug.win32.x86.o)(.text$_ZNSt4listIP14BBTreeViewNodeSaIS1_EE6removeERKS1_+0x2a):treeview.cpp: undefined reference to `std::_List_node_base::unhook()'
C:/Program Files/BlitzMax/mod/brl.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(win32hwnd.cpp.debug.win32.x86.o)(.text$_ZNSt8_Rb_treeIP6HWND__St4pairIKS1_P9Win32HwndESt10_Select1stIS6_ESt4lessIS1_ESaIS6_EE5eraseESt17_Rb_tree_iteratorIS6_ESE_+0x45):win32hwnd.cpp: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
C:/Program Files/BlitzMax/mod/brl.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(win32hwnd.cpp.debug.win32.x86.o)(.text$_ZNSt8_Rb_treeIP6HWND__St4pairIKS1_P9Win32HwndESt10_Select1stIS6_ESt4lessIS1_ESaIS6_EE5eraseESt17_Rb_tree_iteratorIS6_ESE_+0x54):win32hwnd.cpp: undefined reference to `std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
C:/Program Files/BlitzMax/mod/brl.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(win32hwnd.cpp.debug.win32.x86.o)(.text$_ZNSt8_Rb_treeIP6HWND__St4pairIKS1_P9Win32HwndESt10_Select1stIS6_ESt4lessIS1_ESaIS6_EE5eraseERS3_+0x46):win32hwnd.cpp: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
C:/Program Files/BlitzMax/mod/brl.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(win32hwnd.cpp.debug.win32.x86.o)(.text$_ZNSt8_Rb_treeIP6HWND__St4pairIKS1_P9Win32HwndESt10_Select1stIS6_ESt4lessIS1_ESaIS6_EE9_M_insertEPSt18_Rb_tree_node_baseSE_RKS6_+0x4e):win32hwnd.cpp: undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
C:/Program Files/BlitzMax/mod/brl.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(win32hwnd.cpp.debug.win32.x86.o)(.text$_ZNSt8_Rb_treeIP6HWND__St4pairIKS1_P9Win32HwndESt10_Select1stIS6_ESt4lessIS1_ESaIS6_EE13insert_uniqueERKS6_+0x63):win32hwnd.cpp: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
Build Error: Failed to link C:/My Dev/BlitzMax/My Games/Blah/Blah.debug.exe
Process complete



skidracer(Posted 2006) [#11]
I think that means you need to rebuild win32maxgui entirely easiest is to kill it's .bmx folder or Rebuild Modules.


Gabriel(Posted 2006) [#12]
I've rebuilt both Win32MaxGUI separately and all modules together twice each, but I'm still getting the same errors.


skidracer(Posted 2006) [#13]
And maybe re/move the blitzmax/lib folder as that may be contributing conflicting GCC3 libs to your GCC4 environment.


skidracer(Posted 2006) [#14]
bump


Gabriel(Posted 2006) [#15]
No change. It still doesn't compile with the same errors, even after putting back several libs without which the program doesn't compile at all.


Defoc8(Posted 2006) [#16]
gab you simply cannot use a more modern version of
mingw, trust me - ive tried. I also tried out skids tips a while
back, but seems despite the corrections, the code simply
wont link correctly.. incompatible objects types or some such
nonesense.. so basically, your kinda screwed unless mark
makes some changes to the compiler...or so it would
seem....hope something happens with this, cuz its kinda
annoying..