Re: Database interaction

Quoting muppet <scott asofyet org>:

Of course, no such widget exists..

that sounds like a great opportunity for someone seeking gtk2-perl fame
and glory...  :-)

As it turns out, I've already written something like this for a database
project I'm working on.

It takes a "client" object that defines at least 3 methods:
  * user_col_count() -- returns the number of columns to be dealt with.
  * user_cols() -- returns a reference to an array of hashrefs describing
the columns.
  * user_col_value($col_name, $row_id) --  returns the value for $col_id
in row $row_id

The hashrefs returned by user_cols() need to have the following keys:
  * name -- the column name in the database.
  * type -- the type of the column, one of: integer, boolean, float, and
string.  This is used to display the right sort of editing widget (spin
button, check button, spin button, and entry, respectively).
  * label -- the label that should be displayed with the widget.

The widget inherits from Gtk2::Table, and creates a table with 4 columns
and as many rows as necessary.  The widgets are displayed with labels in
columns 1 and 3, and data widgets in columns 2 and 4.

Like I said, I've written this for a project I'm currently working on, so
it's not complete (ie, it can't store information back to the database
;o) but I'm still working on it.

Is this something that people would like to have in Gtk2-Perl?  If so, I'd
certainly be happy to maintain it.  I'm also not sure if it'd be useful
for the OP's problem, but it sounds like it's at least part of the way to
a solution :o)  I haven't attached it here, because I wasn't sure if that
was appropriate.  Let me know if you'd like to take a look!


And I say, Give me back my memory, or I'll rip you into three boy scouts
and a watchband!
                                           ---Aaron in "Remind Me Again"
Zach Bean, zb forty2 com, web forty2 com

This message was sent using IMP, the Internet Messaging Program.

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