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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Page.GetFormat() results?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
walterhw Posted - 10/21/2004 : 09:13:56 AM
Origin Version: 7.5 SR4
Operating System: WinXP

I want to get a tree structure so that I can change some page properties of a newly created graph page but the GetFormat() method appears to return an invalid tree. When I execute:

void test_GetFormat() {
GraphPage gp;

gp.Create();
if( !gp.IsValid() ) { // If not valid, return
printf("Cannot create new GraphPage\r\n" );
return;
}

Tree tr;
TreeNode tn;
int iVal;
// constants from #include <OC_const.h>
printf("before gp.GetFormat()\r\n");
tr = gp.GetFormat();
out_tree(tr);
}

I get the following output in a script window:

test_GetFormat()
before gp.GetFormat()
<*><*><*><*><*><*> Get format error.
OriginStorage
e
e
e
e = -4
e = -4
e = 0
e
e = 0
e = 8.5
e = 11.
e
e = 1
e = 1
e = 1
e
e =
e
e
e
e = -4
e
e = 0
e = 0
e =
e =
e = 0
e =
e =
e
e = 0
e = 17.9
e = 11.6
e = 68.2
e = 71.8
e
e = 1
e = 1
e = 1
e = 1
e = 0
e = 0
e = 1.
e
e = 0
e = 3000
e = 1
e = 32
e = 32
e
e
e
e
e = 1
e = 2
e = 2
e
e = 0
e = 1
e = 1
e
e
e = 2
e = 6.e-002
e
e = 0
e = 0.1
e
e
e = 1
e
e = 0
e
e
e
e = 1
e = 2
e = 2
e
e = 0
e = 1
e = 1
e
e
e = 2
e = 6.e-002
e
e = 0
e = 0.1
e
e
e = 1
e
e = 0
e
e
e = 0.
e = 10.
e = 0
e = 1
e = 0
e = 2.
e = 6
e = 1
e =
e
e = 0
e = 0
e
e
e = 8.
e = 0
e = 0.
e
e
e = 0
e
e
e =
e =
e =
e = 0
e = 0
e = 0
e = 0
e = 0
e = 0
e = 0.
e = 0.
e = 0.
e
e
e
e = 16.6
e = 10.
e = 12.4
e = 15.2
e
e = -4
e = 0
e = 0.
e
e
e = 0
e = 0
e = 0.
e = -4
e
e = 0
e = 0
e = 6.
e = 0
e = 0
e = 1.5
e = 0
e = 22
e = 0
e = 0
e = 0

The values seem to be OK, but the node name of "e" in all cases does not make sense to me and the "<*><*><*><*><*><*> Get format error." message does not help me identify the problem.
3   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 10/21/2004 : 12:56:08 PM
Well, this is not standard C++, as the whole Tree thing in Origin C is an extension that make codes much easier to read with the a.b.c type of notation to directly go down to a particular tree node.

In Origin 8, the GetFormat command will allow the tree tagName to be used,


Tree GetFormat(DWORD dwPropertiesFilter = FPB_ALL, DWORD dwObjFilter = FOB_ALL, BOOL bGetTagNames = TRUE);



so the following code will become possible



void test_set_as_bold()
{
Page pg = Project.Pages();

Tree tr;
tr = pg.GetFormat(FPB_STYLE_FONT, FOB_ALL, true);

if(tr.Root.Page.Layers)
tr.Root.Page.Layers.Remove(); // remove detailed setttings on each layer
out_tree(tr);
tr.Root.Global.Bold.nVal = 1;
pg.ApplyFormat(tr);
}



CP


walterhw Posted - 10/21/2004 : 11:58:52 AM
Thanks, this approach seems to be what I need.

Is this standard C++? I looked in the header files but did not find where these apparent <sub property> member variables of the GraphPage class were declared.
easwar Posted - 10/21/2004 : 10:16:05 AM
Hello,

GetFormat() does not work (well) right now as you found out.

Pasted below is code showing another way to get and set properties using a tree. The key here is to know what sub property of the object is available for loading and setting. To see this, one quick way is to go to the graph page, select the object of interest such as a layer (or select nothing for the entire page), then right-click and select "Save Format as Theme" from the context menu. In the dialog that comes up, click the button with the picture of the pencil to open the theme editor. In the editor, you can see all nodes that are available. In the example pasted below, I access the Dimension and Background nodes.

See http://www.originlab.com/forum/topic.asp?TOPIC_ID=3413 for an example on accessing/changing layer properties.

Easwar
OriginLab


void test()
{
// Declare graph page as active page and check validity
GraphPage gpg = Project.Pages();
if( !gpg ) return;

// Declare tree and read dimension info of page into tree
Tree trPage;
trPage = gpg.Dimension;
// Dump tree contents to script window
out_tree( trPage );

// Now get page background info and dump to script window
trPage = gpg.Background;
out_tree( trPage );

// Change the page background color and set tree back
// to apply the change to the page
trPage.BaseColor.nVal = 1;
gpg.Background = trPage;
}





The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000