Placeholder text, behaviours, openField

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
stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Placeholder text, behaviours, openField

Post by stam » Wed Mar 17, 2021 10:53 pm

Hi all,

I've adapted Trevor's excellent code to an interface group that contains a field that should have placeholder text.

The code is shown as a lesson: https://lessons.livecode.com/m/4071/l/6 ... -behaviors

This works well... except when opening the stack and the field is empty (ie it just displays the placeholder text).

The placeholder text is displayed as intended, but clicking or tabbing into the field doesn't make the placeholder text go away and inserts itself into whatever you type.

To make it work properly, i have to enter value, delete it, focus on nothing/something else and then enter text again - after that it continues to work as intended until stack is closed, but recurs on re-opening (if the uText is empty).

There's something about openField that doesn't fire on opening the stack?
Any suggestions?

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Placeholder text, behaviours, openField

Post by stam » Thu Mar 18, 2021 10:12 am

Nevermind...

I abandoned Trevor's code in the above lesson as i can't seem to work around the issue that the field needs to be manually modified, exited and re-modified to trigger the behaviour... something about it just didn't work well and modifying the text field in script didn't work either.

Instead, i used Jacque's very helpful code from a related discussion here: viewtopic.php?f=7&t=35408&start=15#p202045 (thank you for sharing Jacque!!)

All works well now.
This was to update a combobox replacement i've previously posted on sample stacks/liveCodeShare, i'll update soon...

S.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”