DesktopWindow.Name; Unexpected result

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

DesktopWindow.Name; Unexpected result

Gianluigi
Please take a look at the attached test.
From DesktopWindow.Name I would expect the name of the Form Name property,
and instead I get the Title.
Do you think it should be reported as a bug?

Regards
Gianluigi

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user

TestWindowName-0.0.1.tar.gz (16K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: DesktopWindow.Name; Unexpected result

adamnt42@gmail.com
On Fri, 16 Jun 2017 15:07:20 +0200
Gianluigi <[hidden email]> wrote:

> Please take a look at the attached test.
> From DesktopWindow.Name I would expect the name of the Form Name property,
> and instead I get the Title.
> Do you think it should be reported as a bug?
>
> Regards
> Gianluigi

No, that is 100% correct under the Portland definition (and exactly what the Gambas help says.)

b
--
B Bruen <[hidden email] (sort of)>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: DesktopWindow.Name; Unexpected result

Gianluigi
Thank you very much.
So if I understand well, there is no difference between the two properties.

Regards
Gianluigi

2017-06-16 15:19 GMT+02:00 [hidden email] <[hidden email]>:

> On Fri, 16 Jun 2017 15:07:20 +0200
> Gianluigi <[hidden email]> wrote:
>
> > Please take a look at the attached test.
> > From DesktopWindow.Name I would expect the name of the Form Name
> property,
> > and instead I get the Title.
> > Do you think it should be reported as a bug?
> >
> > Regards
> > Gianluigi
>
> No, that is 100% correct under the Portland definition (and exactly what
> the Gambas help says.)
>
> b
> --
> B Bruen <[hidden email] (sort of)>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: DesktopWindow.Name; Unexpected result

adamnt42@gmail.com
On Fri, 16 Jun 2017 16:47:06 +0200
Gianluigi <[hidden email]> wrote:

> Thank you very much.
> So if I understand well, there is no difference between the two properties.
>
> Regards
> Gianluigi
>
> 2017-06-16 15:19 GMT+02:00 [hidden email] <[hidden email]>:
>
> > On Fri, 16 Jun 2017 15:07:20 +0200
> > Gianluigi <[hidden email]> wrote:
> >
> > > Please take a look at the attached test.
> > > From DesktopWindow.Name I would expect the name of the Form Name
> > property,
> > > and instead I get the Title.
> > > Do you think it should be reported as a bug?
> > >
> > > Regards
> > > Gianluigi
> >
> > No, that is 100% correct under the Portland definition (and exactly what
> > the Gambas help says.)
> >
> > b
> > --
> > B Bruen <[hidden email] (sort of)>
> >

Consider opening four spreadsheets at the same time in libreOffice - each of the window titles includes the name of the file as well as the application name. If it were just the application name how could you tell which window had which file.

b
--
B Bruen <[hidden email] (sort of)>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: DesktopWindow.Name; Unexpected result

Gianluigi
Sorry but I do not understand the difference;
From Gambas documentation on DesktopWindow.VisibleName (gb.desktop):
Returns the window visible name, i.e. the window title as displayed by the
window manager.
The visible name may be different from the name, when two or more windows
have the same name.

Then I did three different applications with a window of the same name
(FOO) I launched, and then I launched a fourth (Write) with this code.
I do not know differences in output.

Regards
Gianluigi
'----------------------------------------------------------
Public Sub Form_Open()

  Dim w As DesktopWindow

  For Each w In Desktop.Windows
    Print w.Name
  Next
  For Each w In Desktop.Windows
    Print w.VisibleName
  Next

End

Output with IDE:

Scrivania
FOO
FMain.form - App-3 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!
FOO
FMain.form - App-2 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!
FOO
FMain.form - App-1 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!
FMain.class - Write 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!


Scrivania
FOO
FMain.form - App-3 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!
FOO
FMain.form - App-2 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!
FOO
FMain.form - App-1 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!
FMain.class - Write 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!

Output with Executable:

Scrivania
FOO
FOO
FOO
FMain.class - Write 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!


Scrivania
FOO
FOO
FOO
FMain.class - Write 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!

Output without title:

Scrivania
Application one
Application two
Application three
FMain.class - Write 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!


Scrivania
Application one
Application two
Application three
FMain.class - Write 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!

Output with Spreadsheet:

Scrivania
Spreadsheet-1.ods - LibreOffice Calc
Spreadsheet-1.ods - LibreOffice Calc
Spreadsheet-1.ods - LibreOffice Calc
FMain.class - Write 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!


Scrivania
Spreadsheet-1.ods - LibreOffice Calc
Spreadsheet-1.ods - LibreOffice Calc
Spreadsheet-1.ods - LibreOffice Calc
FMain.class - Write 0.0.1 - Gambas 3 - DEVELOPMENT VERSION, USE AT YOUR OWN
RISK!

'--------------------------------------------------------------------------------------------------------------------------------------------------

2017-06-16 22:40 GMT+02:00 [hidden email] <[hidden email]>:

> On Fri, 16 Jun 2017 16:47:06 +0200
> Gianluigi <[hidden email]> wrote:
>
> > Thank you very much.
> > So if I understand well, there is no difference between the two
> properties.
> >
> > Regards
> > Gianluigi
> >
> > 2017-06-16 15:19 GMT+02:00 [hidden email] <[hidden email]>:
> >
> > > On Fri, 16 Jun 2017 15:07:20 +0200
> > > Gianluigi <[hidden email]> wrote:
> > >
> > > > Please take a look at the attached test.
> > > > From DesktopWindow.Name I would expect the name of the Form Name
> > > property,
> > > > and instead I get the Title.
> > > > Do you think it should be reported as a bug?
> > > >
> > > > Regards
> > > > Gianluigi
> > >
> > > No, that is 100% correct under the Portland definition (and exactly
> what
> > > the Gambas help says.)
> > >
> > > b
> > > --
> > > B Bruen <[hidden email] (sort of)>
> > >
>
> Consider opening four spreadsheets at the same time in libreOffice - each
> of the window titles includes the name of the file as well as the
> application name. If it were just the application name how could you tell
> which window had which file.
>
> b
> --
> B Bruen <[hidden email] (sort of)>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: DesktopWindow.Name; Unexpected result

adamnt42@gmail.com
On Sat, 17 Jun 2017 12:19:53 +0200
Gianluigi <[hidden email]> wrote:

> Sorry but I do not understand the difference;
> From Gambas documentation on DesktopWindow.VisibleName (gb.desktop):
> Returns the window visible name, i.e. the window title as displayed by the
> window manager.
> The visible name may be different from the name, when two or more windows
> have the same name.
>

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.

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.  :-)

regards
b






--
B Bruen <[hidden email] (sort of)>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: DesktopWindow.Name; Unexpected result

Gianluigi
2017-06-17 13:51 GMT+02:00 [hidden email] <[hidden email]>:

>
> 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
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: DesktopWindow.Name; Unexpected result

Tobias Boege-2
On Sat, 17 Jun 2017, Gianluigi wrote:

> 2017-06-17 13:51 GMT+02:00 [hidden email] <[hidden email]>:
>
> >
> > 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.
>
I can get something like this here easily by opening two konqueror windows
and pointing them to the same directory (see screenshot). However, the
properties of the DesktopWindow objects look like this:

  $ ./konqueror-windows.gbs3
  Name: var - Konqueror   VisibleName: var - Konqueror
  Name: var - Konqueror   VisibleName:

So, apparently this can happen, too.

Regards,
Tobi

--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user

kwin-konqueror-visiblename.png (5K) Download Attachment
konqueror-windows.gbs3 (244 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: DesktopWindow.Name; Unexpected result

Gianluigi
Hi Tobias,

I have Ubuntu with Unity but I trust in yours words :-)

Regards
Gianluigi

2017-06-17 14:50 GMT+02:00 Tobias Boege <[hidden email]>:

> On Sat, 17 Jun 2017, Gianluigi wrote:
> > 2017-06-17 13:51 GMT+02:00 [hidden email] <[hidden email]>:
> >
> > >
> > > 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.
> >
>
> I can get something like this here easily by opening two konqueror windows
> and pointing them to the same directory (see screenshot). However, the
> properties of the DesktopWindow objects look like this:
>
>   $ ./konqueror-windows.gbs3
>   Name: var - Konqueror   VisibleName: var - Konqueror
>   Name: var - Konqueror   VisibleName:
>
> So, apparently this can happen, too.
>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user