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
 Origin Forum
 Set the position of the Text object
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

org_Ingo

Germany
Posts

Posted - 02/09/2010 :  11:07:26 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Sam Fang

292 Posts

Posted - 02/10/2010 :  04:11:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

org_Ingo

Germany
Posts

Posted - 02/10/2010 :  08:12:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

greg

USA
1378 Posts

Posted - 02/10/2010 :  6:13:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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;

Edited by - greg on 02/10/2010 6:17:18 PM
Go to Top of Page

org_Ingo

Germany
Posts

Posted - 03/25/2010 :  05:22:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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?
Go to Top of Page

flirt

USA
Posts

Posted - 03/25/2010 :  10:54:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Go to Top of Page

larry_lan

China
Posts

Posted - 03/25/2010 :  10:17:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Edited by - larry_lan on 03/25/2010 10:17:55 PM
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