[Gambas-user] DesktopWindow.Name; Unexpected result
Gianluigi
bagonergi at ...626...
Sat Jun 17 14:33:25 CEST 2017
2017-06-17 13:51 GMT+02:00 adamnt42 at ...626... <adamnt42 at ...626...>:
>
> Ah! Now I see where your confusion lies...
> 1) DesktopWindow.Name : "i.e. its title as specified by the application
> that owns this window."
> 2) DesktopWindow.VisibleName : " i.e. the window title as displayed by the
> window manager."
>
> The difference is subtle and not easy to find an example for, but it does
> happen I can assure you.
>
OK, I'll take your word for it.
You understand how an application sets the Title of a window that it
> displays, OK? Hence you see the file name in the title for the windows in
> your output. This is the .Name property value.
> Now there are situations where the window manager itself will modify the
> title for some reason or other. I cannot think up an example but maybe you
> have seen somewhere a window title that looked something like "My Window -
> some info" and if you had two of these open the titles would be something
> like "My Window - some info:1" and "My Window - some info:2". These titles
> are set by the Window Manager, from the title supplied by the owning
> application and for its' own sweet reasons. In other words, it is not easy
> to "make this happen" as it depends on the window manager in use and its
> logic for re-titling specific windows.
>
> Now here is the reason for having the two properties. If you are
> searching for a specific window by it's expected title, i.e. the
> application set Title, then exact match searches will fail when the window
> manager has altered it. So then we use DesktopWindow.Name ... and get a
> list if there are more than one. But if we want to act on a specific,
> re-titled, window then Desktop.Window.VisibleName can be used.
>
> I have said this before, and no doubt will say it again.
> Above my desk is a sign that says : "Read EVERY word in the Gambas help
> page". I put it up there nearly 10 years ago when I was learning Gambas
> for the first time and even today I occasionally have to refer to it when I
> get frustrated by something that I don't understand about Gambas. I
> recommend you get a similar sign. :-)
>
That's good advice, I'll keep that in mind. 👍
Thank you very much for the exhaustive explanations.
Regards
Gianluigi
More information about the User
mailing list