Carsten Haitzler wrote:
> On Tue, 15 Sep 2009 01:53:24 +0200 Marco Trevisan (Treviño) <m...@3v1n0.net>
> said:

Sorry for the late reply, but my computer is near to die and university
takes me much time (so thanks also for committing the other patches)...

> ok... hmmm... 1. i dont see any issue with focus and entires and illume. the
> kbd comes up when u click an entry - it stays up when u focus more than 1
> entry (ie click on another entry if one entry is already focused) and it goes
> down when u focus something that doesnt take input (eg a button). so it works.

Well, that works. I wasn't talking about changing the focus when
clicking over an entry, but when changing the focus from the sources
using elm_object_focus.

> well for me it does here. u'll have to explain what doesnt work for you a bit
> more in detail. 2. the on_focus func is called when an object is focused AND
> unfocused. see _on_focus_hook() in elm_entry - put in printfs. that is
> literally called  in both situations and the:
> 
>    if (elm_widget_focus_get(obj))
> 
> is there to figure out which.

Yeah. I know, in my tests before doing this patch I noticed this, but
the real problem was that the focus hook function for each entry doesn't
seem to be called when unfocusing it using the elm_object_focus
function. I don't know why, but at a certain point the loop over the
subwidgets stops and the unfocus is not called for the entry.

This is why I've forced it with this patch.

However to get better what is the issue that I meant, I've written a
simple example that is attached here.

If you run it with a standard elementary build, the unfocus action is
not performed when using the apposite button to switch the focused entry
(and there are also issues with the input, that is not always switched -
so it isn't just a theme issue).

Applying my patch (the 2nd one), instead the example works as expected
and I don't see neither theme or input issues.

Bye


PS: the 2nd patch should care about the entry window, but I recognize
that there's a not so clean implementation due to the static variable.
#include <Elementary.h>

Evas_Object *focused[4];
Evas_Object *win, *bg, *bx, *sc, *en, *bt, *lb;

static void entry_click_cb(void *data, Evas_Object *obj, void *event_info) {
	static Eina_Bool set = FALSE;

	if (!set) {
		elm_entry_entry_set(obj, "Now use the button below to switch the focus!");
		elm_object_disabled_set(bt, FALSE);
		set = TRUE;
	}
}

static void swbt_click_cb(void *data, Evas_Object *obj, void *event_info) {
	static int i = 1;

	if (!lb) {
		lb = elm_label_add(win);
		elm_label_label_set(lb, "Many entries with cursor - Buggy, isn't it?!?"
		                        "<br>The _on_focus_hook function is not called when unfocusing...");
		evas_object_show(lb);
		elm_box_pack_end(bx, lb);
	}

	elm_object_focus(focused[i]);
	elm_object_disabled_set(focused[i], FALSE);
	i = (i+1) % 4;
}

EAPI int elm_main(int argc, char **argv) {

	win = elm_win_add(NULL, "entry-scrolled", ELM_WIN_BASIC);
	elm_win_title_set(win, "Entry Scrolled");
	elm_win_autodel_set(win, 1);

	bg = elm_bg_add(win);
	elm_win_resize_object_add(win, bg);
	evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_show(bg);

	bx = elm_box_add(win);
	elm_box_homogenous_set(bx, TRUE);
	evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_win_resize_object_add(win, bx);
	evas_object_show(bx);

	sc = elm_scroller_add(win);
	elm_scroller_content_min_limit(sc, 0, 1);
	elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
	elm_scroller_bounce_set(sc, 0, 0);
	evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, 0.0);
	evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_box_pack_end(bx, sc);

	focused[0] = en = elm_entry_add(win);
	elm_entry_single_line_set(en, TRUE);
	elm_entry_entry_set(en, "Click Over me!");
	evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
	evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
	elm_scroller_content_set(sc, en);
	evas_object_smart_callback_add(en, "cursor,changed", entry_click_cb, NULL);
	evas_object_show(en);

	evas_object_show(sc);

	sc = elm_scroller_add(win);
	elm_scroller_content_min_limit(sc, 0, 1);
	elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
	elm_scroller_bounce_set(sc, 0, 0);
	evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, 0.0);
	evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_box_pack_end(bx, sc);

	focused[1] = en = elm_entry_add(win);
	elm_entry_single_line_set(en, TRUE);
	elm_entry_entry_set(en, "Another entry");
	evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
	evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
	elm_object_disabled_set(en, TRUE);
	elm_scroller_content_set(sc, en);
	evas_object_show(en);

	evas_object_show(sc);

	sc = elm_scroller_add(win);
	elm_scroller_content_min_limit(sc, 0, 1);
	elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
	elm_scroller_bounce_set(sc, 0, 0);
	evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, 0.0);
	evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_box_pack_end(bx, sc);

	focused[2] = en = elm_entry_add(win);
	elm_entry_single_line_set(en, TRUE);
	elm_entry_entry_set(en, "Last entry");
	evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
	evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
	elm_object_disabled_set(en, TRUE);
	elm_scroller_content_set(sc, en);
	evas_object_show(en);

	evas_object_show(sc);

	focused[3] = bt = elm_button_add(win);
	elm_button_label_set(bt, "Switch Focus");
	elm_box_pack_end(bx, bt);
	evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
	evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_smart_callback_add(bt, "clicked", swbt_click_cb, NULL);
	elm_object_disabled_set(bt, TRUE);
	evas_object_show(bt);

	evas_object_show(win);
	evas_object_resize(win, 350, 250);

	elm_run();
	elm_shutdown();
}

ELM_MAIN();
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to