T O P I C R E V I E W |
cjfraz |
Posted - 06/30/2005 : 08:55:48 AM Origin Version (Select Help-->About Origin): 7.5 SR5 Operating System: XP SP2
I've written a general event handler for a complicated GETN dialog. In general this seemed pretty strightforward, but I'm having trouble learning from the help file exactly what all the availble treenode properties are and how to set them.
Specifically, I'd like to be able to change the color of a branch label in this dialog using the event handler. Is there a color property of a treenode? How do I set it in the event handler?
It does seem clear this is possible becuase setting the 'enable' property of a branch to true or false in the event handler changes the color (black vs. grey).
Please advise.
Thanks,
J...
|
2 L A T E S T R E P L I E S (Newest First) |
cjfraz |
Posted - 07/01/2005 : 10:46:10 AM Thanks Mike. It does seem to me like at least an omission, if not an outright bug, to have an attribute that can clearly be changed in the event handler, but that is not visually updated when the event handler returns true.
However, I realize this stuff is pretty new, so I'll also keep my fingers crossed for future versions.
Thanks again,
J...
|
Mike Buess |
Posted - 06/30/2005 : 3:53:29 PM quote: Is there a color property of a treenode? How do I set it in the event handler?
A color property, or attribute, can be created for a tree node when you build the dialog (see the GETN_OPTION_ lines below) and you can even change that attribute in the event handler. Unfortunately that will not update the dialog window itself. The following dialog starts out with a blue line and a red line and its event handler changes the color attributes according the check states of each line. You'll see no color change when you run the dialog although the color attributes that are read on OK will be correct. Hopefully the event handler will have more control over the dialog window in future versions.void GetNColorTest() { int iRed = RGB(255,0,0); int iBlue = RGB(0,0,255); GETN_TREE(tr) GETN_CHECK(v1,"Color me red",0) GETN_OPTION_COLOR_LABEL(iBlue) // turn this label text blue GETN_CHECK(v2,"Color me blue",0) GETN_OPTION_COLOR_LABEL(iRed) // turn this label text red if( GetNBox(tr,"Test",NULL,NULL,cEvents) ) { int i; if( tr.v1.GetAttribute("LabelColor", i) ) { if( iRed==i ) out_str("Line 1 was red."); if( iBlue==i ) out_str("Line 1 was blue."); } if( tr.v2.GetAttribute("LabelColor", i) ) { if( iRed==i ) out_str("Line 2 was red."); if( iBlue==i ) out_str("Line 2 was blue."); } out_tree(tr); } } bool cEvents(TreeNode& tr, int nRow, int nType, Dialog& Dlg) { int iRed = RGB(255,0,0); int iBlue = RGB(0,0,255); if( nRow==0 ) tr.v1.SetAttribute("LabelColor", tr.v1.nVal ? iRed : iBlue); if( nRow==1 ) tr.v2.SetAttribute("LabelColor", tr.v2.nVal ? iBlue : iRed); return true; }
Mike Buess Origin WebRing Member |
|
|