How to get a checkmark (tick) in a text field?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

How to get a checkmark (tick) in a text field?

Post by paulsr »

Plz could someone explain to me how I can get a checkmark into a line of text.

I've fiddled around with useUnicode and numToChar but can't get the right result.

Code: Select all

set the useUnicode to true
put numToChar(2713) into tUni
set the useUnicode to false
put tUni & " SELECTED" into tUni
What this results in is ...

TM
SELECTED

Where "TM" is the trademark symbol, not a checkmark, and there is a "return" inserted in the field for some reason. As far as I can determine, 2713 shd be a checkmark.

What I want is "_/ SELECTED" where "_/" is the checkmark.

Thanks in advance...

--paul
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: How to get a checkmark (tick) in a text field?

Post by dunbarx »

I don't even think this is correct, but try:

answer numToChar(18)

Craig Newman
paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: How to get a checkmark (tick) in a text field?

Post by paulsr »

dunbarx wrote:I don't even think this is correct, but try:

answer numToChar(18)

Craig Newman
You're right Craig, it's not. :)

I've tried all the numToChar settings and can't find the checkmark. I'm also concerned that it won't produce the same character on all platforms, whereas Unicode is... well, Unicode.

Thanks anyways...

--paul
dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Contact:

Re: How to get a checkmark (tick) in a text field?

Post by dave_probertGA6e24 »

Hi,

Just heading to bed so I haven't tested any of this...

Code: Select all

set the unicodetext of field "wobble" to unidecode("ઙ")
That 'might' put the checkmark in the field. You probably won't be able to see it in a normal 'text' field unless you set the unicodetext part.

There really needs to be a lot more detail provided by RunRev about the various options of the Unicode functions. Because the basics at the BYU (http://revolution.byu.edu/indexgeneric.php) are Ok, but not really in-depth enough. There are a few really good tips buried on this forum, but finding them is quite difficult.

I hope that helps a bit,

Cheers,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.
doc
Posts: 148
Joined: Fri Jun 09, 2006 4:30 pm

Re: How to get a checkmark (tick) in a text field?

Post by doc »

I'm using what is now a very dated version 4.53 of LC, which doesn't have all of the newfangled text capabilities, but this might work for ya:

Add a field that can be hidden and paste a unicode checkmark directly into the field, used solely as a container... then copy the contents of the hidden field back wherever you wish for it to be displayed. It may or may not suit your actual needs, so you mileage may vary, but I've attached a simple demo stack to show how it's done.

Works here using LC 4.53 on Windows 8, but untested otherwise.

-Doc-

Edit: Attached the wrong sample file earlier... it now has been replaced.
Attachments
Checkmarks.zip
(1.52 KiB) Downloaded 470 times
paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: How to get a checkmark (tick) in a text field?

Post by paulsr »

doc wrote: It may or may not suit your actual needs, so you mileage may vary, but I've attached a simple demo stack to show how it's done.
Thanks Doc, but "The selected attachment does not exist anymore."

--paul
doc
Posts: 148
Joined: Fri Jun 09, 2006 4:30 pm

Re: How to get a checkmark (tick) in a text field?

Post by doc »

Paul,
I just tried it and it downloaded just fine... might try it again, sir.

-Doc-
paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: How to get a checkmark (tick) in a text field?

Post by paulsr »

Thanks Doc ... I tried several times and recvd the same error, but yes, now it's working.

--paul
paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: How to get a checkmark (tick) in a text field?

Post by paulsr »

First, I was wrong to put:

Code: Select all

set the useUnicode to true
put numToChar(2713) into tUni
..because the supplied value shd be decimal, whereas 2713 is the hex code for a checkmark. I should have used 10003.

However, that doesn't work either! From fiddling around some more, I have to conclude this is something to do with character sets, and that the checkmark is only in the Dingbats set.

So, I tried:

Code: Select all

set the useUnicode to true
put numToChar(8713) into tUni
...which correctly produces a square root symbol ... which for my purposes is close enough to the checkmark.

Thanks for all the thoughts...

--paul
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: How to get a checkmark (tick) in a text field?

Post by jacque »

I've usually used the square-root symbol too, but an imagesource character is another good alternative if you don't need to scale the text much.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: How to get a checkmark (tick) in a text field?

Post by dunbarx »

I get a checkmark with numToChar(18).

Anyone else also?

Craig Newman
doc
Posts: 148
Joined: Fri Jun 09, 2006 4:30 pm

Re: How to get a checkmark (tick) in a text field?

Post by doc »

dunbarx wrote:I get a checkmark with numToChar(18).

Anyone else also?
Sorry Craig... that doesn't work using 4.53 on Windows at least.

-Doc-
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: How to get a checkmark (tick) in a text field?

Post by dunbarx »

Hmmm.

Well, I do. Discovered by accident, actually.

LC 5.5.3, system font, that is, a new field dragged onto a card.

If I set a custom property of a new field to whatever it is when created (the system font?):

set the testStyle of fld "testField" to the textfont of fld "testField" --new field

and then put numToChar(18) into it, I get a tick.

If I change the textFont to something like geneva, I get something entirely different. But I can always set the textFont back to the testStyle, and the tick returns.

Craig Newman
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: How to get a checkmark (tick) in a text field?

Post by jacque »

If I set a custom property of a new field to whatever it is when created (the system font?):

set the testStyle of fld "testField" to the textfont of fld "testField" --new field

and then put numToChar(18) into it, I get a tick.
If there is no font set anywhere in the object hierarchy, a field will inherit from the Home stack. If that isn't set, it then uses the system font. The IDE sets the Home stack to use different fonts based on the OS. On Mac it is Lucida Grande 11, but the OP is on Windows which will use a different font. NumToChar(18) is probably some other character on Windows.

If I were doing this I'd use an image source so that the checkmark would be consistent on any OS. Alternately, find out what the square root character is on each supported OS and branch the code to use the appropriate numToChar.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
Post Reply