Re: [Vala] pass signal to covered window



Oh, that was too easy to think of. Still learning..
Thanks, Ben :)
 
 

Gesendet: Freitag, 05. Februar 2016 um 18:22 Uhr
Von: "Ben Iofel" <iofelben gmail com>
An: "Gilzad Hamuni" <gilli4 gmx net>, Vala-list <vala-list gnome org>
Betreff: Re: [Vala] pass signal to covered window

To emit signals in Vala, you just call them like methods
 textView.button_press_event (); 

On Fri, Feb 5, 2016 at 9:06 AM Gilzad Hamuni <gilli4 gmx net> wrote:Just for the integrity of this topic.

One solution to pass/fire an event programmatically is to use GLib.Signal.emit_by_name(), e.g.:

drawingArea.button_press_event.connect( (event) => { GLib.Signal.emit_by_name(textView, "button-press-event", 
event); } );

However, if the signal of interest expects a callback with a boolean return value (button-press-event does), 
you'll get the warning "value location for 'gboolean' passed as NULL".
If I try to provide the value 5 (that is G_TYPE_BOOLEAN) as the fourth parameter for emit_by_name(), then the 
application crashes right after emitting the signal.
I don't quite know how to translate/use GLib's signal_emitv() to/in Vala either. But for now I got my problem 
solved without passing signals at all.

Best,

gilzad



Gesendet: Montag, 01. Februar 2016 um 18:22 Uhr
Von: "Gilzad Hamuni" <gilli4 gmx net[gilli4@gmx.net]>
An: Vala-list <vala-list gnome org[vala-list@gnome.org]>
Betreff: [Vala] pass signal to covered window

Hi list,

if I have two windows layered on top of each other, the lower window can't fetch the mouse signals as these 
will go to the upper one. How can I pass the e.g. a button_pressed event on to the lower layer?



TextView textView = new TextView();

DrawingArea drawingArea = new DrawingArea();

fixedWindow = new Gtk.Fixed();
fixedWindow.put(textView, 0, 0);
fixedWindow.put(drawingArea, 0, 0);//putting drawing area on top of text view

drawingArea.button_press_event.connect( ... );// How can I fire a button_press event to the textView?


Thanks in advance,

gilzad
_______________________________________________
vala-list mailing list
vala-list gnome org[vala-list@gnome.org]
https://mail.gnome.org/mailman/listinfo/vala-list[https://mail.gnome.org/mailman/listinfo/vala-list]

_______________________________________________
vala-list mailing list
vala-list gnome org[vala-list@gnome.org]
https://mail.gnome.org/mailman/listinfo/vala-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]