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
 Origin Forum
 Set the position of the Text object

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
org_Ingo Posted - 02/09/2010 : 11:07:26 PM
Origin Ver.: 8.0 SR4
Operating System: Win Vista

Hi all,

is it possible to set the position of a text object that is on a graph page? I mean to put in the coordinates of the object on a page.

Thanks in advance,
Ingo
6   L A T E S T    R E P L I E S    (Newest First)
larry_lan Posted - 03/25/2010 : 10:17:40 PM
Hi Ingo:

If you added those text manually, maybe now the problem is what's the object names? You can use list -o to list all object in the layer. Since there are 5 layers in your graph, you can also use page.active property to active each layer. For example

for( ii = 1; ii <=5; ii++ )
{
page.active = ii;
ty "Objects in layer $(ii) are:";
list -o;
}


Then you can use .x and .y properties to modify the object position.

Thanks
Larry
flirt Posted - 03/25/2010 : 10:54:54 AM
Will the next version add more control for all the objects in the property GUI? I found it tiring to do as you suggested.

quote:
Originally posted by Sam Fang

First you should declare a GObject variable for the text object by its name, which is shown in in the associated Programming Control dialog box. If your text object name is Text, The following LabTalk script can move the text in a specified location.
------------------------------------------------------
GObject text1=Text;
text1.x=15;
text1.y=20;
------------------------------------------------------
For more information, you can refer to the page.
http://wiki.originlab.com/~originla/wiki/index.php?title=LabTalk:Graphic_Objects

Sam
OriginLab Technical Services

org_Ingo Posted - 03/25/2010 : 05:22:37 AM
Sorry, but both suggestions didn't work for me.

Maybe I need to explain my problem in detail:
I have a graph and it has 5 arranged layers. They are arranged using:

ArrangeLayers 5 1;


Now I want to label each layer using A, B, C, D, and E. So I use the "Text Tool" and add each letter by hand. Now I want to arrange all letters like the layers. But I cannot find how to set the coordinates of the letters which are set as text. Is there a way to do that?
greg Posted - 02/10/2010 : 6:13:40 PM
The GOBJECT datatype was added sometime during Origin 8 development. It's in 8SR6, but I'm not sure which release introduced it.

It isn't really needed here because any graphic object has .x and .y properties and they can be used to position the object relative the XY scale of the containing layer. Note that the coordinates represent the center of the graphic object.

For more precise positioning (and for positioning on the page regardless of the layer - this was the original question) you need to refer to the page.

The Page dimensions are initialized from the current default printer and establish both a resolution (in dots per inch) and a size (in dots). Knowing these two values you can get the width and height of the page in inches:
WidthInInches = PAGE.WIDTH / PAGE.RESX
HeightInInches = PAGE.HEIGHT . PAGE.RESY

Rather than use layer-scale-relative X and Y to position an object, you can use this page frame of reference, but it's up to you to figure out where these dots are and - here's the wrinkle - you position the top-left of the object, not the center. And top, left, height and width are in 'dot' units.

Here is an example that creates a label and positions it on the top edge of the layer and flush right to the layer edge:

layer.unit = 5;
label -a X2 Y2 -n MyLabel Position me at the upper right;
MyLabel.Top = Layer.Top - MyLabel.Height;
MyLabel.Left = Layer.Left + Layer.Width - MyLabel.Width;
org_Ingo Posted - 02/10/2010 : 08:12:36 AM
Thanks Sam,

I have added a text object and it's name was "Text" like in your example. So I could directly paste your suggested code in the Script Window and it didn't work. Is this variable new and maybe only available in 8.1?

Ingo
Sam Fang Posted - 02/10/2010 : 04:11:25 AM
First you should declare a GObject variable for the text object by its name, which is shown in in the associated Programming Control dialog box. If your text object name is Text, The following LabTalk script can move the text in a specified location.
------------------------------------------------------
GObject text1=Text;
text1.x=15;
text1.y=20;
------------------------------------------------------
For more information, you can refer to the page.
http://wiki.originlab.com/~originla/wiki/index.php?title=LabTalk:Graphic_Objects

Sam
OriginLab Technical Services

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