Thanks for the reply.

This is what I had originally but it gives you menu-buttons rather than a menu-bar and they don't look very professional.
The documentation states the following:

----------------
Menu descriptions usage:

   *

     As the |menu| parameter of the |td| or |lr| /toplevel/ widget.
     This menu's items will be displayed in a menubar accross the top
     of the window. These menus will behave according to the interface
     guidelines of their platforms. For every menu set as a menubar, a
     clone menu is made (see below).

   *

     As the |menu| parameter of a |menubutton| widget. This is the most
     usual way of using menu declarations.

------------------

The second usage is the one you're suggesting (which works perfectly as expected) and is indeed the one I first used. But the first usage doesn't seem to work. I've tried a strict Tk version which works well but I'd rather stick with QTk if at all possible.

If you've any ideas I'd be very grateful.

Regards

Mark

Torsten Anders wrote:
Try the following:

declare Main FileMenu QTk
[QTk]={Module.link ["x-oz://system/wp/QTk.ozf"]}
proc {Skip}
  skip
end
FileMenu=menu(command(text:"Open Solution"
             action:Skip)
         command(text:"Save Solution"
             action:Skip)
         separator
         command(text:"Import Data"
             action:Skip)
         command(text:"Export Solution"
             action:Skip)
         separator
         command(text:"Quit"
             action:Skip))
%%
Main=td(title:"A toplevel widget"
    geometry:geometry(width:1024 height:768)
    resizable:resizable(width:false height:false)
    menubutton(glue:w
           text:"File"
           menu:FileMenu))
%%
{{QTk.build Main} show}

Best
Torsten

On 17.09.2009, at 14:09, mark richardson wrote:

Hi,

Can anyone please help with creating a menubar in QTk. The documentation
states a menu description can be used with the 'menu' parameter of a
toplevel widget. But, when I try the code below

declare Main FileMenu QTk
[QTk]={Module.link ["x-oz://system/wp/QTk.ozf"]}
proc {Skip}
  skip
end
FileMenu=menu(command(text:"Open Solution"
             action:Skip)
         command(text:"Save Solution"
             action:Skip)
         separator
         command(text:"Import Data"
             action:Skip)
         command(text:"Export Solution"
             action:Skip)
         separator
         command(text:"Quit"
             action:Skip))

Main=td(title:"A toplevel widget"
   geometry:geometry(width:1024 height:768)
   resizable:resizable(width:false height:false)
   menu:FileMenu)

{{QTk.build Main} show}


      I get this error


%************************ Error: QTk module *********************
%**
%** Invalid parameter
%**
%** Parameter:   menu
%** Widget type: toplevel

Which seems to contradict what the documentation is saying.

regards

Mark


--
Mark Richardson
Research Assistant
University of Teesside, UK
Email: [email protected]
      [email protected]
Skype: mark.richardson.

_________________________________________________________________________________ mozart-users mailing list [email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

_________________________________________________________________________________ mozart-users mailing list [email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users


--
Mark Richardson
Research Assistant
University of Teesside, UK
Email: [email protected]
      [email protected]
Skype: mark.richardson.

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to