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 for Programming
 LabTalk Forum
 themeApply2g use theme in custom directory?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JokerOne

Germany
58 Posts

Posted - 05/19/2016 :  07:58:33 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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


Chris D

428 Posts

Posted - 05/20/2016 :  09:10:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

JokerOne

Germany
58 Posts

Posted - 05/20/2016 :  10:17:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you. The function works exactly as requested.
Pretty nice!
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