- This topic has 6 replies, 3 voices, and was last updated 11 years, 4 months ago by
mobio9471.
-
AuthorPosts
-
mobio9471MemberHi,
I created two screens
startScreen.mobi
info.mobistartScreen is marked as Startup Screen.
When I build the app and it starts, startScreen should be the first Screen.
(In case it is the first start of the app) info-Screen should appear after startScreen automatically by javascript.I did it like that:
In startScreen_custom.js I added
phoneui.documentReadyHandler = function() {
$(“#m1-startScreen-text1”).text(“documentReady works”);phoneui.gotoPage(“#m1-info”, phoneui.transitions.slideLeft);
}
The text “documentReady works” on startScreen appears but info-page is not selected.
The funny thing is …
… when I now add a push button on startScreen with settings “Go to Screen” and “info.mobi” and start the app -> info page will be selected automatically (without pressing the push button) :-)))
For test purposes I added to startScreen_custom.js
function callFunction(){
phoneui.gotoPage(“#m1-info”, phoneui.transitions.slideLeft);
}and changed the push button to OnClick = “Run Javascript” and Code: “callFunction();”
Nothing happens after app start and nothing happens at pressing the push button.
Now I added a back-button on info-screen and a 2. push button to startScreen with
settings “Go to Screen” and “info.mobi”.
After app start info-screen occures. When I now get back to startScreen and press the first push-button ( OnClick = “Run Javascript” and Code: “callFunction();”) info-page is selected as expected.
That means: With startScreen containing a push button (settings “Go to Screen” and “info.mobi”) phoneui.gotoPage works as expected. Without this button it does not.
My questions:
What is the reason for this behavior ?
Did I do something wrong ?
Is there a better way to realize a info-page like that than using phoneui.gotoPage to call a screen ?
March 12, 2014 at 4:17 pm #347983
support-octavioMemberHi mobio9471,
The solution for this is adding your additional .mobi file as an additional project file:
Attachments:
You must be logged in to view attached files.March 13, 2014 at 1:14 am #347991
mobio9471MemberHi octavio,
thank you very much for this hint. It works now 🙂
Do you mean, that I have to add all other .mobi (info.mobi in this case) files to the .mobi file marked as Startup Screen (Screen Properties, startScreen.mobi in this case) in general ?
Is it always neccessary and the general approach of building a project ?March 13, 2014 at 7:59 am #348001
BrandonMemberYou only have to do this with project files that are not linked with a button or other widget (not HTML widget).
When you use a button, with gotoscreen command it will automatically include it. But, when you only call it in code it does not know to include it. If you have problems with code not loading a screen this is usually the problem.March 14, 2014 at 7:14 am #348035
mobio9471MemberHi,
while I test the app on my android 2.3 galaxy s2 I encountered the problem, that info-page sometimes is not loaded or displayed completely. Sometimes there is missing a part of the layout. Seems to me as it was not loaded completely.
I solved that problem by adding a setTimout function like this
phoneui.documentReadyHandler=function(){
setTimeout(function(){phoneui.gotoPage(“#m1-info”, phoneui.transitions.slideLeft);},2000);
}Is there an approach to solve this problem without adding a time delay ?
March 14, 2014 at 1:38 pm #348044
support-octavioMemberHi mobio9471,
Can you share a sample project that demonstrate the problem to investigate it?
March 14, 2014 at 5:44 pm #348051
mobio9471MemberHi oktavio,
the related Build #62952407 demonstrates the problem.
Installed in my mobile the first time of invokation the info-page occurs as expected.
After the first time only a white window containing the navigation-bar title (info) appears.
Nothing else.Inside the mobile web simulator the problem does not occure.
I tried to simplify the problem by removing other pages and page-content that is obviously not involved to this problem.
I found, that the fewer content comprised by the app, the more times the page is displayed correctly. Having only the startup screen and the info-page with almost no content, the proplem disappeared.
If you need more information please let me know.
-
AuthorPosts