Hi

I have a problem with an elementary list which is defined in an edje file.
When I want to add a new item to the list, it is not displayed in the
control, but the itemcount of the list is changed.
When I do generate the list with the elementary api, it works.

Non working ejde + elementary List example: edjelist.c & edjelist.edc
Working elementary example: elmlist.c

Compiling both with: gcc $FILENAME `pkg-config --cflags --libs eina ecore
ecore-evas evas elementary edje`

Am I doing something wrong or is there a bug in edje or elementary?

I am running enlightenment the svn revision 56722 on gentoo amd64.

Thanks for the help

Andreas
#include <Eina.h>
#include <Evas.h>
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Edje.h>
#include <Elementary.h>

#define WIDTH 320
#define HEIGHT 240


int main(int argc, char *argv[])
{
	Evas_Object *window;
	Evas_Object* lstHeader;
	Evas_Object* bg;

	int count;
	const Eina_List* list;

	elm_init(argc, argv);

	window = elm_win_add(NULL, "", 0);
	if (!window)
	{
		EINA_LOG_CRIT("could not create window.");
		return -1;
	}

	bg = elm_bg_add(window);
	
	elm_win_resize_object_add(window, bg);

	evas_object_show(bg);

	lstHeader = elm_list_add(window);
	elm_win_resize_object_add(window, lstHeader);

	elm_list_go(lstHeader);
	elm_list_item_append(lstHeader, "Test", NULL, NULL, NULL, NULL);

	list = elm_list_items_get(lstHeader);
	count = eina_list_count(list);

	fprintf(stdout, "Count: %d", count);
	fflush(stdout);

	evas_object_show(lstHeader);
	evas_object_show(window);

	evas_object_resize(window, 320, 240);

	elm_run();
	
	elm_shutdown();
	
	return 0;
}

#include <Eina.h>
#include <Evas.h>
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Edje.h>
#include <Elementary.h>

#define WIDTH 320
#define HEIGHT 240

static Evas_Object *create_my_group(Evas *canvas)
{
	Evas_Object *edje;

	/* create the edje object where we'll load our file */
	edje = edje_object_add(canvas);
	if (!edje)
	{
		EINA_LOG_CRIT("could not create edje object!");
		return NULL;
	}

	/* load our desired file */
	if (!edje_object_file_set(edje, "edjelist.edj", "main"))
	{
		int err = edje_object_load_error_get(edje);
		const char *errmsg = edje_load_error_str(err);
		EINA_LOG_ERR("could not load 'my_group' from edje_example.edj: %s",
		errmsg);

		evas_object_del(edje);
		return NULL;
	}

	/* operate on edje as any other object */
	evas_object_move(edje, 0, 0);
	evas_object_resize(edje, WIDTH, HEIGHT);
	evas_object_show(edje);
	return edje;
}

int main(int argc, char *argv[])
{
	Ecore_Evas *window;
	Evas *canvas;
	Evas_Object *edje;
	Evas_Object* lstHeader;
	int count;
	const Eina_List* list;

	eina_init();
	evas_init();
	ecore_init();
	ecore_evas_init();
	edje_init();

	window = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
	if (!window)
	{
		EINA_LOG_CRIT("could not create window.");
		return -1;
	}
	canvas = ecore_evas_get(window);

	edje = create_my_group(canvas);
	if (!edje)
		return -2;

	lstHeader = edje_object_part_external_object_get(edje, "lstHeader");
	elm_list_go(lstHeader);
	elm_list_item_append(lstHeader, "Test", NULL, NULL, NULL, NULL);

	list = elm_list_items_get(lstHeader);
	count = eina_list_count(list);

	fprintf(stdout, "Count: %d", count);
	fflush(stdout);
	

	ecore_evas_show(window);
	ecore_main_loop_begin();

	evas_object_del(edje);
	ecore_evas_free(window);

	return 0;
}

Attachment: edjelist.edc
Description: Binary data

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to