Policy for access to widget struct data

I need access to GtkButton->event_window from my program. I see that
it is not binded, but for example GtkWidget->window is equivalent
problem, and binded.

Is there any policy regarding widget struct data? Can I simply add
access to ->event_window since I need it?


Guillaume C. - http://zarb.org/~gc/


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 Sun, 8 Jul 2007 16:07:48 +0200
“Guillaume C.” [email protected] wrote:

I need access to GtkButton->event_window from my program. I see that
it is not binded, but for example GtkWidget->window is equivalent
problem, and binded.

Is there any policy regarding widget struct data? Can I simply add
access to ->event_window since I need it?

We implement public functions/data of GTK-2.0.
“public” means it can be refer from API reference.
And we don’t prefer to implement accessors to C Struct data directly.

For example, Gtk::Widget->window is in the API reference.
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidgetClass
So we implemented them.

Are there any workaround ?
If no, you can implement it.


.:% Masao M.[email protected]


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/

Is there any policy regarding widget struct data? Can I simply add
access to ->event_window since I need it?

We implement public functions/data of GTK-2.0.
“public” means it can be refer from API reference.
And we don’t prefer to implement accessors to C Struct data directly.

I see. And there is even this mention about the GtkButton struct:

“This should not be accessed directly. Use the accessor functions
below.”

Though, I was misleaded because in the source code (headers of gtk)
there seems to be no difference between struct for GtkWidget and
GtkButton. I wonder why they don’t define the GtkButton as an opaque
struct in the headers of gtk…

Are there any workaround ?

I cannot find one for the moment :frowning:

I have a set of GtkButtons in a GtkHBox in a GtkScrolledWindow. I want
to implement autoscrolling of the scrolled window when a non-visible
button is focused with the keyboard. I cannot find another approach
than looking at the coordinates of the ->event_window GdkWindow
(GtkButton doesn’t have its own GdkWindow). But there is maybe a
better one… but I don’t know it.


Guillaume C. - http://zarb.org/~gc/


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,

this example is not perfect, but i think you will get it with it.

Cheers
detlef

#!/usr/bin/ruby
require ‘gtk2’

win = Gtk::Window.new
scroll = Gtk::ScrolledWindow.new
box = Gtk::HBox.new

win << scroll
scroll.add_with_viewport box
adj = scroll.hadjustment

width = 0

10.times do |i|
button = Gtk::Button.new(“button #{i}”)
width += button.size_request[0]
button.signal_connect(‘focus_in_event’) do |b, event|
pos = b.allocation.x
p pos
adj.value = pos
end
box.pack_start button
end

adj.upper = width

win.show_all
Gtk.main

Am Sonntag, den 08.07.2007, 17:37 +0200 schrieb Guillaume C.:

to implement autoscrolling of the scrolled window when a non-visible
button is focused with the keyboard. I cannot find another approach
than looking at the coordinates of the ->event_window GdkWindow
(GtkButton doesn’t have its own GdkWindow). But there is maybe a
better one… but I don’t know it.


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 example is not perfect, but i think you will get it with it.

Doh! I just proved myself to be a gtk newbie :confused: Thanks a lot for your
time!


Guillaume C. - http://zarb.org/~gc/


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