[SOLVED] Go to previous layout (history) 2020?

0 favourites
  • 13 posts
  • I dug into the community I found

    LittleStain "Simple way would be creating a global variable LastLayout and before the action to change layout use an action to set LastLayout to the current Layout. In the new layout : On button touched go to layout : LastLayout"

    Tired the same but alas not working maybe because I have many layouts having different names not in sequential order, like "ABCLayoutTrue", "HelpLayoutOptional".... some random names.

    Begeegee has given a capx which what I was looking for but, it does not work on my setup.

    Please help.

    Tagged:

  • Save layout name into the global variable in "On end of layout" event.

  • Thank you for your input. Your Layout seems chronological

    619_RM try this one see if it helps

    https://www.dropbox.com/s/yz0nx7dthyes1s3/go%20back%20previous%20layout.capx?dl=0

  • It worked. Thank you dop2000. One question!

    In my setup there one thing which I missed, if someone goes to MenuLayout>OptionLayout>SubOptionLayout, then he clicks the back button at "SubOptionLayout" he redirects to "OptionsLayout" then if he clicks to the back button again he goes back SubOptionLayout".

    This may be the reason why Constcut doesn't have a back button (history) natively. Is there any workaround or it is better to place a separate back button on each layout?

    Save layout name into the global variable in "On end of layout" event.

  • Thank you for your input. Your Layout seems chronological

    > 619_RM try this one see if it helps

    >

    >

    > https://www.dropbox.com/s/yz0nx7dthyes1s3/go%20back%20previous%20layout.capx?dl=0

    When you press buttons to go directly to the Levels yes is chronological just for simplicity but you are not interested in that, if you look again you are only interested in Event (4 & 6) I deliberately left it not chronological so you can implement it easily with your events, it's just two lines of code sudden be hard.

    I think probably you are looking for something else perhaps a full history? and not just the last layout you visited

  • Thank you tarek2 I appreciate what you have done, providing a capx is so nice of you. Sorry for not making it clear actually I tot it might be worked but you are right for my setup it needs a full history back button.

    > Thank you for your input. Your Layout seems chronological

    > > 619_RM try this one see if it helps

    > >

    > >

    > > https://www.dropbox.com/s/yz0nx7dthyes1s3/go%20back%20previous%20layout.capx?dl=0

    When you press buttons to go directly to the Levels yes is chronological just for simplicity but you are not interested in that, if you look again you are only interested in Event (4 & 6) I deliberately left it not chronological so you can implement it easily with your events, it's just two lines of code sudden be hard.

    I think probably you are looking for something else perhaps a full history? and not just the last layout you visited

  • Recording a history is also not too difficult. Create an empty array with width=0. On end of any layout push a new record into the array with LayoutName.

    When you need to go back to previous layout, read last layout name from the array - Array.At(Array.width-1), then delete this index.

  • Thanks, dop2000 I created the Array, Please check the c3p. The issue is

    [ Map: MenuLayout>OptionLayout>SubOptionLayout ]

    When the user at "SubOptionLayout" and click back It will lead to "OptionLayout" and then at "OptionLayout" when the user clicks back it again lead to the previous layout that is "SubOptionLayout". So whats happing here is The user is going forward and backwards between "OptionLayout" & "SubOptionLayout" on a loop. :(

    Recording a history is also not too difficult. Create an empty array with width=0. On end of any layout push a new record into the array with LayoutName.

    When you need to go back to previous layout, read last layout name from the array - Array.At(Array.width-1), then delete this index.

  • Of course it doesn't work - you didn't set array width to 0, you didn't insert new record to the end of the array, you didn't delete the last record when going back..

    See this fixed project:

    dropbox.com/s/l1le3x8zp3roth9/LayoutHistory.c3p

  • You are awesome . . . Thank you.......

    Of course it doesn't work - you didn't set array width to 0, you didn't insert new record to the end of the array, you didn't delete the last record when going back..

    See this fixed project:

    https://www.dropbox.com/s/l1le3x8zp3roth9/LayoutHistory.c3p?dl=0

  • You are awesome . . . Thank you.......

    Of course it doesn't work - you didn't set array width to 0, you didn't insert new record to the end of the array, you didn't delete the last record when going back..

    See this fixed project:

    https://www.dropbox.com/s/l1le3x8zp3roth9/LayoutHistory.c3p?dl=0

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This should be incorporated as an action into C3.

    Of course it doesn't work - you didn't set array width to 0, you didn't insert new record to the end of the array, you didn't delete the last record when going back..

    See this fixed project:

    https://www.dropbox.com/s/l1le3x8zp3roth9/LayoutHistory.c3p?dl=0

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)