Last October and November we previewed the MarqueeDialog and the Progress Bar. These were inspired by the ObjectStudio New GUI Project, and they will be available in ObjectStudio 8.5.

We’ll talk more about that project in coming months, but for now, the approach is to create a new GUI library of Windows native widgets for ObjectStudio using DLLCC instead of C code.


  • No more primitives—100% Smalltalk code.
  • The code can be changed at any time.
  • Easier for support to send fixes to customers.
  • Customers can now modify or extend the code to their liking.
  • Easier enhancements of features not yet implemented.

Menu Items

The topic of this month’s article is adding bitmap graphics to your menus. This is a feature that was developed for the new GUI.  We were inspired by doing it there to make it available in the upcoming 8.5 release of ObjectStudio as well.

We all know the monochrome bitmaps in the System Menu of Windows.

We already had the checked menu items like in the ObjectStudio View menu.

Now we’ll also provide functionality to assign a custom bitmap to any menu item you want, like this example from the Mapping Tool shows:

Define the Bitmaps

Standard windows usage supports bitmaps with up to 256 colors. (Note that it is possible to use True Color bitmaps in menus by using the OWNERDRAW option.  However, for now, we will leave that as an exercise for the reader.) We tested with bitmaps ranging from 1 bit (monochrome) to 8 bits (256 colors) and they give the required result.

Once you have the desired bitmap, you need to define it in ObjectStudio. This can be done like this:

     loadNamed: #WriteDescriptor
     filename: ’e:\ObjectStudio8.5\icons\bmp\writedescriptor_256.bmp’
     onError: [nil].

Assign a Bitmap to the Menu

The bitmaps can be used on the menu bar and also on popup menus.  The easiest way to associate the bitmap with the menu item is in the openInitialization method.

menu := self mainForm menuBar menus at: 1.
menu setMenuItem: 2 bitmap: (Bitmap loadNamed: #WriteDescriptor).

In the first line, the first menu from the menu bar is assigned to the menu variable.

In the second line, the second menu item from the first menu gets the WriteDescriptor bitmap assigned.

When you assign the bitmap to a menu item in the openInitialization, the menu formItem is automatically updated. If you assign the bitmap later in the process, for example in a popup menu, then you need to manually do:

menu formItem update.

And there you have it. You’ll see the code in 8.5 in the new AbstractMenuItem hierarchy, along with changes to FormSubMenu and menu-related additions to OStudioSystemSupport. It’s a functionality that allows you to brighten up your GUI a bit, and more importantly, it points the way for future GUI enhancements for ObjectStudio.