Toolbar button ugliness

  • Thread starter Thread starter Tim Johnson
  • Start date Start date
T

Tim Johnson

Am I totally missing something, or is the only way to know which toolbar
button was clicked is by testing the e.ImageIndex value???

Which ugly way is recommended?

(1)
switch (e.ImageIndx)
{
case 0: ... //but then why did I bother naming the buttons like
tbtnDoThis, tbtnDoThat?
case 1:...
}

(2)
switch (e.ImageIndex)
{
case tbtnDoThis.ImageIndex: //but this doesn't compile
case tbtnDoThat.ImageIndex:
}

(3)
if (e.ImageIndex == tbtnDoThis.ImageIndex)
else
if (e.ImageIndex == tbtnDoThat.ImageIndex)

(4)
switch(sender)
{
case tbtnDoThis: //wouldn't this be nice?
case tbtnDoThat:
}

--

Tim Johnson
High Point Software, Inc.
www.high-point.com
(503) 312-8625
 
Back
Top