Languages

Menu
Sites
Language
Clickable box (or make click area bigger)

I have label and radio components in box. Radio click area is very small. I was wondering if I can make entire box handle click area ("clicked" and "selected" callbacks doesnt seem to work) or i I can make click area of radio bigger?

Responses

2 Replies
Yasin Ali

Hi~,
You may try with this code for your current problem.

static void
my_box_pack(Evas_Object *box, Evas_Object *child,
            double h_weight, double v_weight, double h_align, double v_align)
{
   /* create a frame we shall use as padding around the child widget */
   Evas_Object *frame = elm_panel_add(box);
   /* use the medium padding style. there is "pad_small", "pad_medium",
    * "pad_large" and "pad_huge" available as styles in addition to the
    * "default" frame style */
   elm_object_style_set(frame, "pad_medium");
   /* set the input weight/aling on the frame insted of the child */
   evas_object_size_hint_weight_set(frame, h_weight, v_weight);
   evas_object_size_hint_align_set(frame, h_align, v_align);
     {
        /* tell the child that is packed into the frame to be able to expand */
        evas_object_size_hint_weight_set(child, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        /* fill the expanded area (above) as opposaed to center in it */
        evas_object_size_hint_align_set(child, EVAS_HINT_FILL, EVAS_HINT_FILL);
        /* actually put the child in the frame and show it */
        evas_object_show(child);
        elm_object_content_set(frame, child);
     }
   /* put the frame into the box instead of the child directly */
   elm_box_pack_end(box, frame);
   /* show the frame */
   evas_object_show(frame);
}

static void
create_base_gui(appdata_s *ad)
{
    /* set up policy to exit when last window is closed */
 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
 /* Window */
 ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
 elm_win_autodel_set(ad->win, EINA_TRUE);

 int rots[4] = { 0, 90, 180, 270 };
 elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);

 eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);

    /* Conformant */
    ad->conform = elm_conformant_add(ad->win);
    elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
    elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
    evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_win_resize_object_add(ad->win, ad->conform);
    evas_object_show(ad->conform);

    {
        /* child object - indent to how relationship */
        /* A box to put things in verticallly - default mode for box */
        Evas_Object *box = elm_box_add(ad->win);
        evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        elm_object_content_set(ad->conform, box);
        evas_object_show(box);

        {
            /* Label*/
            ad->label = elm_label_add(ad->conform);
            elm_object_text_set(ad->label, "     Label Info: Select Radio");
            my_box_pack(box, ad->label, 1.0, 0.0, -1.0, 0.5);

            Evas_Object *radio, *radio_group;

            /* radio 1-1 */
            radio = elm_radio_add(ad->conform);
            elm_object_text_set(radio, "Cat");
            elm_radio_state_value_set(radio, 1);
            radio_group = radio;
            evas_object_smart_callback_add(radio, "changed", radio_animal_cb, ad);
            my_box_pack(box, radio, 1.0, 1.0, -1.0, -1.0);

            /* radio 1-2 */
            radio = elm_radio_add(ad->conform);
            elm_object_text_set(radio, "Dog");
            elm_radio_state_value_set(radio, 2);
            evas_object_smart_callback_add(radio, "changed", radio_animal_cb, ad);
            elm_radio_group_add(radio, radio_group);
            my_box_pack(box, radio, 1.0, 1.0, -1.0, -1.0);

            /* radio 1-3 */
            radio = elm_radio_add(ad->conform);
            elm_object_text_set(radio, "Hamster");
            elm_radio_state_value_set(radio, 3);
            evas_object_smart_callback_add(radio, "changed", radio_animal_cb, ad);
            elm_radio_group_add(radio, radio_group);
            my_box_pack(box, radio, 1.0, 1.0, -1.0, -1.0);

            /* Set selection to 2nd radio */
            elm_radio_value_set(radio_group, 1);
        }
    }

    /* Show window after base gui is set up */
    evas_object_show(ad->win);
}

Hope it will work.
If you find my post is helpful for you, please mark it as the Best Answer to promote this post to others.

Yasin Ali

Have you solved ?