setting back location issue

15 views
Skip to first unread message

Bryan Buchanan

unread,
Feb 11, 2014, 5:12:32 AM2/11/14
to codenameone...@googlegroups.com
Have this sequence of forms:

Main -> LoginForm -> FindPartsForm -> AltPartsForm -> CoreForm

On Main form click Start button => showForm("LoginForm")
On LoginForm click Login button => showForm("FindPartsForm")
On FindPartsForm click FindPartsButton => showForm("AltPartsForm"), displays parts in a list
On AltPartsForm click a list entry => showForm("CoreForm") (if applicable)

When the back key is pressed on the CoreForm, I want the FindPartsForm displayed, so in beforeCoreForm() I have

setBackDestination("FindPartsForm");

This is the sequence of the navigation stack:

beforeAltPartsForm:
[{$title=Demo, $focus=Start, $name=Main}, {$title=Demo, $focus=LoginButton, $name=LoginForm}, {$title=Demo, $focus=FindPartsButton, $name=FindPartsForm}]
 -> this looks OK.

onAltPartsForm_AltPartsListAction:
[{$title=Demo, $focus=Start, $name=Main}, {$title=Demo, $focus=LoginButton, $name=LoginForm}, {$title=Demo, $focus=FindPartsButton, $name=FindPartsForm}]
-> this looks OK

about to show CoreForm, onAltPartsForm_AltPartsListAction:
[{$title=Demo, $focus=Start, $name=Main}, {$title=Demo, $focus=LoginButton, $name=LoginForm}, {$title=Demo, $focus=FindPartsButton, $name=FindPartsForm}]
-> still looks OK

beforeCoreForm:
[{$title=Demo, $focus=Start, $name=Main}, {$title=Demo, $focus=LoginButton, $name=LoginForm}, {$title=Demo, $focus=FindPartsButton, $name=FindPartsForm}, {$title=Demo, $focus=AltPartsList, $sel=0, $name=AltPartsForm}]
-> still OK

setBackDestination = FindPartsForm
beforeCoreForm:
[{$title=Demo, $focus=Start, $name=Main}, {$title=Demo, $focus=LoginButton, $name=LoginForm}, {$title=Demo, $focus=FindPartsButton, $name=FindPartsForm}]
-> back on CoreForm should go to FindPartsForm ???

beforeAltPartsForm:
[{$title=Demo, $focus=Start, $name=Main}, {$title=Demo, $focus=LoginButton, $name=LoginForm}]
-> back goes back to AltPartsForm and FindPartsForm has been popped off the stack ???

I must be missing something !

Shai Almog

unread,
Feb 11, 2014, 11:51:32 AM2/11/14
to codenameone...@googlegroups.com
I suggest overriding setBackDestination and printing out the stack after it completes.
Also its possible that back() was invoked twice from two separate places. I suggest invoking back() explicitly from a button and seeing if this behavior happens.
Reply all
Reply to author
Forward
0 new messages