Home » U++ Library support » TreeCtrl » TreeCtrl - how to change images dynamically? [SOLVED + FIXED]
Re: TreeCtrl - how to change images dynamically? [message #2337 is a reply to message #2335] |
Sat, 08 April 2006 15:09   |
 |
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
luzr wrote on Sat, 08 April 2006 13:05 |
I had tried this unsuccessfully... That's why I asked.
tree.SetNode(editid, tree.GetNode(editid).SetImage(CtrlImg::ImgEdit()));
E:\AriUppApps1\ideAris1\main.cpp(26) : error C2662: 'TreeCtrl::Node::SetImage' : cannot convert 'this' pointer from
'const TreeCtrl::Node' to 'TreeCtrl::Node &'
|
Quote: |
Ah... Well, one of rare cases when C++ does not play well...
Try
TreeCtrl::Node n = tree.GetNode(editid);
n.SetImage(CtrlImg::ImgEdit());
tree.SetNode(editid, n);
Thinking about it, it would probably be better here to return Node value instead of constant reference... what do you think? (Constant reference is faster, however in this case it is very likely you are about to change the value in most cases).
Mirek
|
It works this morning... I can't believe it didn't work yesterday ... Something magic. Maybe I was too tired and did a typo mistake once again somewhere. And I knew about that const... 
Anyway, thank you very much for confirming it because I was going mad and suspected bugs everywhere... 
And I couldn't understand the reason of not returning Node... but I have not much against const if it works...
[Updated on: Sat, 08 April 2006 15:11] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat Jul 05 11:39:27 CEST 2025
Total time taken to generate the page: 0.03130 seconds
|