On Wed, 28 Jul 2021 04:28:07 -0700 (PDT) Eduard Filipas wrote:
EF> hi
EF> im very new to wxWidgets but as far as im reading documentation its only
EF> possible to put strings in gui objects ..coming from java ive got spoiled
EF> puting plain objects in gui. In javaFX object representation is based on
EF> toString() member function which needs to be overloaded for each class.
EF> Down side is you can have only one object representation for any object..I
EF> presume it would be better if one could "register" member function for gui
EF> element representation.
EF>
EF> for example i would like to put in comboBoxCTRL.popUpItems =
EF> vector<myObject> represented by member function
EF> myObject::presentationForCmbCtrl()
EF>
EF> is this possible even now ? if not would it be possible in future?
What you're looking for is known as "model-view" pattern in the GUI
frameworks and some wx classes (wxGrid, wxDataViewCtrl) do use it. Most of
them, including wxComboBox, don't, however.
If you need something like this, nothing prevents you from doing it in
your own code -- and this is indeed perfectly doable and many wx
applications do something like this. One of the reasons wx doesn't do it is
that there is nothing like Java Object in C++ and you can't assume that all
C++ programs use the same base class for storing their data nor would it be
a good idea to force all of them to use wxObject.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/