Re: How to use specific methods with a generic widget pointer?



On Tue, Mar 17, 2009 at 11:40, Guillaume Brocker
<guillaume brocker digital-trainers com> wrote:
> Paulo Flabiano Smorigo a écrit :
>>
>> Hello,
>>
>> What can I do to solve the following error? I need to use a different
>> kind of pointer?
>>
>> The code:
>> Gtk::ToggleButton btnOK;
>> Gtk::Widget *ptrElement = NULL;
>>
>> ptrElement = &btnOK;
>>
>> ptrElement->set_active(true);
>>
>> The error:
>> error: ‘class Gtk::Widget’ has no member named ‘set_active’
>
> Gtk::Widget has no member ‘set_active’. This member is specific to
> Gtk::ToggleButton and derived classes. Wy don't you call ‘btnOK.set_active’
> directly ?
>
>> Thanks in advance,
>> Paulo Flabiano Smorigo
>
> Guillaume
>

Hi Guillaume,

Thanks for the fast reply...

I know that the Gtk::Widget don't have the set_active() member but as
it is pointing to a ToggleButton widget, isn't it possible to use the
method?

I there a someway to make the pointer accept the method?

Thanks...
Paulo Flabiano Smorigo


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]