Book App Template Project (Is it possible to create a list of VerticalArrangement?!)

Ah, ok. Yes, you can do that.
All you have to do is add every item in a list, and call the .AddComponent functioning in a for loop iterating over that list. The component attribute can be selected from the list using the select list block.

I don't have the extension as I'm not able to download it, could somebody represent this in blocks, please?

Edit: The code will look something like this. Please make sure you replace "set VerticalArrangement.Height" to "call HorizontalViewPager1.AddComponent" since I don't have the extension:
image

1 Like

[only post direct links to extension if they are your or you have permission from the developer to do so]

If you want to create additional vertical arrangements dynamically then you will need to use @yusufcihan's excellent Dynamic Components extension

Alternatively, you could just use one vertical arrangement and change the content with each swipe! (this doesn't appear to work)

@vknow360 - is it possible to use the same components in different pages (addComponent) ?

1 Like

Yes it's possible, but since a view can have only one parent so component will only be added to last called parent.
But I think I misunderstood what you asked. :sweat_smile:

For example:

image

Label1 is not inside VerticalArrangement 1

image

this crashes the companion on swipe (but displays the first view)

Maybe view needs to be removed from old parent/page before you can add it to different parent/page.

Yes, that sort of works, I need to have a play.....

This all sounds like a List Picker.

Have you tried using one of those yet?

This is a different game :wink:

I believe there is a missing piece to this puzzle:

Add component by index:

HorizontalViewPager1.AddComponent
--id
--component
--index

because one needs to remove the previous component then replace it with another (different) one

You have it in the vertical view pager extension :wink:

1 Like

Thank you everyone..
Sorry..
I created a new post that included the latest in this work, and changed the title of the post to be more indicative of the project and the desired. (Book App Template Project)
Please continue there with my best regards and thanks!

That's OK, I was about to move it here anyway :wink:

Simply I am trying to design a simple application as a template for displaying the textual content of any book..
I designed an app with only 3 pages, using the HorizontalViewPager extension..
Each of these 3 pages consists of 3 components VerticalArrangement, VerticalScrollArrangement and Label..
What I'm thinking of and would like to collaborate on is to put a code to create any number of pages automatically, so that I don't need to add these three components manually every time I want to add a page to the book!

I think it would be difficult or even impossible for any one to repeat these steps if the book was 100 pages or 300

Can any one help?!


BookTemplateProject.aia (60.4 KB)

I have already recommended this

If you want to create additional vertical arrangements dynamically then you will need to use @yusufcihan's excellent Dynamic Components extension

Mixing the two extensions together may prove an interesting challenge.

There is also a lite version by @Kevinkun [FREE] CompCreator- lite version of DynamicComponents extension - Extensions - Kodular Community

I have been working on getting the pager extension to be dynamic, but no success yet.

1 Like

Hopefully have it figured out for you. I have made use of the scrollto block and the page changed block to handle content changes. In essence if you swipe right, your are scrolled back to the middle page and the content is set to the next page in the book, if you swipe left the same happens in reverse.

[EDIT - UPDATE: now shows next and previous pages during swipe]

swipeSlidesBookv2.aia (18.4 KB)

Blocks

Video
3 Likes

Thank you very much @TIMAI2 Great work!
Let's go a step further and develop our project and think how to get book content (text) from a file!
Is this possible?

This will all depend on how your book file is organised, and in what format. Perhaps provide an example?

This is my extension for static variables, I think you meant this?

1 Like

Oops, now fixed

See here for a starter: