[BUG] can't get properties

Hi,

with the current ruby gnome from CVS i can’t get object properties. The
following example:

#!/usr/bin/ruby

require ‘gtk2’

class Win
def initialize
@win = Gtk::Window.new
@win.title = “a test”
@button = Gtk::Button.new ‘press me!’
@button.signal_connect(‘clicked’) do
p @win.property(‘title’)
end
@win << @button
@win.show_all
end
end

win = Win.new
Gtk.main

throws this error message:

[email protected]:~/Desktop$ ruby proptest.rb
proptest.rb:11:in property': can't get gobject class information from proptest.rb:11:ininitialize’
from proptest.rb:22:in call' from proptest.rb:22:inmain’
from proptest.rb:22

Or did i missed something?

Cheers detlef


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

Hi Detief here is Julio Sosa, nice example to get the object
properties, try to run this.

#------------------------------------------------
#|how you can see i have been replaced the

p @win.property(‘title’), with

p @win.title

now this the result " a test", i hope be helpful for you n___n

the error, well u r trying to call an inexistent method for the
Gtk::Window class

you can read more about the gtk API here,

http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3AWindow#Instance+Methods

#!/usr/bin/ruby

require ‘gtk2’

class Win
def initialize
@win = Gtk::Window.new
@win.title = “a test”
@button = Gtk::Button.new ‘press me!’
@button.signal_connect(‘clicked’) do
p @win.title
end
@win << @button
@win.show_all
end
end

win = Win.new
Gtk.main

cheers dude!!
#------------------------------------------------------

2007/6/11, Detlef R. [email protected]:

end

Cheers detlef
https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

Am Donnerstag, den 14.06.2007, 00:49 +0900 schrieb Masao M.:

@button.signal_connect('clicked') do

Or did i missed something?

At first, you need to use @win.get_property(“title”) for getting the property
variables.

Hi,

thanks allot, i must be blind :-/

I have looked at GLib::Object.property, which is a module function and
not at the instance methodes.

Now my extension works like expected :slight_smile:

http://sourceforge.net/powerbar/db2/


ruby-gnome2-devel-en mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

Hi,

On Mon, 11 Jun 2007 20:08:14 +0200
Detlef R. [email protected] wrote:

Hi,

with the current ruby gnome from CVS i can’t get object properties. The
following example:

@button.signal_connect(‘clicked’) do
p @win.property(‘title’)
end

[email protected]:~/Desktop$ ruby proptest.rb
proptest.rb:11:in property': can't get gobject class information from proptest.rb:11:ininitialize’
from proptest.rb:22:in call' from proptest.rb:22:inmain’
from proptest.rb:22

Or did i missed something?

At first, you need to use @win.get_property(“title”) for getting the
property
variables.

Secondly, there is the GLib::Interface#property method but this is a
bug.

  • This should be a module function, not instance method.
  • The method name should be #get_property(str), not property(str).

I’ll change this method as a module function not instanfce method.


This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs