home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!gdt!ccsmh
- From: ccsmh@gdt.bath.ac.uk (Mark Harding)
- Newsgroups: comp.lang.c++
- Subject: Re: TMenuBox ? in TVision
- Message-ID: <1992Jul29.082026.11424@gdt.bath.ac.uk>
- Date: 29 Jul 92 08:20:26 GMT
- References: <1992Jul28.124544.23107@scott.skidmore.edu>
- Organization: University of Bath, England
- Lines: 52
-
- pvonk@scott.skidmore.edu (Pierre VonKaenel) writes:
-
- >I'm using Borland's Turbo Vision to write a menu program for our
- >department. I have a TMenuBar defined with appropriate submenus.
- >What I need is a sub-submenu (or a pop up menu) and it seems TMenuBox
- >should do the trick. Unfortunately, there are no examples for using
- >this class.
-
- Because a lot of people have asked how to get sub-submenus in Turbo Vision,
- and because I keep sending the same response I thought I'd post the solution.
-
- Code is (c) 1992 Mark Harding - Bath University Computing Services
-
- TMenuBar *TVBids::initMenuBar( TRect r )
- {
- //
- // Define the submenu for selecting databases.
- //
- TMenuItem& index = *new TSubMenu("~C~itation Index",'C', hcNoContext) +
- *new TMenuItem("~S~cience", cmCScience, 'S', hcNoContext) +
- *new TMenuItem("S~o~cial Science", cmCSocial, 'o', hcNoContext) +
- *new TMenuItem("~A~rts and Humanities", cmCArt, 'A', hcNoContext );
-
- //
- // Define the submenu for selecting Citation Index year
- //
- TMenuItem& year = *new TSubMenu("Index ~Y~ear", 'Y', hcNoContext) +
- *new TMenuItem("1981", cmC1981, cmNone, hcNoContext) +
- *new TMenuItem("1982", cmC1982, cmNone, hcNoContext);
-
- //
- // Define the menu bar for the User Interface
- //
- TSubMenu& sub1 = *new TSubMenu( "~\360~", 0, 0 ) +
- *new TMenuItem( "~A~bout...", cmAboutCmd, 'A', hcNoContext) +
- *new TMenuItem( "~S~etup Comms...", cmSetupComms, 'S', hcNoContext) +
- *new TSubMenu( "~F~ile", kbAltF, 0) +
- *new TMenuItem( "~C~hange Dir...", cmCDir, 'C', hcNoContext) +
- newLine() +
- *new TMenuItem( "~D~OS Shell...", cmShell, 'D', hcNoContext) +
- *new TMenuItem( "~Q~uit" , cmQuit, 'Q', hcNoContext ) +
- *new TSubMenu( "~C~hange", kbAltC, 0 ) +
- //
- // The all important sub sub menus!!
- //
- index +
- year );
-
- r.b.y = r.a.y + 1;
-
- return(new TMenuBar(r, sub1));
- }
-