Hello everyone!
My system works like this:
Control (base class)
– GUI (control container)
– Button (sample control)
– …other controls
And the event system works like this (in this case we’ll use mouse
clicks): the main application calls the “OnClick()” method in the GUI
class with the mouse pointer’s position as a parameter. The GUI class
then sees which control was clicked (based on the mouse’s position), and
calls the “OnClick()” method in that control (in this case we’ll use a
button). But here’s the problem; how can this control (button) class let
the main application know that it was clicked?
I tried to place a function pointer called “m_pfnOnClickEvent” and let
the main application set a function to it when it creates the button…
but C++ doesn’t let you put member methods onto function pointers, and
my program is 100% object-oriented.
Any ideas? Thanks!