[Gambas-user] Select Area using mouse
Karl Reinl
karl.reinl at fen-net.de
Sat May 16 14:31:23 CEST 2020
Am Samstag, den 16.05.2020, 12:26 +0100 schrieb John Rose:
> I posted to the Gambas User List yesterday. I sent, with the
> email, an attachment of my 'stripped down' project as a
> compressed
> source (Test.tar.gz). When I look at the Archive, specifically
> my
> post, it says:
>
> A non-text attachment was scrubbed...Name: Test.tar.gzType:
> application/gzipSize: 67367 bytesDesc: not availableURL: <
> https://lists.gambas-basic.org/pipermail/user/attacSo here's the
> code:' Gambas class file
> Private iAreaLeft As IntegerPrivate iAreaTop As IntegerPrivate
> iAreaWidth As IntegerPrivate iAreaHeight As Integer
> Public Sub _new() FSelectArea.Left =
> Screen.AvailableX FSelectArea.Top =
> Screen.AvailableY FSelectArea.Width =
> Screen.AvailableWidth FSelectArea.Height =
> Screen.AvailableHeight DrawingAreaDesktop.Left =
> Screen.AvailableX DrawingAreaDesktop.Top =
> Screen.AvailableY DrawingAreaDesktop.Width =
> Screen.AvailableWidth DrawingAreaDesktop.Height =
> Screen.AvailableHeightEnd
> Public Sub Form_Open() Message.Title = "To Specify Area to be
> Recorded:" Message.Info("Mouse button down & hold down on top left
> corner, drag to bottom right corner, and mouse button up.") Inc
> Application.Busy iAreaLeft = Screen.Width iAreaTop =
> Screen.Height iAreaWidth = 0 iAreaHeight =
> 0Finally Application.Busy = 0Catch Message.Warning(ERROR.Text)End
> Public Sub DrawingAreaDesktop_MouseDown() Inc Application.Busy '
> Print "Area 1st corner: X=" & Mouse.X & ", Y=" & Mouse.Y iAreaLeft =
> Mouse.X iAreaTop =
> Mouse.Y Paint.Begin(Last)Finally Application.Busy =
> 0Catch Message.Warning(ERROR.Text)End
> Public Sub DrawingAreaDesktop_MouseMove() If iAreaLeft >= Mouse.X Or
> iAreaTop >= Mouse.Y Then Return Endif Inc
> Application.Busy iAreaWidth = Mouse.X - iAreaLeft iAreaHeight =
> Mouse.Y - iAreaTop Paint.Rectangle(iAreaLeft, iAreaTop, iAreaWidth,
> iAreaHeight)Finally Application.Busy =
> 0Catch Message.Warning(ERROR.Text)End
> Public Sub DrawingAreaDesktop_MouseUp() If iAreaLeft >= Mouse.X Or
> iAreaTop >= Mouse.Y Then Message.Title = "Try
> again:" Message.Info("You have not selected an
> area") Return Endif Inc Application.Busy ' Print "Area 2nd
> corner: X=" & Mouse.X & ", Y=" & Mouse.Y iAreaWidth = Mouse.X -
> iAreaLeft iAreaHeight = Mouse.Y - iAreaTop Paint.End Print "You
> have selected this area: " & iAreaLeft & ", " & iAreaTop & ", " &
> iAreaWidth & " ," & iAreaHeight FMain.iRegionLeft =
> iAreaLeft FMain.iRegionTop = iAreaTop FMain.iRegionWidth =
> iAreaWidth FMain.iRegionHeight =
> iAreaHeight Last.CloseFinally Application.Busy =
> 0Catch Message.Warning(ERROR.Text)Endhments/20200515/e997d432/attach
> ment-0001.gz>
> I haven't posted for years. People when replying to posts asking for
> help with a project generally ask me for the project in a 'stripped
> down' form. Perhaps I should attach a project in a different way. If
> so, what?
no, not at all. The attachment wasn't scrubbed, may be that's your own
email-client who say that.
--
Amicalement
Charlie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200516/b26f01a0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Grafik-P6O7J0.png
Type: image/png
Size: 42387 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200516/b26f01a0/attachment-0001.png>
More information about the User
mailing list