comp.lang.ada
 help / color / mirror / Atom feed
From: tolkamp <f.tolkamp@gmail.com>
Subject: Re: How to get the mouse position with JEWL?
Date: Fri, 22 Oct 2010 06:55:22 -0700 (PDT)
Date: 2010-10-22T06:55:22-07:00	[thread overview]
Message-ID: <3bdec7d9-3dc6-44f1-be1b-8aa8dd539360@k22g2000yqh.googlegroups.com> (raw)
In-Reply-To: i9nq7p$75o$1@peque.uv.es

On 21 okt, 00:22, Manuel Collado <m.coll...@domain.ivalid> wrote:
> El 20/10/2010 19:20, tolkamp escribi :
>
>
>
>
>
> > On 20 okt, 13:42, Manuel Collado<m.coll...@domain.invalid>  wrote:
> >> El 20/10/2010 11:04, tolkamp escribi :
>
> >>> I use JEWL in several of my applications.
> >>> Now I try to get the mouse position within a JEWL canvas by using the
> >>> function "End_Point(Canavas)".
> >>> The resulting mouse position (x,y) is always zero. What is going wrong?
>
> >> Please try:
>
> >>    point := Start_Point( canvas );
>
> >> It works for me.
>
> > Also when I try:
> >   point := Start_Point( canvas );
> > the x and y position remains zero.
>
> > Here is the code:
>
> > task body Task_2Hz is
> > My_Frame  : Frame_Type;
> > My_Canvas : Canvas_Type;
> > My_Mouse_Position : Point_Type;
> > begin
> >      accept Start do
> >         My_Frame   := Frame (1200, 500, "", 0);
> >         My_Canvas  := Canvas (Frame, (850,10),      300, 300);
> > loop
> >         My_Mouse_Position := Start_Point(My_Canvas);
> >         Put("Mouse-x = "); Int_Io.Put(My_Mouse_Position.x); New_Line;
> >         Put("Mouse-y = "); Int_Io.Put(My_Mouse_Position.y); New_Line;
> >     delay 0.5;
> > end loop;
> > end Task_2Hz;
>
> IIRC, you must wait for a mouse event before reading the coordinates.
> Here is a code fragment of a real program that uses a canvas. You may
> figure how to adapt it to your needs:
>
>     function Get_Point return Point_Type is
>        Here: Point_Type;
>     begin
>        loop
>           case Next_Command is
>              when Cmd_Mouse =>
>                 exit;
>              when Cmd_Quit =>
>                 raise Program_Aborted;
>              when others =>
>                 null;
>           end case;
>        end loop;
>        Here := Start_Point( Main_Canvas );
>        return Logical( Here );
>     end Get_Point;
>
> Hope it helps.
> --
> Manuel Collado -http://lml.ls.fi.upm.es/~mcollado- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

What is the type of the following variables:
Next_Command, Cmd_Mouse, Program_Aborted?
What means Logical?



  parent reply	other threads:[~2010-10-22 13:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-20  9:04 How to get the mouse position with JEWL? tolkamp
2010-10-20 11:42 ` Manuel Collado
2010-10-20 17:20   ` tolkamp
2010-10-20 22:22     ` Manuel Collado
2010-10-20 22:51       ` tmoran
2010-10-21  2:59         ` Jeffrey Carter
2010-10-21  4:08           ` tmoran
2010-10-21  7:31         ` Dmitry A. Kazakov
2010-10-21 19:10           ` tmoran
2010-10-21 19:38             ` Dmitry A. Kazakov
2010-10-22  0:39               ` tmoran
2010-10-22  7:35                 ` Dmitry A. Kazakov
2010-10-22 10:10                 ` Frank J. Lhota
2010-10-21 15:23         ` tolkamp
2010-10-21 16:47           ` Georg Bauhaus
2010-10-21 17:09             ` tolkamp
2010-10-21 17:24               ` Niklas Holsti
2010-10-21 20:34         ` tolkamp
2010-10-22 13:55       ` tolkamp [this message]
2010-10-22 22:15         ` Manuel Collado
2010-10-23 15:26           ` tolkamp
2010-10-21 21:50 ` Manuel Collado
2010-10-22 10:40   ` tolkamp
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox