Access to ListBox


#1

Hi there,

what is the easiest and quickest way to access the listbox from inside the listboxmodel class
that is currently attached to that listbox, if there is a way?

Would like to extend the listboxmodel class with some methods where I need to access the
listbox.

Thanks,
Joerg


Observer pattern for ListBox and ListBoxModel
#2

In general it’s probably a bad thing for your model to need to reference the listbox component, but if you really need to, just give it a pointer to its listbox when you create it.


#3

Referencing to the listbox is exactly the way I do it right now but since you can attach
different models to a listbox, its not a proper and clean solution to reference to a listbox.

No other way like model->getCurrentlyAttachedListBox()???


#4

Exactly my point, and that’s why I don’t provide a method to do so!


#5

Okay, got you.

Thanks