How to dynamically add items with icons to ultraExplorer bars?

TomBascom

Curmudgeon
I am currently very successfully populating an ultraExplorerBar dynamically
using these two methods that I have added to the class containing the
ultraExplorerBar:

Code:
  method private void addGroup( input groupName as character ):

    if protopbar:groups:exists( groupName ) = false then
      myExplorerBar:groups:insert( 0, groupName, groupName ).

    return.

  end method.

  method public void addItem2ExplorerBar( input groupName as character, input itemName as character ):

    addGroup( groupName ).
    myExplorerBar:groups[groupname]:items:add( itemName, itemName ).

    return.

  end method.

There is, however, a small problem. This code results in the "default
image" being used with each item and that is kind of ugly.

I can easily turn off the default image by adding:

Code:
    myExplorerBar:groups[groupName]:items[itemName]:Settings:UseDefaultImage = Infragistics.Win.DefaultableBoolean:False.

to the addItem2ExplorerBar() method but that is even uglier :(

What I would really like to be able to do is to specify an image with the
item when I add it using a third parameter to addItem2ExplorerBar(). But
the add() method obviously doesn't support that.

Any ideas?
 
A bit late, and rather vague as its from memory and not using this control, so apologies in advance if its misleading.

I don't know the control you are using, but assuming it is designed along similar principles as other image-using MS controls (list view, tree view, etc.), you will probably find the images are sourced from an ImageList control.

So, once you have your ImageList populated and associated with your ExplorerBar, you may be able to dynamically set the image using the Ultra equivalent of ImageIndex.

Something along the lines (completely untested and untestable by me):

Code:
method public void addItem2ExplorerBar( input groupName as character, input itemName as character[B], 
               input itemImage as integer[/B] ):

    addGroup( groupName ).
    myExplorerBar:groups[groupname]:items:add( itemName, itemName ).
    [B]myExplorerBar:groups[groupname]:items[itemName]:ImageIndex = itemImage.[/B]
     
    return.

 end method.

If that is the approach, you can find related documentation here:
 
It turned out that I needed:
Code:
myItem:Settings:AppearancesSmall:Appearance:Image = myImage.

And then, to complete the job, I needed:
Code:
myGroup:Settings:AppearancesSmall:HeaderAppearance:Image = myImage.
myGroup:Settings:AppearancesSmall:NavigationPaneHeaderAppearance:Image = myImage.

The Progress part of all this is easy. Stumbling your way through all the MS & Infragistics libraries is an exercise in frustration. It really gives me an appreciation for Progress' documentation.
 
Back
Top