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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,be6e28f854440947 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!k22g2000yqh.googlegroups.com!not-for-mail From: tolkamp Newsgroups: comp.lang.ada Subject: Re: How to get the mouse position with JEWL? Date: Fri, 22 Oct 2010 06:55:22 -0700 (PDT) Organization: http://groups.google.com Message-ID: <3bdec7d9-3dc6-44f1-be1b-8aa8dd539360@k22g2000yqh.googlegroups.com> References: <057188e8-a7c9-4aeb-968c-ccdf720bd0fc@t20g2000yqa.googlegroups.com> NNTP-Posting-Host: 62.163.210.190 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1287755722 23890 127.0.0.1 (22 Oct 2010 13:55:22 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 22 Oct 2010 13:55:22 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k22g2000yqh.googlegroups.com; posting-host=62.163.210.190; posting-account=nZAcngoAAACcfYM9wDw3w9Z1XR3bObfs User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB6.5; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.1; .NET4.0C),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14677 Date: 2010-10-22T06:55:22-07:00 List-Id: On 21 okt, 00:22, Manuel Collado wrote: > El 20/10/2010 19:20, tolkamp escribi : > > > > > > > On 20 okt, 13:42, Manuel Collado =A0wrote: > >> 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 wron= g? > > >> Please try: > > >> =A0 =A0point :=3D Start_Point( canvas ); > > >> It works for me. > > > Also when I try: > > =A0 point :=3D Start_Point( canvas ); > > the x and y position remains zero. > > > Here is the code: > > > task body Task_2Hz is > > My_Frame =A0: Frame_Type; > > My_Canvas : Canvas_Type; > > My_Mouse_Position : Point_Type; > > begin > > =A0 =A0 =A0accept Start do > > =A0 =A0 =A0 =A0 My_Frame =A0 :=3D Frame (1200, 500, "", 0); > > =A0 =A0 =A0 =A0 My_Canvas =A0:=3D Canvas (Frame, (850,10), =A0 =A0 =A03= 00, 300); > > loop > > =A0 =A0 =A0 =A0 My_Mouse_Position :=3D Start_Point(My_Canvas); > > =A0 =A0 =A0 =A0 Put("Mouse-x =3D "); Int_Io.Put(My_Mouse_Position.x); N= ew_Line; > > =A0 =A0 =A0 =A0 Put("Mouse-y =3D "); Int_Io.Put(My_Mouse_Position.y); N= ew_Line; > > =A0 =A0 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: > > =A0 =A0 function Get_Point return Point_Type is > =A0 =A0 =A0 =A0Here: Point_Type; > =A0 =A0 begin > =A0 =A0 =A0 =A0loop > =A0 =A0 =A0 =A0 =A0 case Next_Command is > =A0 =A0 =A0 =A0 =A0 =A0 =A0when Cmd_Mouse =3D> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 exit; > =A0 =A0 =A0 =A0 =A0 =A0 =A0when Cmd_Quit =3D> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 raise Program_Aborted; > =A0 =A0 =A0 =A0 =A0 =A0 =A0when others =3D> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 null; > =A0 =A0 =A0 =A0 =A0 end case; > =A0 =A0 =A0 =A0end loop; > =A0 =A0 =A0 =A0Here :=3D Start_Point( Main_Canvas ); > =A0 =A0 =A0 =A0return Logical( Here ); > =A0 =A0 end Get_Point; > > Hope it helps. > -- > Manuel Collado -http://lml.ls.fi.upm.es/~mcollado- Tekst uit oorspronkeli= jk 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?