Languages

Menu
Sites
Language
Scroll with Multiple Layouts

I'm trying to achieve a Scroll (Like Task Manager Sample) with Dynamic Elements Based on a full Screen Layout (EDC).
My Problem right now, is that if i put two Layouts,  one goes on top of another, intead of createing a new "page" in the scroller to scroll to.
Using the same code but instead of layout i put an image,  everything works as expected. I am missing something, maybe give a fix size to Layout ?

Code Logic.
Scroller->Box->Layout
I never change the box it self, just add or remove layouts from inside the box.
With layouts dont work, but with images do.
 

View Selected Answer

Responses

8 Replies
Armaan-Ul- Islam

Before Jumping into Discussion, Please share are we on 'Tizen Mobile Native' or 'Tizen Wearable Native' ??

Flavio Lima

Sorry forgort that part. Tizen Wearable Native

Mark as answer
Armaan-Ul- Islam

Thanks. Now as our model is the 'Task manager'/Recent apps, It would better to follow their design.

 

In the 'task manager' sample source code go to src > view.c

function view_task_manager_create() (Line 372)

void view_task_manager_create(char *file_path, char *group_name, char *scroller_part)
{
    s_info.layout = view_create_layout(s_info.conform, file_path, group_name, _layout_back_cb, NULL);

	elm_object_content_set(s_info.conform, s_info.layout);

	s_info.scroller = view_create_horizontal_scroller(s_info.layout, scroller_part, _scrolled_cb, NULL);

	s_info.box = view_create_horizontal_box(s_info.scroller, NULL);

	evas_object_show(s_info.layout);
}

 

So the layer here:

Conform -> layout -> Scroller (horizontal) -> Box (horizontal)

Check out the view_create_horizontal_scroller() and  view_create_horizontal_box() functions. (line 392 & 424)

Flavio Lima

Thanks for the awnser, but right now i have a problem, everytime i add one layout (the app name and imagge if you see task manager exemple), the function to scroll to the newlly page,  

elm_scroller_page_bring_in()

The scroll animatian, doesn't execute, it just jumps to the newlly created layout.
 

createItem();//where i crete the new app, to go to task manager list
elm_scroller_page_show(ad->scroller,1,0); // where i ask to scroll to position number 1 in scroller.

 

Armaan-Ul- Islam

You can move to particular page of a Scroller with animation or without animation, it's your call.

 

# Slide to page With Animation:

Using elm_scroller_page_bring_in()

Evas_Object *sc = NULL;
int h_page = -1;
int v_page = -1;

sc = elm_scroller_add(win);
elm_object_content_set(sc, content);
elm_scroller_page_relative_set(sc, 1, 0);
elm_scroller_last_page_get(sc, &h_page, &v_page);
elm_scroller_page_bring_in(sc, h_page, v_page);           //Example: Slide to last page with animation

 

# Jump to page Without Animation:

Using elm_scroller_page_show()

Evas_Object *sc = NULL;
int h_page = -1;
int v_page = -1;

sc = elm_scroller_add(win);
elm_object_content_set(sc, content);
elm_scroller_page_relative_set(sc, 1, 0);     
elm_scroller_current_page_get(sc, &h_page, &v_page);
elm_scroller_page_show(sc, h_page + 1, v_page);        //Example: jumps to last page directly without animation

 

References:

https://developer.tizen.org/development/api-references/native-application?redirect=/dev-guide/2.3.1/org.tizen.native.wearable.apireference/group__Scroller.html#gae42eafda4e1d7ad8b76ee9350e4d6cfb

https://developer.tizen.org/development/api-references/native-application?redirect=/dev-guide/2.3.1/org.tizen.native.wearable.apireference/group__Scroller.html#ga23f1e0f70e5026b2e42b27b355c86d1e

Flavio Lima

I found the problem, for some reason when i call the animation, the new layout is not yet in the scroller.
Is there a way, to just make the animation when, the item is added to the scroller ?
Something like a callback or event, anything that assures that the new item is already in the scroller ?

Armaan-Ul- Islam

In Scroller API there's a paragraph saying:

 

This widget emits the following signals, besides the ones sent from

  • "edge,left" - The left edge of the content has been reached.
  • "edge,right" - The right edge of the content has been reached.
  • "edge,top" - The top edge of the content has been reached.
  • "edge,bottom" - The bottom edge of the content has been reached.
  • "scroll" - The content has been scrolled (moved).
  • "scroll,anim,start" - Scrolling animation has started.
  • "scroll,anim,stop" - Scrolling animation has stopped.
  • "scroll,drag,start" - Dragging the contents around has started.
  • "scroll,drag,stop" - Dragging the contents around has stopped.

 

Are you using any Code for animation? As 'C' being a procedual language placing the 'anmation' code after 'adding the content to the scroller' code shouldn't be working ?

if(elm_object_content_set(sc, content)){
    DoAnimation();
}
Flavio Lima

The last problem was a miss understading  of the render loop of tizen and my own code that was deliting the object before the animation ends.
My animaitons was automatic like you suggest in early responses. I switch to a manual animation. Everything is working :) Thanks :)