Re: Parsing custom-typed properties from Glade file
- From: N <nicklas karlsson17 gmail com>
- To: Kjell Ahlstedt <kjellahlstedt gmail com>
- Cc: Kjell Ahlstedt via gtkmm-list <gtkmm-list gnome org>, Rodolfo Ribeiro Gomes <rodolforg gmail com>
- Subject: Re: Parsing custom-typed properties from Glade file
- Date: Wed, 22 Jul 2020 19:12:53 +0200
Enums are very useful for selection, combobox. I have selections and parse the number in the combox, this
does not feel ideal.
In C with switch(...) and correct warning turned on compiler flag a warning in case a value is forgotten, I
trick I often used to remember all cases but only work then enumerations are known at compile time. As a
bonus work get easier for computer with numbers instead of text strings.
As I only handle types known at compile time glade file should then correct done have these and only these
enumerations, an exact mapping. To check these agree is also an interesting problem.
Nicklas Karlsson
Is Type a custom enum? I have never tried to use such an enum in a glade
file, but I looked at what gtk does.
Their enums are registered with g_enum_register_static(). Each enum
value is specified with a GEnumValue, which contains a nickname. The
nickname is used in glade files. Example:
<property name="direction">none</property>
On 2020-07-22 07:00, Rodolfo Ribeiro Gomes via gtkmm-list wrote:
Hello, everyone.
I created a custom widget that has a Glib::Property of an enum type.
Glib::Property<Type> property_type_;
When I try to load from a glade file, I got this error message:
Gtk-WARNING **: 01:43:34.849: Failed to set property
gtkmm__CustomObject_widget_color_slider.type to 1: Could not parse '1'
as a glibmm__CustomBoxed_N6studio11ColorSlider4TypeE
Here is the xml property line:
<property name="type">1</property>
How can I properly parse the property tag contents ?
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]