Returning the first Layout

Libor

Member
Licensed User
Longtime User
Hi I've built my first little program.

I have a first layout loaded which contains some buttons, These buttons redirect to another layout.

The second layout is loaded on a panel. That layout works fine however when I finish with that second layout and I remove the view using Panel.RemoveView I don't go back to my original layout. The application is closed
I tried using the Activity_KeyPress and just the back button without any statement to RemoveView but it does the same no matter what.

I can't seem to figure out why.

Here is the code I'm trying to use to get the first layout back using the back button.

Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event

If KeyCode = KeyCodes.KEYCODE_BACK Then
res = Msgbox2("Do you want to exit?", "", "Yes", "Cancel", "", Null)
If res = DialogResponse.POSITIVE Then
AddProfileLayoutPanel.RemoveView
Return False
End If

I did read the life cycle information but I'm clearly missing something. Do I need to open the first layout in a panel also in order to be able to return to it this way and just reload the panel?
Even if I go directly from the main view to this panel with the second layout, even if I just try to use the back button it still closes the entire application instead of going to the previous screen.

Appreciate to know what I'm missing.
 

klaus

Expert
Licensed User
Longtime User
Instead of removing the panel you could also use the Visible Parameter.
- Loading the Layout in Activity_Create
- When calling the Panel, set Panel.Visible=True
- With a Button on the Panel, clicking this one, set Panel.Visible=False

That's the way I handle them.

Best regards.
 
Upvote 0
Top