Languages

Menu
Sites
Language
Rotary Selector Native app Gear s2

Dear community,

i'm fully noob,but i have a big desire to become good tizen developer.

So, I have problems with something, i want create Rotary Selector for my app, and i use this manual https://developer.tizen.org/development/ui-practices/native-application/efl/ui-components/wearable-ui-components/rotary-selector#add .
Unfortunately my sdk give me few mistakes:
1.Multiple markers at this line
    - each undeclared identifier is reported only once for each function it 
     appears in
    - 'selector' undeclared (first use in this function)

2.passing argument 1 of 'eext_rotary_selector_item_part_color_set' from incompatible pointer type [enabled by default]

excerpt of "my code" 

<!--break-->

/* Label */

    ad->label = elm_label_add(ad->conform);
    elm_object_text_set(ad->label, "<b><align=center>Per aspera ad astra</align></b>");
    evas_object_size_hint_weight_set(ad->label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_object_content_set(ad->conform, ad->label);

    /*TeST*/

    Evas_Object *rotary_selector, *parent;

    rotary_selector = eext_rotary_selector_add(parent);
    eext_rotary_object_event_activated_set(rotary_selector, EINA_TRUE);
    eext_rotary_selector_part_color_set(selector, "selector,bg_image",
                                        EEXT_ROTARY_SELECTOR_SELECTOR_STATE_NORMAL,
                                        100, 100, 100, 255);
    
    eext_rotary_selector_item_part_color_set(item, "item,icon",
                                             EEXT_ROTARY_SELECTOR_ITEM_STATE_NORMAL,
                                             100, 100, 100, 255);
    
    

}

<!--break-->

This code i wrote in 

static void
create_base_gui(appdata_s *ad)
{

 

PLEASE HELP ME understand my problem or show me correct code to create rotary selector;

Thank you.

Edited by: Volodymyr Stetsyshyn on 17 Jan, 2016

Responses

2 Replies
Hermet Park

It looks the documentation linked by you, is a little unkind of users.

It could be embrassed when the "selector" is described there, all of sudden, but it looked it's intended to "rotary_selector" instead or "selector".

Secondly, passing argument 1 of 'eext_rotary_selector_item_part_color_set' from incompatible pointer type [enabled by default]

This api requires an Eext_Object_Item type for first argument but i have no idea what you passed there. I can't figure it where the "item" comes from" out with your snippet code. But obviously, it's type might not be Eext_Object_Item in your code. I hope you could check the first argument data type first.


 

Volodymyr Stetsyshyn

Dear Hermet Park,
Thank you for your response. I am honestly grateful for your help,i progressed, but it's not all.

This sreenshot that i done.

imageup . ru / img119 / 2341449 / selector . jpg
First problem is that this two circle without image, all my images are in folder /res, why i have empty circles?what wrong with is?

Second problem is the following: when i "run -debug", it opens in emulator gear s2 and all work. But after restarting application inside the clock emulator it don't work(it shows black screen).
Third issue
In this documentation that i send you, i change "parent" to "ad->nf" in this code examples, and all this started working.Why?And i see in more code snipets this  parent. What is "parent"? For example:
 

Evas_Object *rotary_selector, *parent;

Rotary_selector = eext_rotary_selector_add(parent);

    when i used this it gives me: 
'parent' is used uninitialized in this function [-Wuninitialized]

but when i change, it works.

Evas_Object *rotary_selector

Rotary_selector = eext_rotary_selector_add(ad->nf);


This is my full code. (it works) 

#include "one.h"
typedef struct appdata {
    Evas_Object *nf;
	Evas_Object *win;
	Evas_Object *conform;
	Eext_Circle_Surface *circle_surface;
} appdata_s;
static void
win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
{
	ui_app_exit();
}

static void
win_back_cb(void *data, Evas_Object *obj, void *event_info)
{
	appdata_s *ad = data;
	/* Let window go to hide state. */
	elm_win_lower(ad->win);
}
static void
create_main_view(appdata_s *ad)
{

	   Evas_Object *rotary_selector;
	   rotary_selector = eext_rotary_selector_add(ad->nf);
	   eext_rotary_object_event_activated_set(rotary_selector, EINA_TRUE);

	   Eext_Object_Item * item, *item1;
	   Evas_Object *image, *image1;
/*First circle*/
	   // Append item
	   item = eext_rotary_selector_item_append(rotary_selector);
	   // Set item icon
	   image = elm_image_add(rotary_selector);
	   elm_image_file_set(image, "food27.png", NULL);

	   eext_rotary_selector_item_part_content_set(item, "item,icon",
	                                              EEXT_ROTARY_SELECTOR_ITEM_STATE_NORMAL, image);
	   // Set selector main text
	   eext_rotary_selector_item_part_text_set(item, "selector,main_text", "Options");

/*Second circle*/
	   // Append item
	   	   item1 = eext_rotary_selector_item_append(rotary_selector);
	   	   // Set item icon
	   	   image1 = elm_image_add(rotary_selector);
	   	   elm_image_file_set(image1, "food.png", NULL);

	   	   eext_rotary_selector_item_part_content_set(item1, "item1,icon",
	   	                                              EEXT_ROTARY_SELECTOR_ITEM_STATE_NORMAL, image1);
	   	   // Set selector main text
	   	   eext_rotary_selector_item_part_text_set(item1, "selector,main_text", "Options");
	// Callback funct1ion for the "item,clicked" signal
	// This callback is called when the item is clicked by the user
}

static void
create_base_gui(appdata_s *ad)
{
	/* Window */
	ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
	elm_win_autodel_set(ad->win, EINA_TRUE);

	if (elm_win_wm_rotation_supported_get(ad->win)) {
		int rots[4] = { 0, 90, 180, 270 };
		elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
	}

	evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
	eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);

	/* Conformant */
	ad->conform = elm_conformant_add(ad->win);
	elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
	elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
	evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_win_resize_object_add(ad->win, ad->conform);
	evas_object_show(ad->conform);

	/* Naviframe */
		ad->nf = elm_naviframe_add(ad->conform);
		create_main_view(ad);
		elm_object_content_set(ad->conform, ad->nf);
		eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);

		/* Add surface for circle object */
		ad->circle_surface = eext_circle_surface_naviframe_add(ad->nf);

	/* Show window after base gui is set up */
	evas_object_show(ad->win);
}

static bool
app_create(void *data)
{
	/* Hook to take necessary actions before main event loop starts
		Initialize UI resources and application's data
		If this function returns true, the main loop of application starts
		If this function returns false, the application is terminated */
	appdata_s *ad = data;

	create_base_gui(ad);

	return true;
}

static void
app_control(app_control_h app_control, void *data)
{
	/* Handle the launch request. */
}

static void
app_pause(void *data)
{
	/* Take necessary actions when application becomes invisible. */
}

static void
app_resume(void *data)
{
	/* Take necessary actions when application becomes visible. */
}

static void
app_terminate(void *data)
{
	/* Release all resources. */
}

static void
ui_app_lang_changed(app_event_info_h event_info, void *user_data)
{
	/*APP_EVENT_LANGUAGE_CHANGED*/
	char *locale = NULL;
	system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
	elm_language_set(locale);
	free(locale);
	return;
}

static void
ui_app_orient_changed(app_event_info_h event_info, void *user_data)
{
	/*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
	return;
}

static void
ui_app_region_changed(app_event_info_h event_info, void *user_data)
{
	/*APP_EVENT_REGION_FORMAT_CHANGED*/
}

static void
ui_app_low_battery(app_event_info_h event_info, void *user_data)
{
	/*APP_EVENT_LOW_BATTERY*/
}

static void
ui_app_low_memory(app_event_info_h event_info, void *user_data)
{
	/*APP_EVENT_LOW_MEMORY*/
}

int
main(int argc, char *argv[])
{
	appdata_s ad = {0,};
	int ret = 0;

	ui_app_lifecycle_callback_s event_callback = {0,};
	app_event_handler_h handlers[5] = {NULL, };

	event_callback.create = app_create;
	event_callback.terminate = app_terminate;
	event_callback.pause = app_pause;
	event_callback.resume = app_resume;
	event_callback.app_control = app_control;

	ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
	ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
	ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
	ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
	ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
	ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);

	ret = ui_app_main(argc, argv, &event_callback, &ad);
	if (ret != APP_ERROR_NONE) {
		dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
	}

	return ret;
}