Help with CellRendererPopup
- From: Daniel Kasak <dkasak nusconsulting com au>
- To: Gtk-Perl-List <gtk-perl-list gnome org>
- Subject: Help with CellRendererPopup
- Date: Mon, 12 Jul 2004 09:01:41 +1000
Hi all.
I've been trying in vain for more hours than I'd care to admit to get a
modified example working ... the Mup::CellRendererPopup.
This is what I've got so far ( please excuse what Mozilla does to my
formatting ):
$slist = Gtk2::SimpleList->new_from_treeview(
$prospects->get_widget('TelecomAccounts_SList'),
'ID' => 'hidden',
'AccountNo' => 'text',
'Supplier_index' => 'int',
'Notes' => 'text',
'Need
Itemisation' => 'bool',
'Suppliers' => 'text'
);
my $renderer = Mup::CellRendererPopup->new;
$renderer->set (mode => 'editable');
$column = Gtk2::TreeViewColumn->new_with_attributes (
'Supplier',
$renderer,
list => 5,
'index' => 2,
);
$renderer->signal_connect (edited => sub {
my ($cell, $text_path,
$new_index, $model) = @_;
my $path =
Gtk2::TreePath->new_from_string ($text_path);
my $iter =
$model->get_iter ($path);
$model->set ($iter, 2,
$new_index);
}, $model);
$slist->append_column ($column);
and later on, getting the data:
my $sth = $dbh->prepare
( "select ID, AccountNo, SupplierID, Notes, ItemisationRequired
from TelecomAccounts where LeadNo=?" );
$sth->execute($leadno);
@list_data = ();
while (my @rec = $sth->fetchrow_array) {
push @list_data, [ $rec[0], $rec[1], $rec[2], $rec[3], $rec[4], [
sort(@telecom_suppliers) ] ];
}
if (@list_data) {
$prospects->get_widget("TelecomAccounts_SList")->set_data_array( [
@list_data ] );
} else {
$prospects->get_widget("TelecomAccounts_SList")->set_data_array([]);
}
and finally, the @telecom_suppliers array is loaded when the app starts,
with:
my $ms_sth = $ms_dbh->prepare("select SupplierName from Suppliers
where Product like '%t%'
or Product like '%m%'
order by SupplierName");
$ms_sth->execute;
while (@row = $ms_sth->fetchrow_array) {
push @telecom_suppliers, 'SupplierName' => $row[0];
}
---
When the app starts, I get a string of these errors:
GLib-GObject-WARNING **: unable to set property `list' of type
`GPerlSV' from value of type `gchararray' at /home/dan/sales/sales.pl
line 3178.
Line 3178 is the last line of my app.
The combo-box-looking cellrenderer is displayed, but when it's selected,
the list is empty.
Anyone know what I'm doing wrong?
--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au
Title: CanIt Vote for ID 66627
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]