Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > GTK weirdness

Reply
Thread Tools

GTK weirdness

 
 
Joe Laughlin
Guest
Posts: n/a
 
      08-13-2004
I'm creating a Gtk::TreeViewColumn and attaching its model to a
Gtk::ListStore. The liststore is created to have one column of type Object.
I then create a bunch of columns and renderers and and call
set_cell_data_func() on each column, setting the renderer.text attribute to
equal some atribute in an object that's contained in the Gtk::ListStore.

(hope that makes sense!)

So when I run the application, I get a bunch of these warnings when I move
my mouse over the treeview:

GLib-GObject-WARNING **: unable to set property `text' of type `gchararray'
from value of type `VALUE'

Ideas?

Thanks,
Joe


 
Reply With Quote
 
 
 
 
Joao Pedrosa
Guest
Posts: n/a
 
      08-13-2004
Hi,

--- Joe Laughlin <(E-Mail Removed)> wrote:

> I'm creating a Gtk::TreeViewColumn and attaching its
> model to a
> Gtk::ListStore. The liststore is created to have
> one column of type Object.
> I then create a bunch of columns and renderers and
> and call
> set_cell_data_func() on each column, setting the
> renderer.text attribute to
> equal some atribute in an object that's contained in
> the Gtk::ListStore.
>
> (hope that makes sense!)
>
> So when I run the application, I get a bunch of
> these warnings when I move
> my mouse over the treeview:
>
> GLib-GObject-WARNING **: unable to set property
> `text' of type `gchararray'
> from value of type `VALUE'
>
> Ideas?


On Windows 2000, ruby 1.8.2 (2004-06-29)
[i386-mswin32], with the "One Click Ruby Install"
(OCRI), GTK 2.4.3 by Tor, Ruby/GTK from the CVS, I was
able to create the following example, which seemed to
work fine. By the way, great Idea.

---->--- cut ---->-----
require 'gtk2'
include Gtk

def create_treeview
model = ListStore.new(Object)
treeview = TreeView.new(model)
3.times{|n|
column = TreeViewColumn.new
column.set_title("Etc#{n}")
text_renderer = CellRendererText.new
column.pack_start(text_renderer, true)
text_renderer.signal_connect('edited'){|cell,
path, value| }
column.set_cell_data_func(text_renderer){|column,
cell, model, iter|
cell.text = iter[0][n].to_s
}
treeview.append_column(column)
}
fill_random_data model
treeview
end

def fill_random_data model
10.times{|i|
iter = model.append
iter[0] = ["one#{i}", 2 + i, "three#{i}"]
}
end

Gtk.init
w = Window.new
w.signal_connect('destroy'){ Gtk.main_quit }
w.title = 'A Test'
w.set_default_size 500,400
w.add(create_treeview)
w.show_all
Gtk.main
---->--- cut ---->-----

Cheers,
Joao



__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail


 
Reply With Quote
 
 
 
 
Joe Laughlin
Guest
Posts: n/a
 
      08-16-2004
Joao Pedrosa wrote:
> Hi,
>
> --- Joe Laughlin <(E-Mail Removed)> wrote:
>
>> I'm creating a Gtk::TreeViewColumn and attaching its
>> model to a
>> Gtk::ListStore. The liststore is created to have
>> one column of type Object.
>> I then create a bunch of columns and renderers and
>> and call
>> set_cell_data_func() on each column, setting the
>> renderer.text attribute to
>> equal some atribute in an object that's contained in
>> the Gtk::ListStore.
>>
>> (hope that makes sense!)
>>
>> So when I run the application, I get a bunch of
>> these warnings when I move
>> my mouse over the treeview:
>>
>> GLib-GObject-WARNING **: unable to set property
>> `text' of type `gchararray'
>> from value of type `VALUE'
>>
>> Ideas?

>
> On Windows 2000, ruby 1.8.2 (2004-06-29)
> [i386-mswin32], with the "One Click Ruby Install"
> (OCRI), GTK 2.4.3 by Tor, Ruby/GTK from the CVS, I was
> able to create the following example, which seemed to
> work fine. By the way, great Idea.
>
> ---->--- cut ---->-----
> require 'gtk2'
> include Gtk
>
> def create_treeview
> model = ListStore.new(Object)
> treeview = TreeView.new(model)
> 3.times{|n|
> column = TreeViewColumn.new
> column.set_title("Etc#{n}")
> text_renderer = CellRendererText.new
> column.pack_start(text_renderer, true)
> text_renderer.signal_connect('edited'){|cell,
> path, value| }
> column.set_cell_data_func(text_renderer){|column,
> cell, model, iter|
> cell.text = iter[0][n].to_s
> }
> treeview.append_column(column)
> }
> fill_random_data model
> treeview
> end
>
> def fill_random_data model
> 10.times{|i|
> iter = model.append
> iter[0] = ["one#{i}", 2 + i, "three#{i}"]
> }
> end
>
> Gtk.init
> w = Window.new
> w.signal_connect('destroy'){ Gtk.main_quit }
> w.title = 'A Test'
> w.set_default_size 500,400
> w.add(create_treeview)
> w.show_all
> Gtk.main
> ---->--- cut ---->-----
>
> Cheers,
> Joao
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - You care about security. So do we.
> http://promotions.yahoo.com/new_mail


Thanks for the information.

I tracked it down to how I created the TreeViewColumn. I was setting :text
equal to 0 when creating the TreeViewColumn, which tells the TreeViewColumn
to try to find the text for the column in the first column of the model,
which is an Object. So when I removed ":text = 0", it worked.

Joe


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ruby GTK Fortune Cookies (gtk-fortune-0.1.1) Alex Shulgin Ruby 1 11-21-2007 01:05 AM
GTK+, segmentation fault in gtK-editable_get_chars zombek@gmail.com C Programming 2 05-29-2007 03:27 PM
Tkinter WEIRDNESS or Python WEIRDNESS? steve Python 4 03-13-2005 12:34 AM
compiling ruby under windows (+ gtk stuff, is the gtk list dead?) Gergely Kontra Ruby 2 06-18-2004 10:20 PM
Browser-blocking weirdness. Daniel Bell Firefox 2 08-11-2003 01:28 PM



Advertisments