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
 Origin Forum
 Output GETN_BRANCH_OPTION
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

peter.cook

UK
356 Posts

Posted - 01/14/2006 :  09:14:14 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: Win2000

Hi,

Can anyone help?

I'm messing around with getn macro and one thing I want to do is to determine the state (collapsible) of a branch dependent on a variable. I can set this okay eg
if(Collapse==1) GETN_BRANCH_OPTION(GETN_BRANCH_OPEN)
but the next step is to save the state somehow on clicking the okay button eg to set the value of 'Collapse' variable.

Any clues?

Cheers,

Pete

TreeNode

64 Posts

Posted - 11/06/2009 :  06:24:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Pete!

I got busy myself with GetN macros, and think I understand something
about, how it works.
So perhabs I can helb you.

When putting: GETN_OPTION_BRANCH(GETN_BRANCH_OPEN)
in your code, there will be created an Attribute for this TreeNode, by calling method: SetAttribute()
You can then get this Attribute by using method: GetAttribute()

int save_state_collapsible_ex() {
	
	GETN_TREE(myTree)
 
	GETN_BEGIN_BRANCH(clientData, "Collapsible Branch")	GETN_OPTION_BRANCH(GETN_BRANCH_OPEN)
		GETN_STR(name, "Name", "Enter name")
		GETN_STR(adress, "Adress", "Enter adress")	 	 
		GETN_STR(contact, "Contact", "Enter contact")	 
	GETN_END_BRANCH(clientData)
 
	// This code will be execute when pressing "OK" button
	if( GetNBox(myTree, "Client Data", "Input client data") )	{
	
		int collap;
	
		if ( myTree.GetAttribute("Branch", collap) ) {	// dont know exactly if Attribute is named "Branch"
														// but you can check it in debug mode
			out_str("Found Attribute: " + collap);
			return collap;
		}
		else {
			out_str("Could not find Attribute!");
			return -1;
		}
	}
}


I dont know exactly how the Attribute is called. But you can check it
up in debug mode, viewing the TreeNode of your branch.
It has more than one Attributes. One is called "NodeID", another called "Label". And there must be created one, where the value of your collapsible option is saved.

You can get this value like in the example above. This method GetAttribute() awaits two parameters. The Attribute name, and a variable where to put the value.

The way how you export this value, and where, to use it for whatever you want it, you have to think about yourself! ;D

Hope I could help you!
greetz



<!-- helping each other is a good thing...like TreeNode holding the branches and leaves of a Tree -->
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