Brian Millham skin email on the users list has highlighted something that
I've been thinking about for a while - how to make creating Win32-GUI
One of the problems creating a Win32-GUI class is were to store the instance
data for the object while allowing the events to have access to this data.
In the current version of Win32-GUI you can stuff data into a structure and
store it via the window with the UserData method, and then retrieve it in
the event handler:
my $win=create the window
my $instancedata = create the instance data
#attach the instance data to the window
in the event handlers:
#for window events
#for child events, such as buttons on the window
This works well, but there is huge scope for clobbering the data if this
approach was used for a formal class. Ok - in the class documentation you
could mention that the instance data is stored as a hash, and if you need to
store data via UserData you should use your own key - but I'm wondering if
there is a better way to handle this? For example, we could add a "Data"
method which could be used to store instance data, leaving the UserData
method free for the user?