This application is a thorough exercise on the gengrid widget's A\-P\-I.

We place an Elementary gengrid widget on a window, with various knobs below its viewport, each one acting on it somehow.

The code's relevant part begins at the grid's creation. After instantiating it, we set its items sizes, so that we don't end with items one finger size wide, only. We're setting them to fat, 150 pixel wide ones, for this example. We give it some size hints, not to be discussed in this context and, than, we register a callback on one of its smart events -- the one coming each time an item gets doubly clicked. There, we just print the item handle's value.  
\begin{DoxyCodeInclude}
   grid = elm_gengrid_add(win);
   elm_gengrid_item_size_set(grid, 150, 150);
   evas\_object\_size\_hint\_weight\_set(grid, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(grid, EVAS\_HINT\_FILL, EVAS\_HINT\_FILL);
   elm_box_pack_end(bx, grid);
   evas\_object\_smart\_callback\_add(grid, \textcolor{stringliteral}{"clicked,double"}, \_double\_click, NULL);
   evas\_object\_smart\_callback\_add(grid, \textcolor{stringliteral}{"longpressed"}, \_long\_pressed, NULL);
   evas\_object\_show(grid);

\end{DoxyCodeInclude}
  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* item double click callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_double\_click(\textcolor{keywordtype}{void}        *data,
              Evas\_Object *obj,
              \textcolor{keywordtype}{void}        *event\_info)
\{
   fprintf(stdout, \textcolor{stringliteral}{"Double click on item with handle %p\(\backslash\)n"}, event\_info);
\}

\end{DoxyCodeInclude}


Before we actually start to deal with the items A\-P\-I, let's show some things items will be using throughout all the code. The first of them is a struct to be used as item data, for all of them\-:  
\begin{DoxyCodeInclude}
\textcolor{keyword}{typedef} \textcolor{keyword}{struct }\_Example\_Item
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *path;
\} Example\_Item;

\end{DoxyCodeInclude}


That path will be used to index an image, to be swallowed into one of the item's icon spots. The images themselves are distributed with Elementary\-:  
\begin{DoxyCodeInclude}
\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *imgs[9] =
\{
   \textcolor{stringliteral}{"panel\_01.jpg"},
   \textcolor{stringliteral}{"plant\_01.jpg"},
   \textcolor{stringliteral}{"rock\_01.jpg"},
   \textcolor{stringliteral}{"rock\_02.jpg"},
   \textcolor{stringliteral}{"sky\_01.jpg"},
   \textcolor{stringliteral}{"sky\_02.jpg"},
   \textcolor{stringliteral}{"sky\_03.jpg"},
   \textcolor{stringliteral}{"sky\_04.jpg"},
   \textcolor{stringliteral}{"wood\_01.jpg"},
\};

\end{DoxyCodeInclude}


We also have an (unique) gengrid item class we'll be using for items in the example\-:  
\begin{DoxyCodeInclude}
\textcolor{keyword}{static} Elm_Gengrid_Item_Class *gic = NULL;

\end{DoxyCodeInclude}
  
\begin{DoxyCodeInclude}
        gic->item\_style = \textcolor{stringliteral}{"default"};
        gic->func.text\_get = \_grid\_label\_get;
        gic->func.content\_get = \_grid\_content\_get;
        gic->func.state\_get = \_grid\_state\_get;
        gic->func.del = \_grid\_del;

\end{DoxyCodeInclude}


As you see, our items will follow the default theme on gengrid items. For the label fetching code, we return a string composed of the item's image path\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* label fetching callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{char} *
\_grid\_label\_get(\textcolor{keywordtype}{void}        *data,
                Evas\_Object *obj,
                \textcolor{keyword}{const} \textcolor{keywordtype}{char}  *part)
\{
   \textcolor{keyword}{const} Example\_Item *it = data;
   \textcolor{keywordtype}{char} buf[256];

   snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"Photo %s"}, it->path);
   \textcolor{keywordflow}{return} strdup(buf);
\}

\end{DoxyCodeInclude}


For item icons, we'll be populating the item default theme's two icon spots, {\ttfamily \char`\"{}elm.\-swallow.\-icon\char`\"{}} and {\ttfamily \char`\"{}elm.\-swallow.\-end\char`\"{}}. The former will receive one of the images in our list (in the form of a \hyperlink{bg_02_example_page}{background}), while the latter will be a check widget. Note that we prevent the check to propagate click events, so that the user can toggle its state without messing with the respective item's selection in the grid\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* icon fetching callback */}
\textcolor{keyword}{static} Evas\_Object *
\_grid\_content\_get(\textcolor{keywordtype}{void}        *data,
                  Evas\_Object *obj,
                  \textcolor{keyword}{const} \textcolor{keywordtype}{char}  *part)
\{
   \textcolor{keyword}{const} Example\_Item *it = data;

   \textcolor{keywordflow}{if} (!strcmp(part, \textcolor{stringliteral}{"elm.swallow.icon"}))
     \{
        Evas\_Object *icon = elm_bg_add(obj);
        \textcolor{keywordtype}{char} buf[PATH\_MAX];

        snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%s/images/%s"}, elm_app_data_dir_get(),
                 it->path);

        elm_bg_file_set(icon, buf, NULL);
        evas\_object\_size\_hint\_aspect\_set(icon, EVAS\_ASPECT\_CONTROL\_VERTICAL, 1,
                                         1);
        evas\_object\_show(icon);
        \textcolor{keywordflow}{return} icon;
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(part, \textcolor{stringliteral}{"elm.swallow.end"}))
     \{
        Evas\_Object *ck;
        ck = elm_check_add(obj);
        evas\_object\_propagate\_events\_set(ck, EINA\_FALSE);
        evas\_object\_show(ck);
        \textcolor{keywordflow}{return} ck;
     \}

   \textcolor{keywordflow}{return} NULL;
\}

\end{DoxyCodeInclude}


As the default gengrid item's theme does not have parts implementing item states, we'll be just returning false for every item state\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* state fetching callback */}
\textcolor{keyword}{static} Eina\_Bool
\_grid\_state\_get(\textcolor{keywordtype}{void}        *data,
                Evas\_Object *obj,
                \textcolor{keyword}{const} \textcolor{keywordtype}{char}  *part)
\{
   \textcolor{keywordflow}{return} EINA\_FALSE;
\}

\end{DoxyCodeInclude}


Finally, the deletion callback on gengrid items takes care of freeing the item's label string and its data struct\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* deletion callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_grid\_del(\textcolor{keywordtype}{void}        *data,
          Evas\_Object *obj)
\{
   Example\_Item *it = data;

   eina\_stringshare\_del(it->path);
   free(it);
\}

\end{DoxyCodeInclude}


Let's move to item insertion/deletion knobs, them. They are four buttons, above the grid's viewport, namely
\begin{DoxyItemize}
\item \char`\"{}\-Append\char`\"{} (to append an item to the grid),
\item \char`\"{}\-Prepend\char`\"{} (to prepend an item to the grid),
\item \char`\"{}\-Insert before\char`\"{} (to insert an item before the selection, on the grid),
\item \char`\"{}\-Insert after\char`\"{} (to insert an item after the selection, on the grid),
\item \char`\"{}\-Clear\char`\"{} (to delete all items in the grid),
\item \char`\"{}\-Bring in 1st\char`\"{} (to make the 1st item visible, by scrolling),
\item \char`\"{}\-Show last\char`\"{} (to directly show the last item),
\end{DoxyItemize}which are displaced and declared in that order. We're not dealing with the buttons' creation code (see \hyperlink{button_example_01}{a button example}, for more details on it), but with their {\ttfamily \char`\"{}clicked\char`\"{}} registered callbacks. For all of them, the grid's handle is passed as {\ttfamily data}. The ones creating new items use a common code, which just gives a new {\ttfamily Example\-\_\-\-Item} struct, with {\ttfamily path} filled with a random image in our images list\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* new item with random path */}
\textcolor{keyword}{static} Example\_Item *
\_item\_new(\textcolor{keywordtype}{void})
\{
   Example\_Item *it;

   it = malloc(\textcolor{keyword}{sizeof}(*it));
   it->path = eina\_stringshare\_add(imgs[rand() % (\textcolor{keyword}{sizeof}(imgs) /
                                                  \textcolor{keyword}{sizeof}(imgs[0]))]);
   \textcolor{keywordflow}{return} it;
\}

\end{DoxyCodeInclude}


Moreover, that ones will set a common function to be issued on the selection of the items. There, we print the item handle's value, along with the callback function data. The latter will be {\ttfamily N\-U\-L\-L}, always, because it's what we pass when adding all icons. By using \hyperlink{group__General_ga4465a576c55d197878aeafc0bacf7bb4}{elm\-\_\-object\-\_\-item\-\_\-data\-\_\-get()}, we can have the item data back and, with that, we're priting the item's path string. Finally, we exemplify \hyperlink{group__Gengrid_gaca9e06b8d918dc034072efac9d32638e}{elm\-\_\-gengrid\-\_\-item\-\_\-pos\-\_\-get()}, printing the item's position in the grid\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* item selection callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_grid\_sel(\textcolor{keywordtype}{void}        *data,
          Evas\_Object *obj,
          \textcolor{keywordtype}{void}        *event\_info)
\{
   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} x, y;
   Example\_Item *it = elm_object_item_data_get(event\_info);

   elm_gengrid_item_pos_get(event\_info, &x, &y);

   fprintf(stdout, \textcolor{stringliteral}{"Item [%p], with data [%p], path %s, at position (%d, %d),"}
           \textcolor{stringliteral}{" has been selected\(\backslash\)n"}, event\_info, data, it->path, x, y);
\}

\end{DoxyCodeInclude}


The appending button will exercise \hyperlink{group__Gengrid_gaf949efb8ba4f1726ff8632ac16f4b426}{elm\-\_\-gengrid\-\_\-item\-\_\-append()}, simply\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* append an item */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_append\_bt\_clicked(\textcolor{keywordtype}{void}        *data,
                   Evas\_Object *obj,
                   \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;
   Example\_Item *it = \_item\_new();

   elm_gengrid_item_append(grid, gic, it, \_grid\_sel, NULL);
\}

\end{DoxyCodeInclude}


The prepending, naturally, is analogous, but exercising \hyperlink{group__Gengrid_ga6c54453030699348591c9a377c3015cd}{elm\-\_\-gengrid\-\_\-item\-\_\-prepend()}, on its turn. The \char`\"{}\-Insert before\char`\"{} one will expect an item to be selected in the grid, so that it will insert a new item just before it\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* "insert before" callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_before\_bt\_clicked(\textcolor{keywordtype}{void}        *data,
                   Evas\_Object *obj,
                   \textcolor{keywordtype}{void}        *event\_info)
\{
   Example\_Item *it;
   Evas\_Object *grid = data;
   Elm_Object_Item *sel;

   sel = elm_gengrid_selected_item_get(grid);
   \textcolor{keywordflow}{if} (!sel)
     \textcolor{keywordflow}{return};

   it = \_item\_new();
   elm_gengrid_item_insert_before(grid, gic, it, sel, \_grid\_sel, NULL);
\}

\end{DoxyCodeInclude}


The \char`\"{}\-Insert after\char`\"{} is analogous, just using \hyperlink{group__Gengrid_ga4e16945886805be5c33a7ef59742f0ad}{elm\-\_\-gengrid\-\_\-item\-\_\-insert\-\_\-after()}, instead. The \char`\"{}\-Clear\char`\"{} button will, as expected, just issue \hyperlink{group__Gengrid_gace5ef4ba6310d6bd92fe2810097b4558}{elm\-\_\-gengrid\-\_\-clear()}\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* delete items */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_clear\_cb(\textcolor{keywordtype}{void}        *data,
          Evas\_Object *obj,
          \textcolor{keywordtype}{void}        *event\_info)
\{
   elm_gengrid_clear(data);

   fprintf(stdout, \textcolor{stringliteral}{"Clearing the grid!\(\backslash\)n"});
\}

\end{DoxyCodeInclude}


The \char`\"{}\-Bring in 1st\char`\"{} button is there exercise two gengrid functions -- \hyperlink{group__Gengrid_ga6a52d7f6389630f15c30debbb38dbc3f}{elm\-\_\-gengrid\-\_\-first\-\_\-item\-\_\-get()} and \hyperlink{group__Gengrid_gaafb9f0f37197bc1e3bd26487d21575b9}{elm\-\_\-gengrid\-\_\-item\-\_\-bring\-\_\-in()}. With the former, we get a handle to the first item and, with the latter, you'll see that the widget animatedly scrolls its view until we can see that item\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* bring in 1st item */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_bring\_1st\_clicked(\textcolor{keywordtype}{void}        *data,
                   Evas\_Object *obj,
                   \textcolor{keywordtype}{void}        *event\_info)
\{
   Elm_Object_Item *gg\_it = elm_gengrid_first_item_get(data);

   \textcolor{keywordflow}{if} (!gg\_it) \textcolor{keywordflow}{return};

   elm_gengrid_item_bring_in(gg\_it, ELM_GENGRID_ITEM_SCROLLTO_IN);
\}

\end{DoxyCodeInclude}


The \char`\"{}\-Show last\char`\"{}, in its turn, will use \hyperlink{group__Gengrid_gac25c8258d033b14c5554eadd6682c902}{elm\-\_\-gengrid\-\_\-last\-\_\-item\-\_\-get()} and \hyperlink{group__Gengrid_ga2ad54a7521db21b917e7d3d7afd806b7}{elm\-\_\-gengrid\-\_\-item\-\_\-show()}. The latter differs from \hyperlink{group__Gengrid_gaafb9f0f37197bc1e3bd26487d21575b9}{elm\-\_\-gengrid\-\_\-item\-\_\-bring\-\_\-in()} in that it immediately replaces the contents of the grid's viewport with the region containing the item in question\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* show last item */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_show\_last\_clicked(\textcolor{keywordtype}{void}        *data,
                   Evas\_Object *obj,
                   \textcolor{keywordtype}{void}        *event\_info)
\{
   Elm_Object_Item *gg\_it = elm_gengrid_last_item_get(data);

   \textcolor{keywordflow}{if} (!gg\_it) \textcolor{keywordflow}{return};

   elm_gengrid_item_show(gg\_it, ELM_GENGRID_ITEM_SCROLLTO_IN);
\}

\end{DoxyCodeInclude}


To change the grid's cell (items) size, we've placed a spinner, which has the following {\ttfamily \char`\"{}changed\char`\"{}} smart callback\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* change items' size */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_size\_changed(\textcolor{keywordtype}{void}        *data,
              Evas\_Object *obj,
              \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;
   \textcolor{keywordtype}{int} size = elm_spinner_value_get(obj);

   elm_gengrid_item_size_set(grid, size, size);
\}

\end{DoxyCodeInclude}


Experiment with it and see how the items are affected. The \char`\"{}\-Disable
item\char`\"{} button will, as the name says, disable the currently selected item\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* disable selected item */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_toggle\_disabled\_cb(\textcolor{keywordtype}{void}        *data,
                    Evas\_Object *obj,
                    \textcolor{keywordtype}{void}        *event\_info)
\{
   Elm_Object_Item *gg\_it = elm_gengrid_selected_item_get(data);

   \textcolor{keywordflow}{if} (!gg\_it) \textcolor{keywordflow}{return};

   elm_gengrid_item_selected_set(gg\_it, EINA\_FALSE);
   elm_object_item_disabled_set(gg\_it, EINA\_TRUE);
\}

\end{DoxyCodeInclude}
 Note that we also make use of \hyperlink{group__Gengrid_ga2168120297a08d2847d4740faeb77543}{elm\-\_\-gengrid\-\_\-item\-\_\-selected\-\_\-set()}, there, thus making the item unselected before we actually disable it.

To toggle between horizontal and vertical layouting modes on the grid, use the \char`\"{}\-Horizontal mode\char`\"{} check, which will call the respective A\-P\-I function on the grid\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* change layouting mode */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_horizontal\_grid(\textcolor{keywordtype}{void}        *data,
                 Evas\_Object *obj,
                 \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;

   elm_gengrid_horizontal_set(grid, elm_check_state_get(obj));
\}

\end{DoxyCodeInclude}


If you toggle the check right after that one, \char`\"{}\-Always select\char`\"{}, you'll notice all subsequent clicks on the {\bfseries same} grid item will still issue the selection callback on it, what is different from when it's not checked. This is the \hyperlink{group__Gengrid_ga6f4e6b2f4181b5a7e37b99720b6af253}{elm\-\_\-gengrid\-\_\-select\-\_\-mode\-\_\-set()} behavior\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* "always select" callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_always\_select\_change(\textcolor{keywordtype}{void}        *data,
                      Evas\_Object *obj,
                      \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;
   Eina\_Bool always = elm_check_state_get(obj);

   \textcolor{keywordflow}{if} (always)
     elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_ALWAYS);
   \textcolor{keywordflow}{else}
     elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_DEFAULT);

   fprintf(stdout, \textcolor{stringliteral}{"\(\backslash\)"Always select\(\backslash\)" mode for gengrid items is now %s\(\backslash\)n"},
           always ? \textcolor{stringliteral}{"on"} : \textcolor{stringliteral}{"off"});
\}

\end{DoxyCodeInclude}


One more check follows, \char`\"{}\-Bouncing\char`\"{}, which will turn on/off the bouncing animations on the grid, when one scrolls past its borders. Experiment with scrolling the grid to get the idea, having it turned on and off\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* "bouncing mode" callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_bouncing\_change(\textcolor{keywordtype}{void}        *data,
                 Evas\_Object *obj,
                 \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;
   Eina\_Bool bounce = elm_check_state_get(obj);

   elm_scroller_bounce_set(grid, bounce, bounce);

   fprintf(stdout, \textcolor{stringliteral}{"Bouncing effect for gengrid is now %s\(\backslash\)n"},
           bounce ? \textcolor{stringliteral}{"on"} : \textcolor{stringliteral}{"off"});
\}

\end{DoxyCodeInclude}


The next two checks will affect items selection on the grid. The first, \char`\"{}\-Multi-\/selection\char`\"{}, will make it possible to select more the one item on the grid. Because it wouldn't make sense to fetch for an unique selected item on this case, we also disable two of the buttons, which insert items relatively, if multi-\/selection is on\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* multi-selection callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_multi\_change(\textcolor{keywordtype}{void}        *data,
              Evas\_Object *obj,
              \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;
   Eina\_Bool multi = elm_check_state_get(obj);

   elm_gengrid_multi_select_set(grid, multi);

   fprintf(stdout, \textcolor{stringliteral}{"Multi-selection for gengrid is now %s\(\backslash\)n"},
           multi ? \textcolor{stringliteral}{"on"} : \textcolor{stringliteral}{"off"});

   elm_object_disabled_set(before\_bt, multi);
   elm_object_disabled_set(after\_bt, multi);

   \textcolor{keywordflow}{if} (!multi)
     \{
        Elm_Object_Item *gg\_it;
        \textcolor{keyword}{const} Eina\_List *selected = elm_gengrid_selected_items_get(grid), *l;
        EINA\_LIST\_FOREACH(selected, l, gg\_it)
           elm_gengrid_item_selected_set(gg\_it, EINA\_FALSE);
     \}

\end{DoxyCodeInclude}


Note that we also {\bfseries unselect} all items in the grid, when returning from multi-\/selection mode, making use of \hyperlink{group__Gengrid_ga2168120297a08d2847d4740faeb77543}{elm\-\_\-gengrid\-\_\-item\-\_\-selected\-\_\-set()}.

The second check acting on selection, \char`\"{}\-No selection\char`\"{}, is just what its name depicts -- no selection will be allowed anymore, on the grid, while it's on. Check it out for yourself, interacting with the program\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* no selection callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_no\_sel\_change(\textcolor{keywordtype}{void}        *data,
               Evas\_Object *obj,
               \textcolor{keywordtype}{void}        *event\_info)
\{
   Evas\_Object *grid = data;
   Eina\_Bool no\_sel = elm_check_state_get(obj);

   \textcolor{keywordflow}{if} (no\_sel)
     elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_NONE);
   \textcolor{keywordflow}{else}
     elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_DEFAULT);

   fprintf(stdout, \textcolor{stringliteral}{"Selection for gengrid items is now %s\(\backslash\)n"},
           no\_sel ? \textcolor{stringliteral}{"disabled"} : \textcolor{stringliteral}{"enabled"});
\}

\end{DoxyCodeInclude}


We have, finally, one more line of knobs, now sliders, to change the grids behavior. The two first will change the horizontal {\bfseries alignment} of the whole actual grid of items within the gengrid's viewport\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* items grid horizontal alignment change */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_h\_align\_change\_cb(\textcolor{keywordtype}{void}        *data,
                   Evas\_Object *obj,
                   \textcolor{keywordtype}{void}        *event\_info)
\{
   \textcolor{keywordtype}{double} v\_align;
   \textcolor{keywordtype}{double} val = elm_slider_value_get(obj);

   elm_gengrid_align_get(data, NULL, &v\_align);

   fprintf(stdout, \textcolor{stringliteral}{"Setting horizontal alignment to %f\(\backslash\)n"}, val);
   elm_gengrid_align_set(data, val, v\_align);
\}

\end{DoxyCodeInclude}


Naturally, the vertical counterpart just issues \hyperlink{group__Gengrid_ga71a6b19f6b63c8c3be493b8450455e5f}{elm\-\_\-gengrid\-\_\-align\-\_\-set()} changing the second alignment component, instead.

The last slider will change the grid's {\bfseries page size}, relative to its own one. Try to change those values and, one manner of observing the paging behavior, is to scroll softly and release the mouse button, with different page sizes, at different grid positions, while having lots of items in it -- you'll see it snapping to page boundaries differenty, for each configuration\-:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* page relative size change */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_page\_change\_cb(\textcolor{keywordtype}{void}        *data,
                Evas\_Object *obj,
                \textcolor{keywordtype}{void}        *event\_info)
\{
   \textcolor{keywordtype}{double} val = elm_slider_value_get(obj);

   elm_scroller_page_relative_set(data, val, val);

   fprintf(stdout, \textcolor{stringliteral}{"Setting grid page's relative size to %f\(\backslash\)n"}, val);
\}

\end{DoxyCodeInclude}


This is how the example program's window looks like\-:  
\begin{DoxyImage}
\includegraphics{screenshots/gengrid_example}
\caption{width=}
\end{DoxyImage}


Note that it starts with three items which we included at will\-:  
\begin{DoxyCodeInclude}
   \_append\_bt\_clicked(grid, NULL, NULL);
   \_append\_bt\_clicked(grid, NULL, NULL);
   \_append\_bt\_clicked(grid, NULL, NULL);

\end{DoxyCodeInclude}


See the full \hyperlink{gengrid_example_c}{source code} for this example. 