Pulldown Menus

 BBS: Inland Empire Archive
Date: 06-01-92 (02:00)             Number: 178
From: MARK BUTLER                  Refer#: NONE
  To: BRYAN HOOVER                  Recvd: NO  
Subj: Pulldown Menus                 Conf: (2) Quik_Bas
 On 05-30-92 BRYAN HOOVER wrote to ALL...

 BH> OK, I've got the menuing part.  That is, I know how to make a
 BH> menu with a highlighted, shall we say "cursor bar", but, how do
 BH> you make it pop down over the existing screen without
 BH> overwriting what's already there?  I know a little about using
 BH> video pages.  From what I've gathered though, you can display
 BH> only one video page at a time. Whats the "usual" technique for
 BH> pulldown menus?  I'd rather avoid using assembly if possible.
 BH> I'm not quite ready for that.  I want to be able to understand
 BH> what I'm doing and for now, I know nothing about assembly
 BH> language.  Perhaps if my neighbors were not so noisy I could
 BH> figure out something on my own.  Any ideas?, my head's killing
 BH> me.

 Well, I don't know about "usual" but "simple", yes. You can use PCOPY
 to accomplish this quite easily. In the demo code that follows
 'frontpage%' is the current screen page 0. You save a copy of it to
 the second page or backpage% (page 1). Then you display your menu.
 After a selection is made and you want your menu to "disappear" you
 just copy the backpage% to frontpage% and it's gone, with the original
 screen contents reappearing undisturbed. Try this demo to see this in
 ------------------------8< CUT HERE 8<-------------------------------
 CONST frontpage% = 0, backpage% = 1
 DECLARE SUB Drawbox (Uprow%, Ltcol%, Lorow%, Rtcol%)

    COLOR 7, 1
    FOR i% = 1 TO 2000
        PRINT CHR$(176);
    COLOR 0, 7
        LOCATE 1, 1
        PRINT "  This is a dummy Menu bar - press any ";
        PRINT "key to pull down a 'menu' "; SPACE$(15);
        '*** copy the current page 0 to page 1
        PCOPY frontpage%, backpage%
        LOCATE 1, 1
        PRINT " Press CTRL-BRK to quit or any other key to continue";
        PRINT SPACE$(28);
        Drawbox 2, 2, 10, 15  '<---- draw a dummy "menu box"
        LOCATE 3, 3
        COLOR 7, 0
        PRINT " Dummy      "
        COLOR 0, 7
        LOCATE 4, 4
        PRINT "Menu"
        LOCATE 5, 4
        PRINT "Selection"
        LOCATE 6, 4
        PRINT "Items"
        LOCATE 7, 4
        PRINT "Press"
        LOCATE 8, 4
        PRINT "Any"
        LOCATE 9, 4
        PRINT "Key"
        '*** copy page 1 back to page 0 and the menu "disappears"
        PCOPY backpage%, frontpage%

 SUB Drawbox (Uprow%, Ltcol%, Lorow%, Rtcol%)
    Wide% = (Rtcol% - Ltcol%) - 1
    LOCATE Uprow%, Ltcol%
    PRINT CHR$(218); STRING$(Wide%, CHR$(196)); CHR$(191);
    FOR i% = Uprow% + 1 TO Lorow% - 1
        LOCATE i%, Ltcol%
        PRINT CHR$(179); SPACE$(Wide%); CHR$(179);
    NEXT i%
    LOCATE Lorow%, Ltcol%
    PRINT CHR$(192); STRING$(Wide%, CHR$(196)); CHR$(217);
 ------------------------8< CUT HERE 8<-------------------------------

 Hope this helps...

        ------------> MHB :-)

... OFFLINE 1.37 * Open the pod bay doors ...HAL? I said op&#@ NO CARRIER

--- WM v2.01/91-0012
 * Origin: Com-Dat BBS  Hillsboro, OR.  HST (503) 681-0543 (1:105/314)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET