Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TreeCtrl » TreeCtrl - how to change images dynamically? [SOLVED + FIXED]
Re: TreeCtrl - how to change images dynamically? [message #2339 is a reply to message #2337] Sat, 08 April 2006 16:33 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
fudadmin wrote on Sat, 08 April 2006 09:09

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 Shocked ... Something magic. Maybe I was too tired and did a typo mistake once again somewhere. And I knew about that const... Smile
Anyway, thank you very much for confirming it because I was going mad and suspected bugs everywhere... Smile

And I couldn't understand the reason of not returning Node... but I have not much against const if it works... Laughing


Well, I have changed it to return value instead of reference... so no more confusion there Smile

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: TreeCtrl - how to set horizontal grid? [NEEDS IMPLEMENTATION...]
Next Topic: Missing callback trigger in OptionTree? [SOLVED/FIXED]
Goto Forum:
  


Current Time: Fri May 10 00:52:33 CEST 2024

Total time taken to generate the page: 0.01812 seconds