Loading Data into a field formatting

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
istech
Posts: 211
Joined: Thu Sep 19, 2013 10:08 am

Loading Data into a field formatting

Post by istech » Tue Jun 03, 2014 10:25 am

Hi all,

I have a small issue I hope someone can solve. I have a local database which loads the hash passwords into a password field.

I would like for the field not to show the hash rather just bullet point it out.

As the data is not being typed but loaded keydown is not used. So what solution is there for this. Is there a handler that I can use to detect the

field is not empty and convert the text?

I have tried the password font direction and the hash still come through when loaded. Could someone point me in the right direction thanks all.

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Loading Data into a field formatting

Post by bangkok » Tue Jun 03, 2014 10:59 am

I'm not sure to understand what you want to do.

But you could do it just after you load the password from your database. Count the number of chars, and put the same number of "*" into a field...

Code: Select all

put empty into field "hiddenpassword"
repeat with i = 1 to the number of chars of tPassword
put "*" after field "hiddenpassword"
end repeat

istech
Posts: 211
Joined: Thu Sep 19, 2013 10:08 am

Re: Loading Data into a field formatting

Post by istech » Tue Jun 03, 2014 11:13 am

Thanks bangkok,

That works perfectly from the "put" point of view thanks.

But is it possible to add a field script to do the same thing.

example:

field script:
on loaddata
repeat with i = 1 to the number of chars of me
---etc
end loaddata

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Loading Data into a field formatting

Post by Simon » Tue Jun 03, 2014 11:20 am

Hi istech,
How about setting the font of the field to... dingbats?

Simon
Edit: Or here make your own
http://forums.runrev.com/phpBB2/viewtop ... 25&p=96468
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

istech
Posts: 211
Joined: Thu Sep 19, 2013 10:08 am

Re: Loading Data into a field formatting

Post by istech » Tue Jun 03, 2014 12:10 pm

Funny you should say that Simon.

As I tried it earlier and it was not working. But as soon as I posted I got it to work. (added space :( )

I would prefer not to have to install or load or rely on a external font. If possible but it does the job. :D

Klaus
Posts: 14205
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Loading Data into a field formatting

Post by Klaus » Tue Jun 03, 2014 12:39 pm

Hi istech,

could you please explain, HOW your user will "load" the data?
I am sure you wrote that script, right? 8)

We surely can "hook" somewehre into the "load" routine!


Best

Klaus

istech
Posts: 211
Joined: Thu Sep 19, 2013 10:08 am

Re: Loading Data into a field formatting

Post by istech » Tue Jun 03, 2014 4:17 pm

Hi Klaus,

Good day to you.

The data comes from a array. User selects a key and the data is populated into the fields.

I could do as bangkok or Simon says. But was just wondering if there was a "special handler/function" to detect data in the field and convert it. In any case the job gets done.

But always want to push the bounderires and learn something at the same time. I dont know to much about scripting fields so more about interest and learning than anything else. :wink:

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10335
Joined: Wed May 06, 2009 2:28 pm

Re: Loading Data into a field formatting

Post by dunbarx » Tue Jun 03, 2014 4:52 pm

Hi.

Have you checked out the "imageSource" property? By choosing a bullet as your image, you can "hide" all your text without actually changing that text.

Craig Newman

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Loading Data into a field formatting

Post by bangkok » Tue Jun 03, 2014 5:16 pm

istech wrote: The data comes from a array. User selects a key and the data is populated into the fields.

I could do as bangkok or Simon says. But was just wondering if there was a "special handler/function" to detect data in the field and convert it. In any case the job gets done.
I still don't understand your logic.

Since you launch a script that will load the data and populate the field... Why can't you directly act on this field, within the same script ?

Why do you want to "move" the task onto the field itself ? Since there will be no user interaction on this field ? ( the password will be displayed with bullets) ?

If your field would accept typing from the user, then of course, it would make sense to use a script within the field.

Klaus
Posts: 14205
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Loading Data into a field formatting

Post by Klaus » Tue Jun 03, 2014 5:34 pm

Hi istech,
istech wrote:The data comes from a array. User selects a key and the data is populated into the fields.
OK, and HOW is this populated? By magic, witchcraft or a script you wrote? 8)

As bangkok said!

Hint: There is NO build-in function/message/handler that gets triggered when you put text into a field by script!


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10335
Joined: Wed May 06, 2009 2:28 pm

Re: Loading Data into a field formatting

Post by dunbarx » Wed Jun 04, 2014 3:50 am

You could easily write a handler that in fact does "send a message" when a field is changed by script, but this would be purely a matter of making LC bend to ones will.

As the others have said, changing the approach is more effective.

Craig Newman

istech
Posts: 211
Joined: Thu Sep 19, 2013 10:08 am

Re: Loading Data into a field formatting

Post by istech » Thu Jun 05, 2014 1:49 pm

Thanks Craig, I have gone with the password font for now.

Thanks for everyones help. Any reading on field scripting or examples or links would be appeciated.

Have a nice day everyone.

Post Reply