Taifun Pattern Lock Mechanism help!

124 views
Skip to first unread message

flaviu...@gmail.com

unread,
Oct 9, 2017, 3:59:21 AM10/9/17
to MIT App Inventor Forum
Hi,
it is possible to use Taifun Pattern Lock Mechanism to store global strCode to database, for user to use their custom pattern?

Thank you!

Taifun

unread,
Oct 9, 2017, 10:04:15 AM10/9/17
to MIT App Inventor Forum
yes of course, just store it in TinyDB
TinyDB tutorial by Stephen

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  
How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the
 Top 5 Tips: How to learn  App Inventor

You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.

Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by  Taifun.         





flaviu...@gmail.com

unread,
Oct 10, 2017, 12:55:53 PM10/10/17
to MIT App Inventor Forum
Well, to store in a database it's not a problem, Taifun...

The problem is that I cannot read the pattern to put it on a tag, and dont know where to look? in Javascript or just mit app?

Thank you!

Abraham Getzler

unread,
Oct 10, 2017, 5:27:18 PM10/10/17
to MIT App Inventor Forum
 is that I cannot read the pattern to put it on a tag

Are you asking how to use a barcode scanner?
 

ABG

Taifun

unread,
Oct 10, 2017, 8:54:32 PM10/10/17
to MIT App Inventor Forum
The problem is that I cannot read the pattern to put it on a tag, and dont know where to look? in Javascript or just mit app?

in the example https://puravidaapps.com/patternlock.php the code is stored in global variable strCode, so what exactly prevents you to store the code in TinyDB instead?

flaviu...@gmail.com

unread,
Oct 11, 2017, 5:01:59 AM10/11/17
to MIT App Inventor Forum
Sorry for my English!
Yes, I can put the strCode in a database but How can I receive strCode code from pattern input? 

I mean, the user must INPUT pattern to save to strCode, and not to enter a number in a text box like 12369 and after to use the pattern to unlock.

I need help with your first part of the project when user make the strCode from pattern. 

Please help Taifun, it's easy for you to en-light me.

flaviu...@gmail.com

unread,
Oct 11, 2017, 5:02:53 AM10/11/17
to MIT App Inventor Forum
Abraham, it about patern unlock. Thank you!

flaviu...@gmail.com

unread,
Oct 11, 2017, 5:10:13 AM10/11/17
to MIT App Inventor Forum
in other words:

A one time initialization screen have a pattern that when use it will display a number like 12369, in a label (this is what I need).

Thank you again. Please at least tell me where to look if you don't have time. Java or MIT or both? Can't find it!

Taifun

unread,
Oct 11, 2017, 10:38:18 AM10/11/17
to MIT App Inventor Forum
in this case you have to modify the html/JavaScript code and pass the new pattern back to App Inventor
you can use the WebViewString or the page title for this
see also some html/JavaScript examples here https://puravidaapps.com/tutorials.php#html

Taifun

Abraham Getzler

unread,
Oct 11, 2017, 1:10:50 PM10/11/17
to mitappinv...@googlegroups.com
I think I understand the problem.

The Javascript has no (documented) way to return the actual pattern
that was input by the user, only a matched/failed test.

That forces the app to hard code a pattern,
instead of asking the user to trace one.

Here's a way to INPUT a pattern from the user ...

Show a full screen canvas and RESET & OK buttons.
On the canvas, evenly space 9 Balls.
Load a global list Balls with their components, for special effects like flashing them by index.
Keep an initially empty global list Pattern, with the indices of the Balls that were touched.
Set up TouchDown (Dragged?) events for Ball1-9, calling a common procedure AddBall with that Ball's number(1-9):
AddBall(n):  
  if is empty list(Pattern) then
     add n to list Pattern
 else if not(last item in list Pattern = n) then
     add n to list Pattern
end AddBall

When OK button clicked,
  output list Pattern.

When RESET button clicked,
  set list Pattern to empty list.

To make it fancy, you could have a Clock 
temporarily inflate and deflate the balls in list Pattern
to remind the user of his pattern, or draw lines from ball to ball
between canvas erasures.

ABG


flaviu...@gmail.com

unread,
Oct 12, 2017, 6:59:37 AM10/12/17
to MIT App Inventor Forum
Thank you very much guys, I'll try to see what can I do and I will post here if I succeded!

Robert0221221

unread,
Oct 12, 2017, 8:44:40 AM10/12/17
to MIT App Inventor Forum
@Flavius why should anybody read for you? Why you don't read? 

Did you see this?

setPattern(pattern) 
This method sets provided pattern dynamically to patternlock if enableSetPattern option is true.
1
2
var lock = patternLock('#patternHolder',{enableSetPattern : true});
lock.setPattern('12587');
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Abraham Getzler

unread,
Oct 12, 2017, 5:32:10 PM10/12/17
to MIT App Inventor Forum
See attached for how to do it in blocks.

Thanks for a fun project!

ABG

Capture.PNG
Designer.PNG
pattern_input.aia
blocks.png

flaviu...@gmail.com

unread,
Oct 13, 2017, 3:24:03 AM10/13/17
to MIT App Inventor Forum
hihi!!!

Thank you very much ABG!!!
Yo're very good.
Reply all
Reply to author
Forward
0 new messages