Re: widget_class-event not working

2009-08-21 Thread Brian J. Tarricone
On 08/20/2009 10:27 PM, Patrick M. Rutkowski wrote:
 I've written a test case that anybody can compile and run:
 http://www.rutski89.com/static/event_test.c
 
 It contains the following line of code in the any_event() function:
 printf(IT WORKS!\n);
 
 That currently does not get printed.
 
 If you can get the test case to print that line of text, you will have
 solved my problem.

I can, but probably not in the way you want.  I think one of two things
is going on:

1.  GtkWidget just doesn't handle events and subclassing it will take
more work than just subclassing realize() to get it to receive events.

2.  You're missing something in your realize() method, though I'm not
sure what.

If I make your Foo class into a subclass of GtkEventBox instead of
GtkWidget, and then remove your realize() implementation (so it uses
GtkEventBox's impl), then it prints IT WORKS! as you'd expect.
Perhaps perusing gtkeventbox.c might help you figure out what else is
needed if you really want to just subclass GtkWidget.

-brian
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: widget_class-event not working

2009-08-21 Thread Patrick M. Rutkowski
Actually, I just figured it out a few moments ago. Adding the
following to realize() beings to fix things:

GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);

I start to get keyboard events and such.

However, there's another problem now! Even with GTK_CAN_FOCUS, I still
don't get GDK_MOTION_NOTIFY events, or even mouse button press events.

Here's another test case to instated illustrate that problem. This
time, IT WORKS! only prints if the event is somehow mouse related:

http://www.rutski89.com/static/mouse_test.c

See if you can get that one to print, I can't
-Patrick


On Fri, Aug 21, 2009 at 3:34 AM, Brian J. Tarriconebj...@cornell.edu wrote:
 On 08/20/2009 10:27 PM, Patrick M. Rutkowski wrote:
 I've written a test case that anybody can compile and run:
 http://www.rutski89.com/static/event_test.c

 It contains the following line of code in the any_event() function:
 printf(IT WORKS!\n);

 That currently does not get printed.

 If you can get the test case to print that line of text, you will have
 solved my problem.

 I can, but probably not in the way you want.  I think one of two things
 is going on:

 1.  GtkWidget just doesn't handle events and subclassing it will take
 more work than just subclassing realize() to get it to receive events.

 2.  You're missing something in your realize() method, though I'm not
 sure what.

 If I make your Foo class into a subclass of GtkEventBox instead of
 GtkWidget, and then remove your realize() implementation (so it uses
 GtkEventBox's impl), then it prints IT WORKS! as you'd expect.
 Perhaps perusing gtkeventbox.c might help you figure out what else is
 needed if you really want to just subclass GtkWidget.

        -brian
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: widget_class-event not working

2009-08-21 Thread Patrick M. Rutkowski
I figured it all out, and wrote it up in an article here:
http://www.rutski89.com/dynamic/journal.html?name=gtkwidget

Sleepiness was already hitting hard while banging away at the
keyboard, so please do let me know if you see any mistakes.

-Patrick


On Fri, Aug 21, 2009 at 3:58 AM, Patrick M. Rutkowskirutsk...@gmail.com wrote:
 Actually, I just figured it out a few moments ago. Adding the
 following to realize() beings to fix things:

 GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);

 I start to get keyboard events and such.

 However, there's another problem now! Even with GTK_CAN_FOCUS, I still
 don't get GDK_MOTION_NOTIFY events, or even mouse button press events.

 Here's another test case to instated illustrate that problem. This
 time, IT WORKS! only prints if the event is somehow mouse related:

 http://www.rutski89.com/static/mouse_test.c

 See if you can get that one to print, I can't
 -Patrick


 On Fri, Aug 21, 2009 at 3:34 AM, Brian J. Tarriconebj...@cornell.edu wrote:
 On 08/20/2009 10:27 PM, Patrick M. Rutkowski wrote:
 I've written a test case that anybody can compile and run:
 http://www.rutski89.com/static/event_test.c

 It contains the following line of code in the any_event() function:
 printf(IT WORKS!\n);

 That currently does not get printed.

 If you can get the test case to print that line of text, you will have
 solved my problem.

 I can, but probably not in the way you want.  I think one of two things
 is going on:

 1.  GtkWidget just doesn't handle events and subclassing it will take
 more work than just subclassing realize() to get it to receive events.

 2.  You're missing something in your realize() method, though I'm not
 sure what.

 If I make your Foo class into a subclass of GtkEventBox instead of
 GtkWidget, and then remove your realize() implementation (so it uses
 GtkEventBox's impl), then it prints IT WORKS! as you'd expect.
 Perhaps perusing gtkeventbox.c might help you figure out what else is
 needed if you really want to just subclass GtkWidget.

        -brian
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Pop up menu,when mouse clock with in a textview

2009-08-21 Thread Sreejith S
Hi...

I have a textview placed in my gtk window. I need to create a popup
menu when i press the right mouse button with in the text
view.Actually i tryed something,but not a complete solution.I created
$menu_edit--menu...textview refereneces are right..
Actually i dont know in which signal this code apends..Now im trying
with textview--button-press-eventIam getting the right button key
as 3.One problem is textview already has a default popup,which
contains cut,copy..etc...

when i pressed right button with in the textview the default popup
appreas first..then a small rectangle displayed...but no menu
items

Regards...

Sreejith


My code



$source_text-signal_connect('button-press-event' = sub{
my ($widget,$event)=...@_;
test_button_release($widget,$event);
});

sub test_button_release
{
my ($widget,$event)= @_;


my $button_nr = $event-button();
($button_nr == 3) ( $menu_edit-popup(undef,undef,undef,undef,0,0));


}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list