Re: Compile error when trying to read background color property for a text tag



On Apr 2, 2005 1:20 PM, Hamar Gabor <hg307 hszk bme hu> wrote:
> Hello,
> 
> You can try this:
> color = Glib::RefPtr<const Gtk::TextTag>::cast_static(tag_word)->
>    property_background().get_value();

Thank you Gabor,
I made the above change, and the code compiles fine, but now I get a
error at runtime,

(error:3412): GLib-GObject-WARNING **: IA__g_object_get_property:
property `background' of object class `GtkTextTag' is not readable

I am sure there is a fairly straightforward way to read a property
value, but am just unable to find it.

In the header file <gtkmm/texttag.h> property_background() appears to
be overloaded based on the return type. Can this be done in C++? My
guess is that the compiler sees only the function which returns a
WriteOnly PropertyProxy.

Regards,
Rajkiran

--Original message--
On Apr 2, 2005 6:44 AM, Raj Kiran Grandhi <grkiran gmail com> wrote:
> Hi,
> 
> Is there a way to get the value of the background color property for a
> text tag? The following code I use fails to compile:
> 
> Gtk::TextView p_TextView;
> Glib::RefPtr<Gtk::TextTag> tag_word;
> tag_word = p_TextView.get_buffer()->create_tag("tag-word");
> Glib::ustring color;
> color = tag_word->property_background().get_value();
> 
> However I get the following error during compiling:
> 
> word_view.cpp: In member function `void WordView::set_visible(int)':
> word_view.cpp:268: error: `get_value' undeclared (first use this function)
> word_view.cpp:268: error: (Each undeclared identifier is reported only
> once for    each function it appears in.)
> make: *** [word_view.o] Error 1
> 
> However in the doxygen generated docs, the member function get_value is
> defined for Glib::PropertyProxy_ReadOnly<T>
> 
> Has anyone else faced this problem? Please help me out.
> Regards,
> Rajkiran
>



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