Half (1/2) character

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Half (1/2) character

Post by andyh1234 » Fri Mar 14, 2008 7:42 pm

What is the easiest way to get a 1/2 character to display in a field.

Ive tried numToChar(189), but that gives a different symbol on the mac, i need the code to put a 1/2 character instead of 0.5, 1.5 etc but it has to work on both mac and windows.

Any ideas?

Andy

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Mar 14, 2008 11:28 pm

Hi Andy,

Looking at the ASCII table for Mac, I don't see a 1/2 sign. It seem you

a) need a special font, which has the sign
b) or need to use unicode and find a glyph showing the symbol you want
c) or need to use 1/2 and set the textshift of these characters to -8 or something
d) or need to use a picture (simple but ugly)
e) or you simply write 1/2

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Post by andyh1234 » Thu Mar 20, 2008 3:57 pm

Thanks Mark,

I think Ill stick with 1/2 but out of interest you say a picture would be simple but ugly, is it possible to position a picture inline with text fairly easily as I would love to be able to add odd pictures in text (like a graphic 'x' so a user could click the x to delete a line) but not figured out how to do it.

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Post by malte » Thu Mar 20, 2008 9:49 pm

you can set the imagesource of a character

set the imagesource of char 1 of line 3 of fld "myField" to the ID of img "close.png"

Hth,

Malte

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu Mar 20, 2008 10:02 pm

Hi Andy and Malte,

Malte is right, but you probably still have to fiddle with the textShift to get the picture positioned correctly.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Post by andyh1234 » Sat Mar 22, 2008 12:40 pm

Brilliant - thanks!!!

I have so many other uses for putting an icon inline with the text, just assumed it couldnt be done.

Thanks again!!!

Post Reply