#1 2016-02-16 05:45:41

ross_t
Member
Registered: 2016-02-16
Posts: 6

[RESOLVED] Help me get started...

Hello All,

First, pardon me for asking a very very basic question here.

I downloaded App Builder and also went through the example projects; but I'm still struggling to get familiar with the syntax of App Builder. Can someone please point me to the step by step Tutorials? I went through the video tutorials as well.

The things that I am currently struggling with are...
1. How to get the value from Input Text box?
2. How to perform basic mathematical operations?
3. How to set the value back to UI controls?

For the sake of practice, I started writing an app that will convert Kilometer value to Miles. It's a simple mathematical formula (KmValue * 0.62). I have two text boxes and one button "Convert". Trying to learn from the Calculator project, I attempted to write following code:

SetVar "Expression" "[txtKM.Value] * 0.62" "String"
Math "[Expression]" "[txtMiles.Value]"

... on Button's Click event. But it's not working. Where is the code going wrong?

Please let me know so I can get the things right and also learn to write proper App Builder code.

Waiting for your reply...

Cheers,

\r

Last edited by ross_t (2016-02-18 06:48:15)

Offline

#2 2016-02-16 06:27:37

taringaso
Member
Registered: 2016-02-13
Posts: 8

Re: [RESOLVED] Help me get started...

this code works perfectly

on click button event, put this

Math "[txtKilometers.Value] * 0.62" "[result]"
SetVar "[txtMiles.Value]" "[result]" "Number"

insert 2 Text Control called
- txtKilometers
- txtMiles

Last edited by taringaso (2016-02-16 06:46:06)

Offline

#3 2016-02-16 08:38:30

ross_t
Member
Registered: 2016-02-16
Posts: 6

Re: [RESOLVED] Help me get started...

thanks; it worked. I made changes in my code and it worked good. However, if I write the code below...

SetVar "Expression" "[txtKM.Value] * 0.62" "Number"
Math "[Expression]" "[txtMiles.Value]"

... the UI is not rendered. Here are the two errors I see...

Error: "Syntax error" - Line: 1203 - Char: 59 - Code: 0 - Url: http://127.0.0.1:9999/app/scripts/app.js
Error: "Unable to set property 'Cordova' of undefined or null reference" - Line: 6 - Char: 1 - Code: 0 - Url: http://127.0.0.1:9999/cordova.js

What's wrong? I just wish to understand the fundamentals behind it. Is this because "[txtKM.Value]" is String by default? Does App Builder support variable casting?

Offline

#4 2016-02-16 14:17:34

taringaso
Member
Registered: 2016-02-13
Posts: 8

Re: [RESOLVED] Help me get started...

If you look at this code line, Expression isn't a variable
it was supposed to be a variable:

SetVar "Expression" "[txtKM.Value] * 0.62" "Number"

[Expression] is a variable in this code line

Math "[Expression]" "[txtMiles.Value]"

Last edited by taringaso (2016-02-16 14:24:43)

Offline

#5 2016-02-16 23:18:48

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: [RESOLVED] Help me get started...

Hello to all,

Thanks taringaso for your replies. Certainly the problem refered by ross_t is a syntax error. My recomendation is to take note about the error message and investigate the app.js Javascript file (Menu - App - App Javascript) at the line/colum indicated by the error.

May this can help in order to find why the syntax error happend. Anyway, if you can prepare a little application in order to try to reproduce the problem I will try as quickly as possible and may can help you in a better way ross_t.

Offline

#6 2016-02-17 00:14:47

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: [RESOLVED] Help me get started...

Hello again,

Maybe you can copy here too the Javascript code (some lines above and bellow) which cause the problem. Then may it's more easy to found the cause of the syntax error and then try to help you ross_t.

Offline

#7 2016-02-17 13:27:29

ross_t
Member
Registered: 2016-02-16
Posts: 6

Re: [RESOLVED] Help me get started...

Thanks so much taringaso and David for your help. I'm getting familiar with the program now. It's really easy to write programs in App Builder than writing jQuery Mobile based Cordova apps from scratch. Great software David!

Noticed a few more issues when I compiled app to the Cordova Android App. When I installed the Application on my Sony Xperia Z1 and tapped to start the app, a blank White Screen appears for a couple of seconds and then the actual app is started. I see the same sort of latency (a blank screen before app starts) when I used jQuery Mobile and manually compiled Cordova app. I don't see such behavior when I write native Java code and compile to APK file.

Is this latency a normal (or known) thing in hybrid applications?

Last edited by ross_t (2016-02-17 13:30:52)

Offline

#8 2016-02-17 23:12:49

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: [RESOLVED] Help me get started...

Hello,

Thanks for your kindly words ross_t. Yes; certainly Cordova applications have the "white screen" latency. Probably a good way to solve it is to use an splash screen for your application ross_t. Take a look at the app's options dialog. App Builder can prepare for you different splash screens from your base images and also require for you the appropiate Cordova plugin and other stuff.

Offline

#9 2016-02-18 06:47:32

ross_t
Member
Registered: 2016-02-16
Posts: 6

Re: [RESOLVED] Help me get started...

Interesting to see there is already an option for the Splash Screen in App Builder. I will try it out; and will open a separate thread in Forum if I need your expert guidance. Once again, thanks so much David and taringaso for your help. I'm marking this thread as resolved now.

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.