Why is ToolBarButton class not a control?

P

Peter Rilling

It seems to me that the ToolBarButton should be a control, but instead it
inherits from Component. Is there a reason this could not have inherited
from Control since really a ToolBarButton is nothing more then a button with
additional features?
 
P

Paul E Collins

Peter Rilling said:
It seems to me that the ToolBarButton should be a
control, but instead it inherits from Component. Is
there a reason this could not have inherited from
Control since really a ToolBarButton is nothing more
then a button with additional features?

I doubt that every button on a toolbar is really implemented as a
regular button. More probably, the "buttons" on a toolbar are
something like the items in a ListView, or the individual checkboxes
in a CheckedListBox: it's the responsibility of the parent control to
paint them all.

Is there something you're trying to do that you can't achieve this
way?

P.
 
P

Peter Rilling

I just had code that tracks the location of a control and wanted to expand
it to the toolbar buttons. Right now I have a constructor that takes a
Control object. This means that any control can be monitored by my class.
Now, if I want a ToolBarButton to be tracked, I have to add a new
constructor for this and generalize some of my code. Although it is not a
problem, it just means more methods.

I just thought that it really should have been a control since it has visual
characteristics and has behavior like all other controls. The ToolBar could
have been something like a Panel (or some other container), that allowed
other controls to be embedded.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top