[Gambas-user] The logical operators in the debug window are not displayed correctly

Francisco Martinez fmfdario at gmail.com
Thu Jan 24 00:07:39 CET 2019


Hi Jussi.

It is a small code. The code tries to find out if any part of a 
rectangle is inside another rectangle.
You will need to create a project that uses the qt component.

The code uses words in Spanish. Here it is.

[code]
Public Sub Form_Open()

   Dim rect1 As New Rect
   Dim rect2 As New Rect
   Dim rectangulos As New Rect[][]

   With rect1
     .x = 10
     .y = 10
     .W = 100
     .H = 200
   End With

   With rect2
     .x = 5
     .y = 10
     .W = 300
     .H = 200
   End With

   rectangulos.Add([rect1, rect2])
   rectangulos.Add([rect2, rect1])

   Print SuperPosicion(rect1, rect2)

   ' Print rect1.Contains(rect2.x, rect2.y)
   ' Print rect2.Contains(rect1.X, rect1.y)

End

Public Sub SuperPosicion(prota As Rect, unrectangulo As Rect) As Boolean
   '

   Dim rec1 As New Rect
   Dim rec2 As New Rect
   Dim tmprec1 As New Rect[]

   With rec1
     .X = prota.x
     .Y = prota.y
     .W = prota.w
     .H = prota.h
   End With

   With rec2
     .x = unrectangulo.x
     .y = unrectangulo.y
     .w = unrectangulo.w
     .h = unrectangulo.h
   End With

   For Each tmprec1 In [[rec1, rec2], [rec2, rec1]]

     If ((PuntoDentroDeRect(tmprec1[0].Left, tmprec1[0].Top, 
tmprec1[1])) Or
         (PuntoDentroDeRect(tmprec1[0].Left, tmprec1[0].Bottom, 
tmprec1[1])) Or
         (PuntoDentroDeRect(tmprec1[0].Right, tmprec1[0].Top, 
tmprec1[1])) Or
         (PuntoDentroDeRect(tmprec1[0].Right, tmprec1[0].Bottom, 
tmprec1[1]))) Then Return True
     Next
     Return False

End

Public Sub PuntoDentroDeRect(x As Integer, y As Integer, unrect As Rect) 
As Boolean

   If (x >= unrect.Left) And (x <= unrect.Right) And (y >= unrect.Top) 
And (y <= unrect.Bottom) Then
     Return True
   Else
     Return False
   Endif

End
[/code]

Regards.

El 23/1/19 a las 19:56, Jussi Lahtinen escribió:
> I can't reproduce the problem either... perhaps something in your code 
> triggers it. Can you send small project to reproduce the problem?
>
> Jussi
>
> On Wed, Jan 23, 2019 at 11:14 AM Francisco Martinez 
> <fmfdario at gmail.com <mailto:fmfdario at gmail.com>> wrote:
>
>     Hi everyone!.
>
>     I hope you can see the image. Some operators do not display
>     correctly in the debug console window.
>
>
>
>     When I use >= is shows only > for example.
>
>     ¿ Wheres is "=" sometimes ?. :-)
>
>     Best Regards.
>
>     ----[ Gambas mailing-list is hosted by https://www.hostsharing.net
>     ]----
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190124/93abb063/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WatchExpressionDebug.png
Type: image/png
Size: 31466 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190124/93abb063/attachment-0001.png>


More information about the User mailing list