T O P I C R E V I E W |
reepingk |
Posted - 03/21/2018 : 5:55:33 PM Am I missing something? I'm looking here https://www.originlab.com/doc/OriginC/ref/Tree-GlobalFunction and see no way to output a single tree value as a string? Sure, I can output the entire tree as a string, but that's not really.... helpful.
Also, I found https://www.originlab.com/doc/OriginC/ref/Tree-GetString (not included on the main Tree page for some reason) but that again, only outputs the entire tree as an XML string.
string tableName;
string graphName;
GETN_BOX(titless); //That's "titles" with an extra s
GETN_STR(tableName, "Table Name?", strPageName); //GETN_STR is outdated on the origin C programming guide E (PDF), it's missing the "_", leading to a good deal of confusion on my part
GETN_STR(graphname, "Graph Name?", strPageName);
GetNBox(titless);
// out_tree(titless,TRUE,TRUE);
// tableName = tree_get_node_by_id(titless,1,true); //Variable mismatch, I'm assuming tree_get_node_by_id doesn't return a string
// What I want to do below or just use the string variable "tableName" as an intermediate.
printf("TableName: " + titless.tableName + "\n");
I'm kinda confused as to why GetNBox returns stuff in such a weird way anyway, although with experience I'm sure I'll eventually understand. I kinda just assumed it'd set the variables to the strings/ints/whatever returned.
EDIT: Yes, I could just use InputBox, but I like to be able to tab from one field to the other and have everything on the same user dialog. (Without having to do string manipulation to split things apart.) And I want to eventually be able to do dropdown lists and stuff, which InputBox can't do (at least not on the same dialog box.)
Origin 2017 |
2 L A T E S T R E P L I E S (Newest First) |
yuki_wu |
Posted - 03/21/2018 : 11:38:47 PM Hi,
Thank you for pointing out the mistake in PDF file. Yes, the short line between GETN and STR is quite unclear since it is hidden by the hyperlink line. We will improve the PDF file later.
You can check the syntax of tree_get_node_by_id on this page, the function in fact will return a TreeNode not the value of the TreeNode as you expected. Perhaps you have confused the value of the TreeNode and the TreeNode itself.
https://www.originlab.com/doc/OriginC/ref/tree_get_node_by_id
Also, you should set the correct ID at first before you use the function. Use the property TreeNode::ID, you will find that the ID of titless.graphname is actually not 1.
To get the value of a TreeNode, use the method Castiel mentioned above.
To add a dropdown list to GetN dialog, GETN_COMBO should help: https://www.originlab.com/doc/OriginC/ref/GetN-OriginC#List_Box
Regards, Yuki OriginLab
|
Castiel |
Posted - 03/21/2018 : 10:23:52 PM quote: Originally posted by reepingk
string tableName;
string graphName;
GETN_BOX(titless); //That's "titles" with an extra s
GETN_STR(tableName, "Table Name?", strPageName); //GETN_STR is outdated on the origin C programming guide E (PDF), it's missing the "_", leading to a good deal of confusion on my part
GETN_STR(graphname, "Graph Name?", strPageName);
GetNBox(titless);
// out_tree(titless,TRUE,TRUE);
// tableName = tree_get_node_by_id(titless,1,true); //Variable mismatch, I'm assuming tree_get_node_by_id doesn't return a string
// What I want to do below or just use the string variable "tableName" as an intermediate.
printf("TableName: " + titless.tableName + "\n");
printf("TableName: %s\n", titless.tableName.strVal)
See the following page for more details.
https://www.originlab.com/doc/OriginC/ref/PropertyNode
I deem this page is most useful: https://www.originlab.com/doc/OriginC/ref/Classes
#####
#### _\_ ________
##=-[.].]| \
#( _\ | |------|
# __| | ||||||||
\ _/ | ||||||||
.--'--'-. | | ____ |
/ __ `|__|[o__o]|
_(____nm_______ /____\____
|
|
|