show a text field name
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
show a text field name
I was wondering if there was a way to show the field name or a field description inside the text box, maybe in a "grey" color when the field is blank to tell a user what field information should be put in the text box. I want to do this instead of having to have a a field label next to every text box. But once the user types into the filed, the data shows instead of the field name or description.
I know there is a "tool tip" feature but that only show up when they hover over the field. I want the "names" to show up when a user is looking at a blank entry form.
Any help or suggestions are always greatly appreciated...
Thanks, Dan
I know there is a "tool tip" feature but that only show up when they hover over the field. I want the "names" to show up when a user is looking at a blank entry form.
Any help or suggestions are always greatly appreciated...
Thanks, Dan
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: show a text field name
Hi.
Fields have a "name" property. So you could, if the length of the field is 0, place that name into the field.
A button has, sort of built-in, a "place" for its name. Fields do not. But this ought to do the trick for you. The text attributes are all up to you. Are you OK with this? You will want to have a keyDown handler, or some other method, to release the name in favor of actual data, when the user types something. And to reinstate it should the field become empty again.
Craig Newman
Fields have a "name" property. So you could, if the length of the field is 0, place that name into the field.
A button has, sort of built-in, a "place" for its name. Fields do not. But this ought to do the trick for you. The text attributes are all up to you. Are you OK with this? You will want to have a keyDown handler, or some other method, to release the name in favor of actual data, when the user types something. And to reinstate it should the field become empty again.
Craig Newman
Re: show a text field name
if it would work, I'm ok with that but I trying to figure out how to show all of the field names when the window opens? Would I have to have an "openCard" handler to examine the fields? maybe put the fields in a group and do it that way?
Or can I use the "behavior" property?
any examples of a script would be helpful...
Or can I use the "behavior" property?
any examples of a script would be helpful...
Re: show a text field name
Code: Select all
on opencard
put the number of fields into temp
repeat with i=1 to temp
set the text of field i to (the tooltip of field i)
end repeat
end opencard
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: show a text field name
Hi.
This could be a long list, of course.
Craig
Easy enough, but show them how? Like this?but I trying to figure out how to show all of the field names when the window opens
Code: Select all
on opencard
repeat with y = 1 to the number of fields
put the name of fld y & return after temp
end repeat
answer temp
end openCard
Craig
-
- VIP Livecode Opensource Backer
- Posts: 7266
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: show a text field name
I would use behaviors. Put this into a button script and set the behavior of each field to the long ID of the button:
For each field that needs this behavior, add a custom property called "cText" that contains the default text you want to display. The reason I'd use a custom property instead of the name is so we can distinguish which fields need to be set up when the card opens.
When the card opens, call this handler to initialize all the correct fields:
This may need adjusting depending on how you want the fields to act if a user returns to the card.
Code: Select all
on openfield
if me <> the cText of me then pass openfield
set the textcolor of me to empty
put empty into me
end openfield
on closefield
setupFld
end closefield
on exitfield
setupFld
end exitfield
on setupFld
if me <> empty then exit setupFld
set the textcolor of me to "125,125,125"
put the cText of me into me
end setupFld
When the card opens, call this handler to initialize all the correct fields:
Code: Select all
on setupAll
repeat with x = 1 to the number of flds
if the cText of fld x <> "" then
send "setupFld" to fld x
end if
end repeat
end setupAll
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: show a text field name
Thanks, I will give it a try...