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
 LabTalk Forum
 Margins for Labels Added to a Graph

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
cdrozdowski111 Posted - 04/08/2014 : 09:40:15 AM
OriginPro 9.1 SR2 64-bit/32-bit, Win7 Pro 64-bit, running in VMware Fusion 5.0.4

When I use LabTalk to add a text label to a graph and set the background to black line (see code below), how can I control the size of the margin between the text and black border? It is much too big for my purposes.

If I can't do it in LabTalk, can it be done in Origin C? I don't have time to dig into the source right now.

GObject goMyText = "MY_TEXT";
label -n goMyText temp;

goMyText.text$ = sMyText$; // sMyText$ defined elsewhere
goMyText.attach = 1; // Page
goMyText.left = 0; // Need to change
goMyText.top = 0;// Need to change
goMyText.background = 1; // Black line
goMyText.fSize = 8; // Font size
goMyText.draw(); // Refresh object

2   L A T E S T    R E P L I E S    (Newest First)
cdrozdowski111 Posted - 04/08/2014 : 11:44:57 AM
Rock on! Thanks.

I'll correct the quotes around GObject goMyText = "MY_TEXT"; I'm used to programming in languages that require quotes around all string literal assignments.
Castiel Posted - 04/08/2014 : 11:16:03 AM
int setLabelMargin(string s, double left = 3., double top = 3., double right = 3., double bottom = 3.)
{
	GraphLayer gl = Project.ActiveLayer();
	if( !gl )
		return -1;
	
	GraphObject go = gl.GraphObjects(s);
	if( !go )
		return -2;
	
	Tree t;
	t = go.GetFormat(FPB_DIMENSION, FOB_ALL, TRUE, TRUE);
	t.Root.Background.Dimension.Left.dVal = left;
	t.Root.Background.Dimension.right.dVal = right;
	t.Root.Background.Dimension.top.dVal = top;
	t.Root.Background.Dimension.bottom.dVal = bottom;
	
	go.UpdateThemeIDs(t.Root);
	go.ApplyFormat(t, TRUE, TRUE);
	
	gl.GetPage().Refresh();
	
	return 0;
}


As for the label you created, goMyText, is named "\"MY_TEXT\"", that is:
int nRet;
nRet = setLabelMargin(""MY_TEXT"", 5.0, 5.0, 5.0, 5.0);


©c¡Ï   ¤È¥¹  ©f¨u©c  ©c¥ì    ¥Î¤³  ©c/     ©¦£¯
 ©c¨Ê¥Î ¤´¥¨  ¥ó ¨×   ¥ó¤á' ¥Ì©¦¥­   /¤í  ¥Õ©¦©f
   ¨Ö             ¦á          ©¦£þ  ©` ¥Õ   ©¦
                              ©¦

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