Resize the font with sound call

34 views
Skip to first unread message

Ghanem O

unread,
Aug 9, 2019, 3:51:19 PM8/9/19
to MIT App Inventor Forum
Hi all, 
I am trying to make a button method to resize the font after calling the sound in the Webviewer. Can you help me to do this method.
There is a small thing to arabtext procedure to give the div holding the text an id:
changetosetarabtextprocedure.png


blocks (3).png
arabicText.html
me_quran.ttf

TimAI2

unread,
Aug 9, 2019, 4:03:37 PM8/9/19
to MIT App Inventor Forum
Osama

The issue with your app, is that after resizing the text but before playing a sound all is OK, but when you ask a sound to play, the web page is reloaded in order to highlight the sentence, and the resizing is lost.
It is not trivial in either the app or the html to resolve this ( as I advised in your other thread), and requires advanced use of the webviewstring and javascript.

I have been having a look at this tonight, but it is complex and I probably need a clear head. The problem is working around the original programming, which was to your design !
I am close, but not there yet....

The blocks you have shown will not help, they are the wrong ones, and the html shows the button solution and not the improved slider solution.

TimAI2

unread,
Aug 9, 2019, 5:47:36 PM8/9/19
to MIT App Inventor Forum
OK, I believe I have a fix!

See the attached aia.

How does it work ?

When you click the Load HTML File button, it loads the html file in the assets and sets the webviewstring to a random text string (there are only five so you do get repeats)
When you move the slider, it increases or decreases the font in steps, and sets the webviewstring to the new size value. This is shown back in the app below the button
The webviewstring sent to the html page is in two parts, the random text string and the font-size value
These two parts are handled separately by the javascript in the html page, so on load it sets the latest value sent back to the app, keeping the font size from the last refresh

Hopefully, this will transfer to your app, i need to do that work now...
incfontandkeep.aia
Message has been deleted

TimAI2

unread,
Aug 9, 2019, 6:25:06 PM8/9/19
to mitappinv...@googlegroups.com
And it works !

Tested using Companion on HTC10 (Android 7.0)

(aia added after posting)

EDIT: aia removed at original posters request

Ghanem O

unread,
Aug 10, 2019, 3:04:15 AM8/10/19
to MIT App Inventor Forum
Hello Tim,
You have really done a very Great job! 
It is  unbelievable!
Thank you so much. I tested it and every thing is fine. It is possible to make two buttons instead of slider, isn't?

TimAI2

unread,
Aug 10, 2019, 4:15:04 AM8/10/19
to mitappinv...@googlegroups.com
Yes you can have buttons :)

Ghanem O

unread,
Aug 10, 2019, 12:46:55 PM8/10/19
to MIT App Inventor Forum
Hello Tim

Thank you so much for a great job you have done.
You are really a helpful man.
I wish you all the best.
Reply all
Reply to author
Forward
0 new messages