[Gambas-user] Selecting a window

Bruce bbruen at ...2308...
Thu Dec 5 00:10:51 CET 2013


On Wed, 2013-12-04 at 20:18 +0100, Fabien Bodard wrote:
> I'm sure to understand what you want to achieve ... what do you mean
> by select a windows ?
> 
> 2013/12/4 John Rose <john.aaron.rose at ...626...>:
> > 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)?
> >


Like Fabian, without understanding exactly what you want to achieve, why
not just shell out to xprop where all this is apparently already solved?

Bruce





More information about the User mailing list