What is Set-/GetName() on wxWindow class used for? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
sparhawk
Experienced Solver
Experienced Solver
Posts: 81
Joined: Tue May 21, 2013 8:08 am

What is Set-/GetName() on wxWindow class used for?

Post by sparhawk »

I noticed that wxWindow has a SetName() and GetName() function https://docs.wxwidgets.org/3.0/classwx_ ... 01dbaaf990. Does this have any intrinsic meaning, or can this freely be used? Since I have windows which have not titles, I would like to set the name to the "title" for such windows, so I can retrieve it later when I convert such a window into one that has a title.
For example; When I convert a tab from wxNotebook to a wxSplitter I want to remember the value of the tab, so when it is convert back again to a tab, I can set it again to it's original value.

From the documentation it appears that this name has no special meaning and also doesn't need to be unique.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: What is Set-/GetName() on wxWindow class used for?

Post by doublemax »

Yes, you can freely use it for any purpose. AFAIK it's not used by wxWidgets internally.

I've used it on a few occasions to find a window using wxWindow::FindWindowByName() to avoid having to pass a pointer around.
https://docs.wxwidgets.org/trunk/classw ... 00557a44c3
Use the source, Luke!
Post Reply