VW 2.5 menuBar hide, show 
Author Message
 VW 2.5 menuBar hide, show

Has anyone figured out how to dynamically hide and unhide the menuBar on a
VW ApplicationModel's window?

If not, I'll post after I've figured it out.


R & D and Support +1-410-489-9521, fax +1-410-489-9512

Sun, 13 Sep 1998 03:00:00 GMT  
 VW 2.5 menuBar hide, show


> Has anyone figured out how to dynamically hide and unhide the menuBar on a
> VW ApplicationModel's window?

I have some ugly ugly ugly code for VW 2.0 that will do the trick.  Unless 2.5
has significantly altered direction it will probably work in VW 2.5 as well.
The main reason for the ugliness is because VW does not give easy modification
access to menu bars.  In fact, it would make sense for menu bars to be like
normal widgets, but for some unknown and possibly unknowable reason menu bars
are a freakish conglomeration of stuff that can be nightmarish to deal with if
you're trying to do anything fancy.  Unless, of course, I have overlooked
another way to do this, which is entirely possible.

The layout of menu bars is controlled by a ReComposingComposite which is the
top-level component of the ApplicationWindow.  The 'hiding' of menu bars needs
to alter the layout of the menu bar wrapper component appropriately, then
cause the ReComposingComposite to recompose itself so that the menu bar is
hidden.  This requires two steps.  One is to get rid of the menu, and the other
is to alter the layout accordingly.  Here's an example that will cause the menu
in the launcher to disappear (I warned you, it's ugly):

    | composite |
    composite := VisualLauncher allInstances first builder window component.
    composite components first component menuChannel: nil asValue.
    composite components first layout: LayoutFrame new.
        bounds: composite bounds;  "Compute the new layouts"

To alternately hide and show the menu bar, the layout and menu need to be cached
and swapped in and out using code similar to the above, as appropriate.

As a general rule, I strongly discourage access through containment hierarchies,
and especially making assumptions about the location of components within a
composite.  And I went ahead and broke both of those rules by posting this
code.  Ugh.  If I have overlooked a more elegant way to do this, please post
it as I would happily lay the above code to rest.


Arbor Intelligent Systems                       Voice:     (313) 996-4238
http://ic.net/~aisys                            Fax:       (313) 996-4241
    "Poultry is one of those things which no person can get to the bottom
       of...It's just wings, and wings, and wings, till you are weary."

Sun, 13 Sep 1998 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. MAX still shows NI-VISA 2.5 after installation of 2.6

2. Help: VW Smalltalk 2.5

3. VW 2.5 startup screen HELP

4. Stone Age text editing in VW 2.5

5. Sound in VW 2.5

6. VW 2.5 Rubberbanding, howto?

7. VWave 1.0 (VW 2.5 may apply)

8. VW 2.5 MultiRow Select Table Widget Needed

9. VW 2.5 automated testing tools

10. Sound in VW 2.5

11. PC Serial Port from VW 2.5

12. HELP: VW 2.5 Mac -> WinNT Port


Powered by phpBB® Forum Software