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
 Forum for Origin C
 Insert Unicode and formatting into graph string

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
michaelbraun Posted - 07/13/2015 : 6:22:42 PM
Origin Ver. and Service Release (Select Help-->About Origin): 2015 sr2
Operating System:Windows

Hi, I have created a graph layer and added a text graph object to the layer. I would like this text to include formatting (ie subscript) and a couple unicode characters. I currently have the following:

                        GraphObject gresults = gl.CreateGraphObject(GROT_TEXT,"Results");
                        //setup results string to be displayed
			string slstr, xcstr, cstr;
			//convert doubles to strings and set decimal places to be displayed
			slstr = ftoa(t,"*3");
			xcstr = ftoa(xc,"*6");
			cstr = ftoa(c,"*5");
			string strresults = "t = " + slstr + " Å\n2q_c = " + xcstr + "°\nc = " + cstr + " Å";
			gresults.Text = strresults;


where in the string strresults, I would like the t to be a capital greek L (unicode 004C), the q to be a theta (unicode 03B8), and the _c to be a subscript c. For the unicode I tried entering the string as "\\x(004C)" but this just gives me a regular "L".
2   L A T E S T    R E P L I E S    (Newest First)
michaelbraun Posted - 07/14/2015 : 10:29:29 AM
Worked great! Here is the code I ended up using for the text box if anyone is searching for this in the future:

                        gl = Project.ActiveLayer();
			GraphObject gresults = gl.CreateGraphObject(GROT_TEXT,"Results");
			
			//setup results string to be displayed
			string slstr, xcstr, cstr;
			//convert doubles to strings and set decimal places to be displayed
			slstr = ftoa(t,"*3");
			xcstr = ftoa(xc,"*6");
			cstr = ftoa(c,"*5");
			string strresults = "\\g(\\(x004c)) = " + slstr + " Å\n2\(x03B8)\-(c) = " + xcstr + "°\nc = " + cstr + " Å";
			gresults.Text = strresults;
SeanMao Posted - 07/14/2015 : 03:11:08 AM
Hi,

The syntax to insert a unicode is shown in this example:


void test_unicode()
{
	GraphLayer gl = Project.ActiveLayer();
	GraphObject go = gl.GraphObjects("Text");
	go.Text = "\\g(\\(x004C))"; // Insert greek L
}


Regards!

Sean

OriginLab Tech Service

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