Beginner Question
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 4
- Joined: Fri Apr 19, 2013 11:59 am
Beginner Question
I'm a newbie to LiveCode and loving how easy and simple is it to use. I was wondering if there is a way to pre-populate a text entry field with a hint to what the user needs to write?
For example I am going through the lesson where you create the ticked off application and in the text field, is there a way to enter text that is maybe greyed out a little which says "Enter task details here" or something along them lines.
Basically a hint to what the user needs to write in the field? It may be obivous, but I can for the life of me find out.
Thanks in advance for any help.
For example I am going through the lesson where you create the ticked off application and in the text field, is there a way to enter text that is maybe greyed out a little which says "Enter task details here" or something along them lines.
Basically a hint to what the user needs to write in the field? It may be obivous, but I can for the life of me find out.
Thanks in advance for any help.
Re: Beginner Question
One way you might do it is to have 2 overlapping fields. 1 can be a label field, the other a regular text entry field. PUt the regular over the top of the label, set the text color of the label to whatever greyed out color, and voila. Make sure the top field is not opaque of course so that the underlying field shows through. Then, you can do a check. if there is text in the top field, set the visible of the underlying field to false. If its empty, set it to true.
Re: Beginner Question
I'm a newbie and so I could be completely wrong here, and if I am, somebody correct me, but how about the following for a possible solution:
set the text field to have the hint already in its' contents, with the greyed out colour pre-set in the property inspector.
then, when the user clicks in the text field (i.e.) on mouseDown, you would reset the Foreground colour of the field to black (or whatever colour it needs to be) and at the same time, clear the field (i.e.) put empty into field "the textbox"...
Hope it is correct, and I hope it helps.
Regards,
Damien.
set the text field to have the hint already in its' contents, with the greyed out colour pre-set in the property inspector.
then, when the user clicks in the text field (i.e.) on mouseDown, you would reset the Foreground colour of the field to black (or whatever colour it needs to be) and at the same time, clear the field (i.e.) put empty into field "the textbox"...
Hope it is correct, and I hope it helps.
Regards,
Damien.
Show me the way
persevere, and you will succeed.
persevere, and you will succeed.
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Beginner Question
Hi.
I think the single field method is cleaner.
If you are thinking about things like this, you may not be a newbie much longer.
Ask anything, often. Welcome,
Craig Newman
I think the single field method is cleaner.
If you are thinking about things like this, you may not be a newbie much longer.
Ask anything, often. Welcome,
Craig Newman
-
- Posts: 4
- Joined: Fri Apr 19, 2013 11:59 am
Re: Beginner Question
I can't seem to get the method to work but i'm persisting. Think the problem is more likely going to be my coding/syntax.
Thanks a lot for the help guys! I wanted to know if there was a guide to the use of syntax/code in LiveCode. It is easy to code but a help guide/list of syntax that can be used?
Thanks again for the help
Aqib
Thanks a lot for the help guys! I wanted to know if there was a guide to the use of syntax/code in LiveCode. It is easy to code but a help guide/list of syntax that can be used?
Thanks again for the help
Aqib
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Beginner Question
Hi.
Where are you having difficulties?
I assume you can load the grayed-out text. Then what are you doing?
Craig Newman
Where are you having difficulties?
I assume you can load the grayed-out text. Then what are you doing?
Craig Newman
-
- Posts: 4
- Joined: Fri Apr 19, 2013 11:59 am
Re: Beginner Question
I want there to be grey text in a box saying for example "First Name". When the user clicks in the box it goes blank and if the box stays blank upon the cursor leaving it returns to "First Name". If the user puts text in the box then obviously the text entered stays.dunbarx wrote:Hi.
Where are you having difficulties?
I assume you can load the grayed-out text. Then what are you doing?
Craig Newman
Thanks
-
- VIP Livecode Opensource Backer
- Posts: 9578
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Beginner Question
Here is how a beginner ought to think about LiveCode.
1- "I want to do something when the cursor leaves the field, which is to reload the greyed-out text."
2- "How do I do that?"
3- "Hmmm, the cursor has left the rect of a field. Is there a message that was sent when that happened?
I am not trying to be flip. There are so many events that occur when even the slightest thing happens, that you can pretty much be sure that there is a perfect solution just waiting. Read the dictionary about the "mouseLeave" message. Think about how many messages are sent when a cursor simply moves around a card populated with objects. There are likely about a dozen, and that is without clicking at all.
And think about how this will help you find things in the future. The hard part is knowing what solution to look for, not that a solution is not there. This will come with experience.
By the way, you will have just a little work to do so that if the user DOES enter text, the greyed-out text does not overwrite it. Do you see? Write back if you get stuck, but do experiment.
Craig Newman
1- "I want to do something when the cursor leaves the field, which is to reload the greyed-out text."
2- "How do I do that?"
3- "Hmmm, the cursor has left the rect of a field. Is there a message that was sent when that happened?
I am not trying to be flip. There are so many events that occur when even the slightest thing happens, that you can pretty much be sure that there is a perfect solution just waiting. Read the dictionary about the "mouseLeave" message. Think about how many messages are sent when a cursor simply moves around a card populated with objects. There are likely about a dozen, and that is without clicking at all.
And think about how this will help you find things in the future. The hard part is knowing what solution to look for, not that a solution is not there. This will come with experience.
By the way, you will have just a little work to do so that if the user DOES enter text, the greyed-out text does not overwrite it. Do you see? Write back if you get stuck, but do experiment.
Craig Newman