From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,STOX_REPLY_TYPE autolearn=no autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.tele2net.at!news.panservice.it!feed.xsnews.nl!border01.ams.xsnews.nl!feeder02.ams.xsnews.nl!frontend-F10-18.ams.news.kpn.nl From: "ldries46" Newsgroups: comp.lang.ada References: <52f08d46$0$9122$703f8584@news.kpn.nl> In-Reply-To: Subject: Re: Mouse Clicks in a Drawing Area Date: Tue, 4 Feb 2014 11:08:30 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 15.4.3555.308 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3555.308 Message-ID: <52f0bc8a$0$31367$703f8584@news.kpn.nl> Organization: KPN.com NNTP-Posting-Host: 77.168.179.107 X-Trace: 1391508618 news.kpn.nl 31367 77.168.179.107@kpn/77.168.179.107:55440 X-Original-Bytes: 3296 Xref: number.nntp.dca.giganews.com comp.lang.ada:184645 Date: 2014-02-04T11:08:30+01:00 List-Id: I now het changed the Add_Events into Set_Events (within the first code listing but the result is the same, nothing happens. I had done it that way before but http://askubuntu.com/questions/157290/how-to-draw-on-mouse-click-in-gtk-drawingarea-using-pygi suggested the add_events routine. That code is now Set_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)); The problem stays the same as. Just for extra information the code od On_Button_Press: function On_Button_Press (Object : access Gtk_Drawing_Area_Record'Class; event : Gdk_Event) return boolean is pragma Unreferenced (Object); begin ev := event.Button; -- line where the breakpoint is invoked nb := ev.Button; if nb = 1 then x := ev.X; y := ev.Y; end if; return nb = 1; end On_Button_Press; "Dmitry A. Kazakov" schreef in bericht news:qtjn56kj6yh4$.1iqlazgzyni86.dlg@40tude.net... On Tue, 4 Feb 2014 07:46:51 +0100, ldries46 wrote: > 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". [...] > 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? By default the button-press-event and the button-release-event signals are filtered out for a widget. See: https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget-button-press-event You must enable their propagation in order to be able to handle them. Use Set_Events for this purpose on the widget with the appropriate event mask. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de