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
 Manipulating GraphObjects

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
MBIMO Posted - 09/01/2005 : 11:53:34 AM
Origin Version (Select Help-->About Origin): 7.5 SR5
Operating System: Win2k

Hello everybody,

currently I'm trying to manipulate the size and position of GraphObjects programmatically.
First I tried the Top/Left/Width/Height data fields. But this works only for Top/Left and not for Width/Height since the latter two are readonly.
So I switched to the X/Y/DX/DY data fields. However they are using scale units instead of pixels. Since I want to rescale a GraphObject depending of the size of some GraphObjects on another layer, I run into problems the very moment the scale of the layers differs.

Is there maybe a function that converts scale units of a specific layer in pixels or something similar?

Any help is much appreciated.

Best regards,

Martin

The problem that
4   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 09/02/2005 : 07:38:48 AM
Martin,

Yes, but leave out LT_execute("using Rect = LabTalk.Rect."). It's not needed and means nothing in LT.

Mike Buess
Origin WebRing Member
MBIMO Posted - 09/02/2005 : 05:08:01 AM
Hi,

to make sure the target layer (gl in Mike's post) is really active, one can use this code:


gl.LT_execute("using Rect=LabTalk.Rect");
gl.LT_execute("Rect.Width=100");
.
.
.


Best regards,

Martin
MBIMO Posted - 09/01/2005 : 6:03:56 PM
Hi Mike,

thanks for the posted code. It works perfect.

Interestingly the code behaves differently depending on whether it is run from a script window or from OriginC using LT_execute. In the latter case resizing the rectangle changes the position of the upper left corner.
However, setting first "Width" and "Height" and then "Top" and "Left" solves the problem.

Thanks again,

Martin

Edited by - MBIMO on 09/01/2005 6:04:26 PM
Mike Buess Posted - 09/01/2005 : 3:37:50 PM
Hi Martin,
quote:
But this works only for Top/Left and not for Width/Height since the latter two are readonly.
I see that's correct but it's odd since the corresponding LabTalk properties are read/write. If the graph object is in the active layer you can do things like this (assuming a rectangle for illustration)...

using Rect = LabTalk.Rect;
Rect.Top = 10;
Rect.Left = 10;
Rect.Width = 1000;
Rect.Height = 500;

That should be equivalent to this...

GraphLayer gl = Project.ActiveLayer();
GraphObject grobj = gl.GraphObjects("Rect");
grobj.Top = 10;
grobj.Left = 10;
grobj.Width = 1000; // gives a ReadOnly error
grobj.Height = 500; // ditto

However, the LabTalk.Rect.Width= works but grobj.Width= doesn't.

Mike Buess
Origin WebRing Member

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