Desktop.windows give only active window [solved]
Posted
#1
(In Topic #752)
Trainee
I found a code example in the Gambas Book (gambas-buch.de) chapter 15.4 which does exactly what I want.
Code
Public Sub Button1_Click()
Dim dtWindow As DesktopWindow
Desktop.Windows.Refresh()
For Each dtWindow In Desktop.Windows
If dtWindow.SkipTaskbar = False Then
Print "Window.Name = \"" & dtWindow.Name & "\" , X = " & dtWindow.X & " , Y = " & dtWindow.Y
Endif
Next
End
The problem is that I only recieve the active window and nothing else. In the book they recieve all windows, not only the active one.
I have included gb.desktop and gb.desktop.x11.
Gambas version is 3.16.3 on Linux mint 20.1 Cinnamon.
Obviously I'm doing something wrong or missing some important stuff but what?
Ps Will be a measuring microscope when finished
Posted
Guru

[System]
Gambas=3.16.90 51cf626fa (bruces-patched)
OperatingSystem=Linux
Kernel=5.4.0-84-generic
Architecture=x86_64
Distribution=Linux Mint 20.2 Uma
Desktop=Cinnamon
Result
Window.Name = "Computer" , X = 256 , Y = 194
Window.Name = "MediaPlay" , X = 39 , Y = 328
Window.Name = "Gambas ONE - Post a reply — Mozilla Firefox" , X = 49 , Y = 76
Window.Name = "Startup.module - _aa 0.0.28 — Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN RISK!" , X = 147 , Y = 122
Did you try it without the "If dtWindow.SkipTaskbar" bit?
Posted
Guru

Posted
Trainee
I took a new computer, made a fresh Linux Mint 20.2 and a Gambas ppa:-install and now it works like a charm. I don't know what's wrong with the old computer but it's obviously local to that computer.
Have a nice day everyone!
Posted
Trainee
Will see if I can use it together with the mediaplayer window.
Posted
Guru

That's about all i can think of.
I'm sure you'll figure it out.
1 guest and 0 members have just viewed this.



