[Gambas-user] Selecting a window
John Rose
john.aaron.rose at ...626...
Wed Dec 4 18:01:15 CET 2013
I want the user to be able to click a point within one of the windows
displayed on the desktop (i.e. not just Gambas forms) in order to select
that window. The code below shows how to access properties of all windows:
Dim dWindow As DesktopWindow = Null
Desktop.Windows.Refresh()
For Each dWindow In Desktop.Windows
If dWindow.Minimized = False Then
Print "Window: Name=" & dWindow.Name & ", " & "X=" & dWindow.X &
", Y=" & dWindow.Y & ", " & "Width=" & dWindow.Width & ", Height=" &
dWindow.Height
Endif
Next
The only way I've thought of is to define a transparent form covering
the whole desktop with an associated mouse click event, which supplies
the co-ordinates of the point clicked. Then by examination of each
dWindow property (i.e. X, Y, Width, Height), one can determine which
window has been clicked. Is that the best way? But how can one allow for
the situation where the user has clicked a point which is within 2
windows i.e. is there a property of dWindow which shows if that window
is the 'top' one (i.e. covering the other one at that point)?
More information about the User
mailing list