How to set a field to Caps or TitleCaps
Mark Schonewille
m.schonewille at economy-x-talk.com
Tue Mar 11 18:12:40 EDT 2008
Hi Hugh,
That should be something like this
on keyDown theKey
put toUpper(theKey) after me
end keyDown
for all caps and...
on keyDown theKey
if me is empty or char (word 2 of the selectedChunk) of me is space
then
put toUpper after me
else pass keyDown
end keyDown
to have the first char of each word in upper case. You'll have to add
a few lines to handle exceptions, such as backspace, punctuation etc.
You want to use matchtext with regex to check for punctuation.
Or do you mean that you really want titles to be in all caps? Perhaps
that could be something like
constant dot = "."
on returnInField
if not (the last line of me contains dot) then
put toUpper(the last line of me) into the last line of me
end if
end returnInField
Obivously, there might be problems with this. If it doesn't work for
you, you might want to be more specific about when this should happen.
Best regards,
Mark Schonewille
--
Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
A large collection of scripts for HyperCard, Revolution, SuperCard and
other programming languages can be found at http://runrev.info
On 11 mrt 2008, at 22:32, FlexibleLearning at aol.com wrote:
> Anyone figured out how to force a field to display text as Caps
> only, or as
> TitleCaps, whatever the state of the capsLock key, AND as the user
> is typing?
> It's this last bit that has me beat at the moment.
>
> This doesn't work but I wish it did as a starting point...
> on keyDown tk
> put toUpper(tk) into tk
> pass keyDown
> end keyDown
>
> /H
>
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list