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
 themeApply2g use theme in custom directory?

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
JokerOne Posted - 05/19/2016 : 07:58:33 AM
Origin Ver. 9 and Service Release 1(Select Help-->About Origin):
Operating System: Win 7

Hello everybody,

the xfunction themeApply2g seems to be exacly what I am looking for to solve a current issue, I am dealing with.
Now, if I create a custom template file "whatever.oth" and place it in my use file directory (%Y) I can apply that template to , say Graph1, by:

themeApply2g graph:=Graph1 theme:="whatever";

Now, despite the fact, that this works smoothly,

is there a way to place my custom themes anywhere else, (like, .../Script1/Custom_themes/) and then use anything like:
themeApply2g graph:=Graph1 theme:=".../Script1/Custom_themes/whatever"; ?

Thanks for your help


2   L A T E S T    R E P L I E S    (Newest First)
JokerOne Posted - 05/20/2016 : 10:17:29 AM
Thank you. The function works exactly as requested.
Pretty nice!
Chris D Posted - 05/20/2016 : 09:10:59 AM
Hi,

Unfortunately that X-Function doesn't allow specifying the theme as a file.

But we can create a LabTalk-callable Origin C function that essentially does the same thing as the X-function but can use a theme file. Here it is followed by explanation and usage example:

int joker_theme_file_apply_2_graph(string strThemeFile, string strGraphName = "")
{
	GraphPage gp;

	if (strGraphName.GetLength() > 0)
		gp = Project.Pages(strGraphName);
	else
		gp = Project.Pages();
	
	if (!gp.IsValid())
		return false;
	
	if (!strThemeFile.IsFile())
		return false;

	return gp.ApplyFormat(strThemeFile, TRUE, FALSE, TRUE);
}


You must specify a full path to the theme file including file extension (OTH).

It only operates on one graph at a time- either the one you specify or the active graph depending on whether you pass it a graph name as the 2nd parameter.

For example, to apply the theme file to a certain graph, you'd run the following in LabTalk:

string strFile$ = "%YJoker Scripts\JokerTheme.oth";
string strGraph$="Graph1";
joker_theme_file_apply_2_graph(strFile$, strGraph$);


To apply the theme file to the active graph, you'd run:

string strFile$ = "%YJoker Scripts\JokerTheme.oth";
joker_theme_file_apply_2_graph(strFile$);


I hope this helps.



Thanks,
Chris Drozdowski
Originlab Technical Support

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