Other usage of wxClientData 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
cookielau
Knows some wx things
Knows some wx things
Posts: 35
Joined: Mon May 22, 2023 9:21 am

Other usage of wxClientData

Post by cookielau »

Hi all,

I wonder whether wxClientData can be used for other purpose, e.g. storing my business logic data used on my own only.

The situation is that, I have a notebook containing many pages, and I wanna store some information on page A and jump to page B to use that info to dynamic update the contents shown in page B. Since my page A and page B are separate classes in different .cc and .h files, and I don't wanna introduce any unhealthy dependencies like cross-dependency, I want to store the information I need in the common parent notebook object using SetClientData and dynamically update the content using the info extracted from GetClientData in the wxEVT_NOTEBOOK_Change bind function.

I searched many post in the forum and samples, but the most common usage is combined with the listBox to store the item, so I'm not so sure whether my personal usage of this client data is correct.

Best,
Quqi
Windows 10, wxWidgits v3.2.2.1
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Other usage of wxClientData

Post by doublemax »

It should work, but I don't think it's a good idea, it sounds quite limited. I'd rather extend the parent notebook with an interface the child panels can communicate with.
Use the source, Luke!
cookielau
Knows some wx things
Knows some wx things
Posts: 35
Joined: Mon May 22, 2023 9:21 am

Re: Other usage of wxClientData

Post by cookielau »

doublemax wrote: Wed Jun 07, 2023 4:58 pm It should work, but I don't think it's a good idea, it sounds quite limited. I'd rather extend the parent notebook with an interface the child panels can communicate with.
Thanks doublemax, I would compare these two methods. :wink:
Windows 10, wxWidgits v3.2.2.1
Post Reply