Skip to first unread message

Alex17

unread,
Jun 7, 2017, 7:56:25 PM6/7/17
to MIT App Inventor Forum
I want to have a block of text where users can select a word in a paragraph. I think I've run out of work arounds to get this done but please let me know if you can see something I've overlooked.

1 Webviewer - I can get the text in the webviewer  but the text select is really glitchy, if you try and select multiple words the first point you selected drops down to the line below and I've never been able to select what I actually want. There is also no way to parse the words back to the app without copy and paste (Made easier with Taufun's extention). 

2 Canvas - I can print the paragraph on a canvas and correctly select words that way, but the canvas text is too pixelated to be readable for any period of time. There's no way around this unless a label can be placed over the canvas or the text modified on the backend.

3 Buttons - I can print each word to a button but that is hard to format correctly and a user can't select multiple words with a click and drag.

Abraham Getzler

unread,
Jun 8, 2017, 11:47:32 AM6/8/17
to MIT App Inventor Forum
See attached for how to do it using a label and some navigation buttons.
Gallery link:

ABG

display.PNG
globals.PNG
Screen1_Initialize.PNG
word_picker.aia
btnExpand.PNG
btnLeft.PNG
btnRight.PNG
btnShrink.PNG
Capture.PNG

Abraham Getzler

unread,
Jun 8, 2017, 10:31:07 PM6/8/17
to MIT App Inventor Forum
Attached is a faster version, using a html label to highlight the selected word or phrase.

ABG

btnRight5_Click.PNG
last.PNG
locate_word.PNG
Screen1_Initialize.PNG
tail.PNG
word_picker_v2.aia
btnExpand_Click.PNG
btnLeft_Click.PNG
btnLeft5.PNG
btnRight_Click.PNG
btnShrink_Click.PNG
Capture.PNG
Designer.PNG
display.PNG
extend_indices.PNG
global_whitespace.PNG
globals.PNG
head.PNG

Alex17

unread,
Jun 8, 2017, 11:22:28 PM6/8/17
to MIT App Inventor Forum
Hey that's a really cool solution! Thanks

Abraham Getzler

unread,
Jun 9, 2017, 1:32:08 PM6/9/17
to MIT App Inventor Forum
If you use the second version, there are 2 bugs left to tidy up ...

The word selection gets flaky at the very end of the text, and

I assumed all words are bounded by just 1 blank, an assumption that
fails at the end of each sentence.  This would be fixed by complementing
the list of word start indices with a matching list of word lengths.

ABG

Nico Marikucza

unread,
Jun 10, 2017, 6:37:43 AM6/10/17
to MIT App Inventor Forum
+1, Abraham!
Why is this tutorial not available in your FAQ?
Nico

Abraham Getzler

unread,
Jun 10, 2017, 9:10:38 PM6/10/17
to MIT App Inventor Forum
Why is this tutorial not available in your FAQ?


My FAQ holds answers to Frequently Asked Questions (FAQ).
This was the first time any one asked for how to so this,
so it doesn't yet qualify as Frequently Asked.

I do have an index to my Gallery projects here 
if you're hungry for more ...

By the way,  I named the FAQ "Power Users FAQ" to encourage other Power Users to housekeep it.

ABG

 
Reply all
Reply to author
Forward
0 new messages