2011/9/15 Paulo Benatto <bena...@gmail.com>

> Hi,
>
> I did a simple example of my problem. When the focus is in the Button,
> every
> Key has _UP and _DOWN events... but, when the focus is in my Entry, I
> receive only _UP events. Try to compile and run the code below. I would
> like
> to receive _UP and _DOWN in my _input_event_cb independently where is the
> focus.
>
> Thanks
>
> ===============================================================
> /*
>  * to compile and run use: gcc test.c -o test `pkg-config --cflags --libs
> elementary` && ./test
> */
>
> #include <Elementary.h>
>
> static Eina_Bool
> _input_event_cb(void *data, Evas_Object *obj, Evas_Object *src,
> Evas_Callback_Type type,
>                void *event_info)
> {
>    printf("_input_event_cb: ");
>    if (type == EVAS_CALLBACK_KEY_DOWN) {
>        printf("EVAS_CALLBACK_KEY_DOWN");
>    } else if (type == EVAS_CALLBACK_KEY_UP) {
>        printf("EVAS_CALLBACK_KEY_UP");
>    } else {
>        printf("...");
>    }
>    printf("\n");
> }
>
> EAPI int
> elm_main(int argc, char **argv)
> {
>    Evas_Object *win, *entry, *button;
>
>    win = elm_win_add(NULL, "tip05-gui", ELM_WIN_BASIC);
>    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
>    elm_win_autodel_set(win, EINA_TRUE);
>    elm_object_event_callback_add(win, _input_event_cb, NULL);
>    evas_object_size_hint_min_set(win, 300, 300);
>    evas_object_show(win);
>
>    entry = elm_scrolled_entry_add(win);
>    elm_scrolled_entry_single_line_set(entry, EINA_TRUE);
>    evas_object_resize(entry, 200, 30);
>    evas_object_show(entry);
>    elm_scrolled_entry_entry_set(entry, "123ab456");
>    elm_object_focus(entry);
>
>    button = elm_button_add(win);
>    evas_object_resize(button, 50, 50);
>    evas_object_move(button, 50, 100);
>    evas_object_show(button);
>
>    elm_run();
>    elm_shutdown();
>
>    return 0;
> }
> ELM_MAIN()
>
> =======================================================
>
> 2011/9/14 michael bouchaud <michael.bouch...@gmail.com>
>
> > 2011/9/14 Paulo Benatto <bena...@gmail.com>
> >
> > > 2011/9/14 michael bouchaud <michael.bouch...@gmail.com>
> > >
> > > > 2011/9/14 Paulo Benatto <bena...@gmail.com>
> > > >
> > > > > I would like to do that, because my Entry Object has the focus and
> > all
> > > > > events will go to it... I would like to handle only numbers in my
> > Entry
> > > > >
> > > >
> > > > use elm_entry_filter to filter all character not wanted in the entry
> > > >
> > >
> > > I'm doing that, only numbers .. here is Ok!
> > >
> > >
> > > >
> > > > > Object, others keys I would like to handle in my Window, how can I
> do
> > > > that?
> > > > > Did you understand my problem? =)
> > > > >
> > > >
> > > > for other keys use ecore_event_handler(ECORE_EVENT_KEY_DOWN,
> _my_func,
> > > > _my_data);
> > > >
> > >
> > > When the focus is in Entry Object only ECORE_EVENT_KEY_UP event arrives
> > in
> > > the Window. It depends which key, for example, when I press arrow keys
> > any
> > > events is received in the Window.
> > >
> > >
> > > >
> > > >
> > > > >
> > > > > thanks
> > > > >
> > > > >
> > > > You don't need to resend any events to the window. You already catch
> > them
> > > > with ECORE_EVENT_KEY_DOWN ...
> > > >
> > > >
> > > > >
> > > > 2011/9/14 michael bouchaud <michael.bouch...@gmail.com>
> > > > >
> > > > > > 2011/9/14 Paulo Benatto <bena...@gmail.com>
> > > > > >
> > > > > > > Hi List,
> > > > > > >
> > > > > > > I would like a little help with Scrolled_Entry Object and
> Events
> > > > > Handler.
> > > > > > >
> > > > > > > I have a Window and inside of it I have an Scrolled_Entry
> Object,
> > > My
> > > > > > focus
> > > > > > > is in Scrolled_Entry, I would like Scrolled_Entry handled only
> > > > numbers,
> > > > > > the
> > > > > > > others keys, should be handled by my Window. I want to know how
> > can
> > > I
> > > > > > > resend
> > > > > > > events to my window?
> > > > > > >
> > > > > > > Thanks
> > > > > > >
> > > > > > > --
> > > > > > > Paulo Leonardo Benatto, patito
> > > > > > > "the fear of being free, makes you proud of being a slave"
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > > > > BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
> > > > > > > Learn about the latest advances in developing for the
> > > > > > > BlackBerry&reg; mobile platform with sessions, labs & more.
> > > > > > > See new tools and technologies. Register for BlackBerry&reg;
> > DevCon
> > > > > > today!
> > > > > > > http://p.sf.net/sfu/rim-devcon-copy1
> > > > > > > _______________________________________________
> > > > > > > enlightenment-devel mailing list
> > > > > > > enlightenment-devel@lists.sourceforge.net
> > > > > > >
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> > > > > > >
> > > > > >
> > > > > > In first, elm_scrolled_entry is deprecated, please use elm_entry
> > and
> > > > > > elm_entry_scrollable_set. You can append some filter to this
> entry
> > > with
> > > > > > elm_entry_text_filter_append. The depecrated scrolled entry have
> > this
> > > > > > features too.
> > > > > > Why you want resend this event to the window ... I just want
> notice
> > > to
> > > > > you
> > > > > > this is a bad idea and useless :P. So, I asking you,why you want
> to
> > > do
> > > > > this
> > > > > > in this way ?
> > > > > >
> > > > > > --
> > > > > > Michaël Bouchaud
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > > > BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
> > > > > > Learn about the latest advances in developing for the
> > > > > > BlackBerry&reg; mobile platform with sessions, labs & more.
> > > > > > See new tools and technologies. Register for BlackBerry&reg;
> DevCon
> > > > > today!
> > > > > > http://p.sf.net/sfu/rim-devcon-copy1
> > > > > > _______________________________________________
> > > > > > enlightenment-devel mailing list
> > > > > > enlightenment-devel@lists.sourceforge.net
> > > > > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Paulo Leonardo Benatto, patito
> > > > > "the fear of being free, makes you proud of being a slave"
> > > > >
> > > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > > BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
> > > > > Learn about the latest advances in developing for the
> > > > > BlackBerry&reg; mobile platform with sessions, labs & more.
> > > > > See new tools and technologies. Register for BlackBerry&reg; DevCon
> > > > today!
> > > > > http://p.sf.net/sfu/rim-devcon-copy1
> > > > > _______________________________________________
> > > > > enlightenment-devel mailing list
> > > > > enlightenment-devel@lists.sourceforge.net
> > > > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Michaël Bouchaud
> > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
> > > > Learn about the latest advances in developing for the
> > > > BlackBerry&reg; mobile platform with sessions, labs & more.
> > > > See new tools and technologies. Register for BlackBerry&reg; DevCon
> > > today!
> > > > http://p.sf.net/sfu/rim-devcon-copy1
> > > > _______________________________________________
> > > > enlightenment-devel mailing list
> > > > enlightenment-devel@lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> > > >
> > >
> > >
> > >
> > > --
> > > Paulo Leonardo Benatto, patito
> > > "the fear of being free, makes you proud of being a slave"
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > > BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
> > > Learn about the latest advances in developing for the
> > > BlackBerry&reg; mobile platform with sessions, labs & more.
> > > See new tools and technologies. Register for BlackBerry&reg; DevCon
> > today!
> > > http://p.sf.net/sfu/rim-devcon-copy1
> > > _______________________________________________
> > > enlightenment-devel mailing list
> > > enlightenment-devel@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> > >
> >
> > Sorry I have made some tests, everything works for me with current svn
> > version. Every keys are catched by the event handler. Could you provide a
> > short exemple of your code.
> >
> > --
> > Michaël Bouchaud
> >
> >
> ------------------------------------------------------------------------------
> > BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
> > Learn about the latest advances in developing for the
> > BlackBerry&reg; mobile platform with sessions, labs & more.
> > See new tools and technologies. Register for BlackBerry&reg; DevCon
> today!
> > http://p.sf.net/sfu/rim-devcon-copy1
> > _______________________________________________
> > enlightenment-devel mailing list
> > enlightenment-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
>
>
>
> --
> Paulo Leonardo Benatto, patito
> "the fear of being free, makes you proud of being a slave"
>
> ------------------------------------------------------------------------------
> Doing More with Less: The Next Generation Virtual Desktop
> What are the key obstacles that have prevented many mid-market businesses
> from deploying virtual desktops?   How do next-generation virtual desktops
> provide companies an easier-to-deploy, easier-to-manage and more affordable
> virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>

Ok now I see the misunderstanding. Please see the attached file, I have made
a little change for your event handler. Don't use elm_object_callback_add,
in this case you need a more low level function. Use ecore_event_handler_add
and you will see your problem solved.

-- 
Michaël Bouchaud
#include <Elementary.h>

static Eina_Bool
_input_event_cb(void *data, int type, void *event)
{
   printf("_input_event_cb: ");
   if (type == ECORE_EVENT_KEY_DOWN) {
        printf("EVAS_CALLBACK_KEY_DOWN");
   } else if (type == ECORE_EVENT_KEY_UP) {
        printf("EVAS_CALLBACK_KEY_UP");
   } else {
        printf("...");
   }
   printf("\n");
}

EAPI int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *entry, *button;

   win = elm_win_add(NULL, "tip05-gui", ELM_WIN_BASIC);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   elm_win_autodel_set(win, EINA_TRUE);
   ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _input_event_cb, NULL);
   ecore_event_handler_add(ECORE_EVENT_KEY_UP, _input_event_cb, NULL);
   evas_object_size_hint_min_set(win, 300, 300);
   evas_object_show(win);

   entry = elm_scrolled_entry_add(win);
   elm_scrolled_entry_single_line_set(entry, EINA_TRUE);
   evas_object_resize(entry, 200, 30);
   evas_object_show(entry);
   elm_scrolled_entry_entry_set(entry, "123ab456");
   elm_object_focus(entry);

   button = elm_button_add(win);
   evas_object_resize(button, 150, 150);
   evas_object_move(button, 50, 100);
   evas_object_show(button);

   elm_run();
   elm_shutdown();

   return 0;
}
ELM_MAIN()
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to