home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11712 < prev    next >
Encoding:
Internet Message Format  |  1992-07-28  |  2.1 KB

  1. Path: sparky!uunet!mcsun!uknet!gdt!ccsmh
  2. From: ccsmh@gdt.bath.ac.uk (Mark Harding)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: TMenuBox ? in TVision
  5. Message-ID: <1992Jul29.082026.11424@gdt.bath.ac.uk>
  6. Date: 29 Jul 92 08:20:26 GMT
  7. References: <1992Jul28.124544.23107@scott.skidmore.edu>
  8. Organization: University of Bath, England
  9. Lines: 52
  10.  
  11. pvonk@scott.skidmore.edu (Pierre VonKaenel) writes:
  12.  
  13. >I'm using Borland's Turbo Vision to write a menu program for our
  14. >department.  I have a TMenuBar defined with appropriate submenus.
  15. >What I need is a sub-submenu (or a pop up menu) and it seems TMenuBox
  16. >should do the trick.  Unfortunately, there are no examples for using
  17. >this class.
  18.  
  19. Because a lot of people have asked how to get sub-submenus in Turbo Vision,
  20. and because I keep sending the same response I thought I'd post the solution.
  21.  
  22. Code is (c) 1992 Mark Harding - Bath University Computing Services
  23.  
  24. TMenuBar *TVBids::initMenuBar( TRect r )
  25. {
  26.     //
  27.     //    Define the submenu for selecting databases.
  28.     //
  29.     TMenuItem& index  = *new TSubMenu("~C~itation Index",'C', hcNoContext) +
  30.     *new TMenuItem("~S~cience", cmCScience, 'S', hcNoContext) +
  31.     *new TMenuItem("S~o~cial Science", cmCSocial, 'o', hcNoContext) +
  32.     *new TMenuItem("~A~rts and Humanities", cmCArt, 'A', hcNoContext );
  33.  
  34.     //
  35.     //    Define the submenu for selecting Citation Index year
  36.     //
  37.     TMenuItem& year = *new TSubMenu("Index ~Y~ear", 'Y', hcNoContext) +
  38.         *new TMenuItem("1981", cmC1981, cmNone, hcNoContext) +
  39.         *new TMenuItem("1982", cmC1982, cmNone, hcNoContext); 
  40.  
  41.     //
  42.     //    Define the menu bar for the User Interface
  43.     //
  44.     TSubMenu& sub1 = *new TSubMenu( "~\360~", 0, 0 ) +
  45.     *new TMenuItem( "~A~bout...", cmAboutCmd, 'A', hcNoContext) +
  46.     *new TMenuItem( "~S~etup Comms...", cmSetupComms, 'S', hcNoContext) +
  47.     *new TSubMenu( "~F~ile", kbAltF, 0) +
  48.     *new TMenuItem( "~C~hange Dir...", cmCDir, 'C', hcNoContext) +
  49.     newLine() +
  50.     *new TMenuItem( "~D~OS Shell...", cmShell, 'D', hcNoContext) +
  51.     *new TMenuItem( "~Q~uit" , cmQuit, 'Q', hcNoContext ) +
  52.     *new TSubMenu( "~C~hange", kbAltC, 0 ) +
  53. //
  54. // The all important sub sub menus!!
  55. //
  56.     index +
  57.     year );
  58.  
  59.     r.b.y = r.a.y + 1;
  60.  
  61.     return(new TMenuBar(r, sub1));
  62. }
  63.