[Gambas-user] How to make Mouse.Screen think that a form is 1024x768 or that the form is the screen?

Steve Starr comtux at ...626...
Sat Aug 27 19:22:23 CEST 2005


Here i have made up a Example gambas project and a README and some
screenshots so you can better understand what i am trying to do.


On 8/27/05, Benoit Minisini <gambas at ...1...> wrote:
> On Thursday 25 August 2005 15:11, Steve Starr wrote:
> > PUBLIC SUB Button1_MouseMove()
> >
> > Button1.Y = Mouse.ScreenY
> > Button1.X = Mouse.ScreenX
> >
> > TextBox1.Text = Mouse.ScreenY
> > TextBox2.Text = Mouse.ScreenX
> >
> > End
> >
> > When i drag Button1 all the way to the left TextBox2.Text will display
> > 0 now if i drag Button1 all the way to the right wich goes beyond my
> > form TextBox2.Text will display 1024 well this is the width of my
> > screen how could i if possable
> > make Mouse.ScreenX think that just my form is 1024 instead of my screen?
> > Same deal with Mouse.ScreenY if i drag Button1 to the top of my form
> > TextBox1.Text displays 0 but if i drag to the bottum button1 goes
> > beyond my form and TextBox1.Text displays 768 now this woudnt be a
> > problem if my form was full screened but that isnt practical.
> >
> >
> > If you need my source to see what i mean just ask and ill email it.
> > Thanks
> >
> 
> I don't really understand all, but anyway try:
> 
> PUBLIC SUB Button1_MouseMove()
> 
>   ' ScreenX/Y is the absolute screen coordinate.
>   ' X/Y is relative to the parent.
>   ' ClientX/Y is the shift between the top of the container and its inner.
> 
>   Button1.Y = Mouse.ScreenY - (Button1.Parent.ScreenX +
> Button1.Parent.ClientX)
>   Button1.X = Mouse.ScreenX - (Button1.Parent.ScreenY +
> Button1.Parent.ClientY)
> 
> END
> 
> When dealing with coordinates, things must be 'homogeneous'.
> 
> There are two kind of coordinates: relative coordinates (X, Y, ClientX,
> ClientY) and screen coordinates (ScreenX, ScreenY). When you substract two
> screen coordinates, or two relative coordinates, you get a relative
> coordinate.
> 
> So your inital formula couldn't work: you assigned screen coordinates to
> relative ones.
> 
> Mine may work, as I substract two screen coordinates, and substract a relative
> one again.
> 
> I forgot to told you one recommandation if my last private email to you: use
> indentation! Or you won't be able to read your code in two months!
> 
> Regards,
> 
> --
> Benoit Minisini
> mailto:gambas at ...1...
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Example.tar.gz
Type: application/x-gzip
Size: 31130 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20050827/8ce2451a/attachment.bin>


More information about the User mailing list