Adding custom field widgets to SchevoGtk

0 views
Skip to first unread message

Matthew Scott

unread,
Jul 1, 2009, 4:27:40 PM7/1/09
to sch...@googlegroups.com
While there's no howto or open source example I can give, here's a summary of how the pieces fit together.

In the schevogtk2.window.BaseWindow class, there are get_value_handlers and set_field_handlers attributes.  They are both lists that contain functions that are called, in the order they appear in the list, to work with widgets that appear for forms that show fields for entities or transactions.

Each get_value_handlers function accepts a widget, then determines if the widget is something it knows how to get a value from.
If it knows how to get the value from it, it will grab the value from the widget and return a structure containing that value and an indicator to not continue.
If it does not know, then the next function will be called.

Each set_field_handlers function accepts a number of arguments, including the database field from which a widget is to be constructed.
If it knows how to construct a widget from the field, it will do so, and return the widget and an indicator to not continue.
If it does not know, then the next function will be called.

For a custom widget, what you'll want to do is define an appropriate get_value_handler and set_field_handler, and then insert those into the beginning of the lists.

I wish I had a more complete example, but SchevoGtk uses this protocol itself for the widgets included out of the box, so you can at least see several implementations of those handler functions.

I hope this helps!



On Thu, Jun 25, 2009 at 06:57, erob <robillar...@gmail.com> wrote:
On another story, I have a question for Schevo/SchevoGtk2 developers.
I'd like
adding some new widgets in SchevoGtk2. Would you like to explain
briefly how
to add things like radio-buttons, etc ?



--
Matthew R. Scott

Etienne Robillard

unread,
Jul 12, 2009, 1:08:56 PM7/12/09
to sch...@googlegroups.com
Thanks for putting all this info up, Matthew.

I have not much time right now to study it deeply but it's on
my todo list anyway. Also, I'll probably start by writing a generic
test case to help assimilating thoses concepts.

Best regards,
Etienne
--
Etienne Robillard <robillar...@gmail.com>
Green Tea Hackers Club <http://gthc.org/>
Blog: <http://gthc.org/blog/>
PGP Fingerprint: AED6 B33B B41D 5F4F A92A 2B71 874C FB27 F3A9 BDCC
Reply all
Reply to author
Forward
0 new messages