From: "ldries46" <bertus.dries@planet.nl>
Subject: Mouse Clicks in a Drawing Area
Date: Tue, 4 Feb 2014 07:46:51 +0100
Date: 2014-02-04T07:46:51+01:00 [thread overview]
Message-ID: <52f08d46$0$9122$703f8584@news.kpn.nl> (raw)
I do want to draw something at a certain point in a Drawing_Area. That point
should be derived from a mouse click.
To do this I have created a handler "On Button_Press".
I already have a draw event connected that works. I have concluded this from
the facts I can see and from the breakpoint I positioned inside the
"On_Area_Draw" Handler. The mouse click handler is created analog to the
Draw handler.
After creating the Drawing Area "Sudoku_Area" the handlers are initiated as
follows:
Add_Events(Sudoku_Area, BUTTON_PRESS_MASK);
CR := Create(Get_Window (Sudoku_Area));
Event_Cb.Connect (Sudoku_Area, "draw",
Event_Cb.To_Marshaller
(On_Area_Draw'Unrestricted_Access));
Event_Cb.Connect (Sudoku_Area, "button_press_event",
Event_Cb.To_Marshaller
(On_Button_Press'Unrestricted_Access));
where:
package Event_Cb is new Gtk.Handlers.Return_Callback
(Gtk_Drawing_Area_Record, Boolean);
The compilation of this is faultless.
I do use the following handlers:
function On_Area_Draw (Object : access Gtk_Drawing_Area_Record'Class;
Context : Cairo.Cairo_Context) return boolean;
function On_Button_Press (Object : access Gtk_Drawing_Area_Record'Class;
event : Gdk_Event) return boolean;
Both program build faultless.
I put a breakpoint inside the On_Button_Press function at a point where it
should always be reached.
Running the program and clicking within the drawn area that breakpoint is
never reached and the program runs without reporting an error.
I am using Gtk 3.4 and GPS.
What do I do wrong?
next reply other threads:[~2014-02-04 6:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 6:46 ldries46 [this message]
2014-02-04 8:52 ` Mouse Clicks in a Drawing Area Dmitry A. Kazakov
2014-02-04 10:08 ` ldries46
2014-02-04 10:43 ` dontspam365
2014-02-04 10:44 ` Dmitry A. Kazakov
2014-02-04 14:01 ` ldries46
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox