2010/4/13 ychouchane <frechdes...@gmail.com>:
> Hello,
> i m tring to make this :
>
> i want make a windows with little img following the mouse.
>
> for the moment i make this code :
>
> #include <Ecore.h>
> #include <Ecore_Evas.h>
>
> Evas_Object * zozor (Evas *evas,int move1,int move2)
> {
>
> Evas_Object *o;
> int iw, ih;
> o = evas_object_image_add (evas);
> evas_object_image_file_set (o, "zozor_transparent.png", NULL);
> evas_object_image_size_get(o, &iw, &ih);
> evas_object_image_size_set(o, iw, ih);
> evas_object_image_fill_set(o, 0, 0, iw, ih);
> evas_object_resize (o, iw, ih);
> evas_object_move (o, move1, move2);
> evas_object_show (o);
> return o;
> }
>
>
> void cb_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
> {
>        Evas_Event_Mouse_Move *event; // déclaration d'un évenement
>        event = (Evas_Event_Mouse_Move *)event_info; //initialisation de
> la variable sur l'évenemnt produit par la souris
>        printf("touche pressée: %d en coordonnée (%d,%d)\n",
> event->buttons,event->cur.output.x,event->cur.output.y );// Affiche la
> touche préssé
>
>
>       zozor (e, event->cur.output.x,event->cur.output.y);// affiche un
> nouveau Zozor à l'applacemet du clique
> }
>
>
> int
> main (int argc, char *argv[])
> {
>        Ecore_Evas  *ecran;//Déclaration de variable ecran, qui vas
> contenir nos images et autres ...
>        Evas        *evas; //Conteneur d'objet
>        Evas_Object *surface_01; //Surface que l'on vas coloriser
>       int iw,ih;
>
>        if (  ecore_evas_init () == -1) // Démarrage des EFL. Si erreur
> alors...
>                {
>                        printf( "Erreur d'initialisation des EFL "); //
> Ecriture de l'erreur
>                        exit(EXIT_FAILURE); // On quitte le programme
>                }
>
> //NOTRE FENETRE VIDE
>        ecran = ecore_evas_new ("software_x11", 0, 0, 800, 600,
> NULL); //On paramétre notre écran
>        if (!ecran) // si probléme sur le driveur pour les EFL
>        {
>                ecore_evas_shutdown (); // Arrêt des EFL
>                return EXIT_FAILURE; // On quitte le programme
>        }
>        ecore_evas_title_set(ecran, "Chargement d'images en
> Enlightenment !");
>        ecore_evas_show (ecran);// On affiche notre écran
>        evas = ecore_evas_get (ecran);// conteneur qui prend notre écran
>
> //Notre surface qui vas contenir l'image
>        surface_01 = evas_object_image_add (evas);
>        evas_object_image_file_set (surface_01, "lac_en_montagne.jpg",
> NULL);
>        evas_object_image_size_get(surface_01, &iw, &ih);
>        evas_object_image_size_set(surface_01, iw, ih);
>        evas_object_image_fill_set(surface_01, 0, 0, iw, ih);
>        evas_object_resize (surface_01, iw, ih);
>        evas_object_move (surface_01, 0, 0);
>        evas_object_show (surface_01);
>
>        evas_object_focus_set(surface_01 , 1);
>        evas_object_event_callback_add(surface_01,
> EVAS_CALLBACK_MOUSE_MOVE, cb_down, NULL);
>
>
> //Fin du programme
>        ecore_main_loop_begin();//notre bocle qui attend l'appuie sur la
> croix pour terminer le programme
>        ecore_evas_shutdown ();  // Arrêt des EFL (libération de la
> mémoire).
>
>        return EXIT_SUCCESS;
>  }
>
>
> but with this code i create a new evas object zozor every time i move my
> mouse.
>
> but if on my main, i create a new Evas object zozor, and i get focus on
> it, i can't move my evas_object zozor, so someon can explain me how
> focus object and make action on object not focus ?

The right way to go is to create the zozor object in the main and then
use evas_object_move(zozor, x, y)
in the mouse_move callback. This must work without touching the focus
stuff, evas_objects don't need
to be focused to be moved.

Hope this can help...and please don't post stuff in your language, It
require me to use a french dictionary to read your mail ;)

Dave




>
> Thanks
>
>
>
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to