Page 1 of 1

Half (1/2) character

Posted: Fri Mar 14, 2008 7:42 pm
by andyh1234
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

Posted: Fri Mar 14, 2008 11:28 pm
by Mark
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

Posted: Thu Mar 20, 2008 3:57 pm
by andyh1234
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.

Posted: Thu Mar 20, 2008 9:49 pm
by malte
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

Posted: Thu Mar 20, 2008 10:02 pm
by Mark
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

Posted: Sat Mar 22, 2008 12:40 pm
by andyh1234
Brilliant - thanks!!!

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

Thanks again!!!