The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 GETN event handler
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cjfraz

USA
22 Posts

Posted - 06/30/2005 :  08:55:48 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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...

Mike Buess

USA
3037 Posts

Posted - 06/30/2005 :  3:53:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

cjfraz

USA
22 Posts

Posted - 07/01/2005 :  10:46:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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...
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000