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
 changing page height problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

walterhw

USA
Posts

Posted - 10/21/2004 :  3:09:30 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version: 7.5 SR4
Operating System: WinXP

When I use the following code to change the page height from 11.0 to 8.5 inches, the window still behaves as if the page height was the original value. That is, the bottom edge of the window is always displaced from the bottom edge of the page. However, if I increase the page width from 8.5 to 11.0 inches, the window appears to work correctly with the new width. What is causing this difference in behavior?

void test_ChangeHeight() {
GraphPage gp;

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

Tree tr;
tr = gp.Dimension;
tr.Height.dVal = 8.5;
//tr.Width.dVal = 11.0;
gp.Dimension = tr;
}

easwar

USA
1965 Posts

Posted - 10/22/2004 :  09:22:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The page is aligned with the top left corner of the page being at the top left corner of the graph window. The layers inside the page have control as to how much gap there should be at the left, top etc within the page, in addition to the layer height and width...is this what you wanted?

The code segment below shows how to resize a layer inside a page. It also shows how to get to the axis scale properties as well. Note that here I am not using a tree. It is helpful to copy the properties to a tree to debug/print tree etc to see what is available, but if one knows the properties, one can instead directly get and set them as well.

Please post again if this did not answer your question.

Easwar
OriginLab


void test()
{
// Create a new page
GraphPage gp;
gp.Create();
if( !gp.IsValid() )
{
printf( "Cannot create new GraphPage\r\n" );
return;
}

// Set the page size to be 5 in x 5 in
gp.Dimension.Height.dVal = 5;
gp.Dimension.Width.dVal = 5;

// Set the size of layer 1 to be 3 inx 3 in with a 1 in border
GraphLayer gly = gp.Layers(0);
int iLyUnits = gly.Dimension.Units.nVal;
// If units is not in inches, change to inches temporarily
bool bChangedUnits;
if( iLyUnits != 1 )
{
gly.Dimension.Units.nVal = 1;
bChangedUnits = true;
}
// Set dimensions of the layer
gly.Dimension.Height.dVal = 3;
gly.Dimension.Width.dVal = 3;
gly.Dimension.Left.dVal = 1;
gly.Dimension.Top.dVal = 1;
// If units were switched, then switch back
if( bChangedUnits) gly.Dimension.Units.nVal = iLyUnits;

// Set x axis scale from 0 to 100
Axis axX = gly.XAxis;
axX.Scale.From.dVal = 0;
axX.Scale.To.dVal = 100;
}


Go to Top of Page

walterhw

USA
Posts

Posted - 10/22/2004 :  10:12:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hmm, I think my problem has more to do with sizing a page within a window rather than sizing layers within a page. I will look over what you posted and see if it helps. Thanks.

To illustrate my problem, run test_ChangeHeight() with the height change commented out. Observe that a 11"H x 8.5"W page is created. Resize the window and observe that the page resizes to fill either the full width or full height of the window constrained by preserving the aspect ratio of the page.

Now run test_ChangeHeight() with the height change to 8.5" and observe that there is always a gray space between the bottom of the page and the bottom of the window that remains even when there is sufficient space for the page to expand.

Now run test_ChangeHeight() with the width change to 11" and observe that the page width always expands to fill the available window width whenever ther is sufficient height to preserve the page aspect ratio.

My problem is how to get the page to fill the available height in the window after the page size is changed.
Go to Top of Page

easwar

USA
1965 Posts

Posted - 10/22/2004 :  11:16:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can get the page height to fill the window height (when window is sized to be wide enough) using the View->Whole Page menu item.

Programmatically, you will need to use LabTalk from within OC, using the following statement:
LT_execute( "page -o; page -o;" );

Make sure the graph page is active before executing the above statement.

Hope this is what you wanted.

Easwar
OriginLab



Edited by - easwar on 10/22/2004 11:18:18 AM
Go to Top of Page

walterhw

USA
Posts

Posted - 10/22/2004 :  11:49:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, Thanks, this does what I want.

But I must admit it seems rather cryptic to me and requiring use of LabView seems contrary to the objectives of OriginC. Is this by design and where could I look to understand better why it was done this way? Or, might this change in rev. 8?

Also, I'm puzzled by the need to invoke the LabView Page command twice and the apparent non-necessity for a type argument to the -o command switch. I've observed that
LT_execute( "page -o l;" );
is not sufficient to accomplish a change to landscape mode whether or not the page dimensions have already been changed.

Thanks again.
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 10/22/2004 :  1:07:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
But I must admit it seems rather cryptic to me and requiring use of LabView seems contrary to the objectives of OriginC. Is this by design and where could I look to understand better why it was done this way? Or, might this change in rev. 8?
LabTalk (not LabView, which also has a rich history) has been around much longer than OriginC. This particular LT command apparently doesn't work as designed and more control over such page properties will probably appear in OriginC in the future. But I doubt if all LT functions will be duplicated in OC... why reinvent the wheel? The objective of OC as I see it is to expand Origin's capabilities. What's wrong with using pre-existing tools (via LT_execute) in the process?

...Just the rantings of an old LT programmer. :)

Mike Buess
Origin WebRing Member
Go to Top of Page

easwar

USA
1965 Posts

Posted - 10/22/2004 :  1:11:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Currently, for this particular need, it looks like you have to use the LabTalk command from OC.

In general, most core functionality that was covered by LabTalk has been moved to OC, and loose ends such as this issue can be cleaned up in the next version. New capabilities are being added to Origin C for the next version as well.

Easwar
OriginLab

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