On 29-Jun-07, at 12:36 PM, Brad Rhine wrote:
> It was a while back, but I remember running into some trouble with
> subclasses ToolItems. What are you trying to accomplish?
I just have different buttons that present different menus of
different kinds of objects.
But, to populate these menus I need to add items to them. The items
are stored in one big list of classes and I can determine what type
each item is.
So I figured I create a subclass of ToolButton and call one
"myTypeA_ToolButton", another one "myTypeB_ToolButton" etc
Eventually I'd like to let people rearrange the items in the toolbar
(I'll build it on the fly)
Then as I iterate through the list of items I have that need to be
presented in the menus for each button I could do something like -
this is only email ready code for illustrative purpoes :)
// add each item to the right button's menu
for i as integer = 0 to ubound(listOfClasses)
select case true
case listOfClasses(i) isA TypeA
for j = 0 to toolbar.Count - 1
if toolbar.item(j) isA myTypeA_ToolButton
// add this item to the menu for this button
end if
next
case listOfClasses(i) isA TypeB
if toolbar.item(j) isA myTypeB_ToolButton
// add this item to the menu for this button
end if
case listOfClasses(i) isA TypeC
if toolbar.item(j) isA myTypeC_ToolButton
// add this item to the menu for this button
end if
end select
next
Once the menu is created that's not a problem because I can test each
item tag in the menu with IsA to see what type it is and behave
accordingly
For now I test the NAME of each toolbutton
> Maybe there's a workaround...
I just identify them by name but subclasses should work
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|