언어 설정

Menu
Sites
Language
How do you implement EDC signal callbacks?

Im trying to change some text on the screen when an image is clicked. This is my image in the EDC file:

part { name: "image";
            type: IMAGE;
            description { state: "default" 0.0;
               max: 63 63;
               min: 63 63;
               image {
                  normal: "image.png";
               }
               rel1.relative: 1 1;
               rel2.relative: 0 0.0;
            }
            program
            {
               name: "imageClick";
               source: "image";
               signal: "mouse,clicked,*";
               action: SIGNAL_EMIT "imageClicked" "image";
            }
         }

Adding callback in code:

edje_object_signal_callback_add(ad->layout, "imageClicked" ,"image",imageClicked_cb, ad);

 

imageClicked_cb callback:

static void imageClicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
{
    appdata_s *ad = data;
    elm_object_part_text_set(ad->layout, "text", "Clicked");

}

edje_object_signal_callback_add is called inside create_base_gui and imageClicked_cb is declared outside any other functions.

I'm aware it's possible to change the text solely inside the EDC file however i'd like to know how to do it through c aswell.

 

Thanks in advance for any help provided

 

답변 바로가기

Responses

2 댓글
Mark as answer
Mango Bar

 Check following code

images {
   image:"tizen.png" COMP;
}

collections {

   group 
   { 

      name: "main";

      parts 
      {
         
         part 
         {
            name: "text";
            type:TEXT;
            description 
            {
               state: "default" 0.0;
               text
               {
                  text:"Hello Tizen";
                  size:25;
                  min:1 1;
                  align: 0.0 0.0;
                  
               }
               align: 0.0 1.0 ;
               color: 0 0 0 255;

            }
            
         }

         part 
         { 
            name: "image";
            type:IMAGE;

            description 
            { 
               state: "default" 0.0;
               max: 63 63;
               min: 63 63;

               image {
                  normal:"tizen.png";

               }

               rel1.relative: 1 1;
               rel2.relative: 0 0;               

            }

            program
            {
               name: "imageClick";
               source: "image";
               signal:"mouse,clicked,*";
               action: SIGNAL_EMIT "imageClicked" "image";
            }

         }
      }
   }
}

 

Use following callback  in application source code  

  elm_layout_signal_callback_add(ad->layout,"*","image",image_click_cb,ad);

image_click_cb callback


static void image_click_cb(void *data, Evas_Object *obj, void *event_info)
{
    appdata_s *ad = data;

    dlog_print(DLOG_INFO,"TAG","image_click_cb");

    elm_object_part_text_set(ad->layout,"text", "Clicked");
}

 

Khumalo

Thank you for your reply, the solution worked.

It seemed i was using

edje_object_signal_callback_add

instead of

 elm_layout_signal_callback_add

However, in the signal parameter of the: elm_layout_signal_callback_add, you have put "*", whereas it should be "imageClicked" because the text immediately changes to "clicked" if this isnt done.