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
 Long Name/Units Style - Rich Text
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

j@y

Germany
29 Posts

Posted - 07/13/2015 :  01:42:36 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi all,
Please, is there any way how to enable/disable the 'Rich Text' option for Long Name/Units Style in a specific Worksheet by using either OriginC or LabTalk?
Thanks for your help in advance.

Edited by - j@y on 07/13/2015 02:10:27 AM

jasonzhao

China
262 Posts

Posted - 07/13/2015 :  04:42:24 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

This can be controled by Origin C, please refer to the code below:


#include <..\OriginLab\theme_utils.h>
void test_rich_text()
{
	Worksheet wks = Project.ActiveLayer();
	if ( wks )
	{
		Tree trFmt;
		trFmt = wks.GetFormat(FPB_ALL, FOB_ALL & ~(FOB_LINK_STYLE|FOB_RANGE_STYLE), TRUE, TRUE);
		TreeNode trTextFmt = theme_tree_get_node_by_name_strval(trFmt, STR_NAMESTYLE_LONG_NAME);
		if ( trTextFmt )
		{
			trTextFmt.Style.Control.strVal = "Origin Text Edit";  //this set the column into rich text
			trTextFmt.Style.Control.strVal = "Edit Control";  //this set the column into non rich text
			if ( 0 == wks.UpdateThemeIDs(trFmt.Root) )
			{
				wks.ApplyFormat(STYLE_REPAINT | STYLE_RELATIVE | STYLE_UNDO | STYLE_COMPLETE, trFmt);
				//after set as Rich Text, set long name to column				
			}
		}
	}
}


You can set all columns in worksheet into "rich text" by delete this row:

trTextFmt.Style.Control.strVal = "Edit Control";



Best regards!
Jason
OriginLab Technical Service


Edited by - jasonzhao on 07/13/2015 04:45:35 AM
Go to Top of Page

j@y

Germany
29 Posts

Posted - 07/13/2015 :  05:48:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much, Jason!
Go to Top of Page

j@y

Germany
29 Posts

Posted - 07/20/2015 :  4:48:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
PS: The method mentioned earlier is valid for Origin 9.2 (2014/2015) but not for Origin 9.0 and older since theme_utils.* and related files differ! Older versions crash down during compilation or, if compiled, during execution of such a code even if newer version of theme_utils.h or relevant parts are included.
Any idea how to do the same for Origin 9.0 or by using OriginC or LabTalk?
Many thanks!
Go to Top of Page

Castiel

343 Posts

Posted - 07/20/2015 :  9:19:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by j@y

PS: The method mentioned earlier is valid for Origin 9.2 (2014/2015) but not for Origin 9.0 and older since theme_utils.* and related files differ! Older versions crash down during compilation or, if compiled, during execution of such a code even if newer version of theme_utils.h or relevant parts are included.
Any idea how to do the same for Origin 9.0 or by using OriginC or LabTalk?
Many thanks!


why not using
bool wks_set_label_text_control(Worksheet& wks, int nLabel, int nStyle)


妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 02/14/2017 :  2:32:13 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The OC function

wks_set_label_text_control

is documented here:

http://www.originlab.com/doc/OriginC/ref/wks_set_label_text_control

You can easily write up your version and make it callable from LabTalk by placing it in the AutoLoad folder in code builder.

CP
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