Beginner Question

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
aqibishtiaq
Posts: 4
Joined: Fri Apr 19, 2013 11:59 am

Beginner Question

Post by aqibishtiaq » Fri Apr 19, 2013 12:06 pm

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.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Beginner Question

Post by sturgis » Fri Apr 19, 2013 12:42 pm

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.

Me_is_DBT
Posts: 4
Joined: Fri Apr 19, 2013 12:28 pm

Re: Beginner Question

Post by Me_is_DBT » Fri Apr 19, 2013 1:08 pm

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.
Show me the way
persevere, and you will succeed.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Beginner Question

Post by dunbarx » Fri Apr 19, 2013 1:18 pm

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

aqibishtiaq
Posts: 4
Joined: Fri Apr 19, 2013 11:59 am

Re: Beginner Question

Post by aqibishtiaq » Sat Apr 20, 2013 7:27 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Beginner Question

Post by dunbarx » Sat Apr 20, 2013 7:35 pm

Hi.

Where are you having difficulties?

I assume you can load the grayed-out text. Then what are you doing?

Craig Newman

aqibishtiaq
Posts: 4
Joined: Fri Apr 19, 2013 11:59 am

Re: Beginner Question

Post by aqibishtiaq » Fri Apr 26, 2013 9:55 am

dunbarx wrote:Hi.

Where are you having difficulties?

I assume you can load the grayed-out text. Then what are you doing?

Craig Newman
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.

Thanks

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9567
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Beginner Question

Post by dunbarx » Fri Apr 26, 2013 2:25 pm

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

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”