Closed maul-esel closed 12 years ago
Good idea. I'm not sure if references to the controls are the best option or if the class names should be used instead. I don't think it causes any particular issue right now, but I'm a bit concerned with circular links breaking reference counting.
I had the same thought, which was why I changed it to use a method instead of object-access as in the first commit. I thought it might be better that way however, as it allows a larger variety: one could use any object, probably dynamically created, or an instance of a class.
However, if you think it should be changed, this wouldn't be a problem to me.
So should I change it?
Should be good I think.
Instead of relying on a control class' name (inflexible) and hardcoding classes which implement several controls (even more inflexible), control classes are now registered:
CGUI provides a (static)
RegisterControl(name, class)
method which adds name and class to an object.AddControl()
then checks that object for the class corresponding to the requested control type.This allows:
"DropDownList"
,"DDL"
, ...)The
RegisterControl()
method is now called by the control classes from a static field initialization, but could theoretically be called at any point - from which on the control type is immediately available to the user.