Gambas India Forum

Forum breadcrumbs - You are here:ForumRepository: Source CodesSelect Window

Select Window

Do you like this program?

I haven't yet had time to take a look at those books.

In the SelectArea app, I noticed that your version had a Horizontal Panel (in the FMain form) with the Select & Hint buttons. There was a Spring control placed between (connecting?) the 2 buttons. What does it do?

I'm now trying to get my SelectWindow app working (previous questions were on my SelectArea app). I fill various arrays (aWindowRect, aWindow) with elements from the DesktopWindow set of objects (which interestingly includes the what I think of as the Ubuntu Desktop which I ignore using the "If .VisibleName = "Desktop" And .Height = Screen.Height And .Width = Screen.Width Then Continue" code line below) using the FindWindows method you suggested in your last post. What does the SkipTaskbar property of the Desktop Window object actually mean?

Public Sub Form_Open()
  Dim i As Integer
  Dim hDesktopWindow As DesktopWindow
  For Each i In Desktop.FindWindow(Null, Null, Null)
    hDesktopWindow = New DesktopWindow(i)
    With hDesktopWindow
      If .Minimized Then Continue
      If .VisibleName = "Desktop" And .Height = Screen.Height And .Width = Screen.Width Then Continue
      Print "DesktopWindow: ", "Name=" & .Name, "VisibleName=" & .VisibleName, "Hex(i)=" & Hex(i)
      Print ".Id=" & .Id, "Left=" & .X, "Top=" & .Y, "Width=" & .Width, "Height=" & .Height
    End With

In the above code, the Minimized property doesn't seem to work properly always i.e. a DesktopWindow sometimes does not have its Mimimized property set even when it's minimised (this was picked up by the Print lines in the above code actually happening for a Terminal window). The Mimimized property was set correctly (and therefore its details not printed) for a Nautilus window which was minimised, and correctly another Nautilus window which was not minimised did have its details printed. I have attached the app's tar.gz in case you want to try it yourself.

I'm also intrigued by the FullScreen property of a DesktopWindow object. Would a FullScreen window cover the Launcher & Systray panels (e.g. when you run a video file in full screen 'mode')? Would its DesktpWindow details have a VisibleName property?

I have a Drawing Area Desktop with Opacity=35 overlaying Ubuntu's desktop (as in the previous SelectArea app). This has a MouseUp event with some of its coding shown below. The problem is that if there are 2 windows overlapping then I want to select the window where the overlapping part is displayed on top (of Ubuntu's desktop). However, my code shown below only finds the first window in the aWindowRect array (the aWindow array contains all the DesktopWindow elements). Is there a way of cycling through these arrays to only select the DesktopWindow which is on top?

For j = 0 To aWindowRect.Max
    If aWindowRect[j].Contains(Mouse.X, Mouse.Y) Then
      sWindowVisibleName = aWindowVisibleName[j]
      hWindowRect = aWindowRect[j]
      With hWindowRect
        iWindowLeft = .Left
        iWindowTop = .Top
        iWindowWidth = .Width
        iWindowHeight = .Height
      End With
      bWindowSelected = True