Re: making a very simple menu in DOS



Tim Ricard wrote:
I originally posted this in comp.lang.c but they recommended I ask
here:

Good evening,

I was thinking about making a very simple DOS based (console) menu for
a project that i am working on, but I have no idea where to start for
something like this. I don't want a real complicated menu, just a title
and about three options. I will add more stuff once I know what it is
that I am doing. The program will also be written in C.

Just to clarify, I am not talking about making a printf/fscanf menu. I
want to make a menu that has static information on the screen. I want
to make a simple shell where pressing the cursor can allow for you to
scroll over top of the various menu items and *enter* will select the
desired item.


Thanks in advance

Tim


Well ... You need to know exactly where each menu item is located on the screen but then again you need to put them there so that shouldn't be too hard. Since you will probably want to high-light the item when the cursor is over it and need to know where the magic key is pressed anyway you also must read the bios to obtain the cursor location on the screen. When both coincide and the key (that you have *instructed the user* to use to select an item - assume nothing!) is pressed invoke the code to run the selected item.


For what you want a column of text or pictures of function keys and what each function key does might be easiest. It doesn't matter where they are located on the screen and their use is nearly as old as computers. ASCII art is old stuff and well documented on the net. Now you just need to display (puts) the art or simple text and scan (looped getch) for a function key press or the Escape key (always provide an out). Something truly simple yet functional as this for example:

.....
.....
.....
Press F10 to enjoy my superb bling
Press F11 for Joe Blow's so-so bling
Press F12 to exit this menu

But thats kinda old hat and a bit limiting and whats to stop the user from pressing return or whatever key and scrolling the stuff off the screen?

Since you need to take control of both the menu and the user why not switch to a graphics mode, paint some labeled buttons and use the mouse to select a menu item? The upshot is all user input is trapped and you place things on the screen in response to user input, rather than the other way around where you chase what the user may or may not put on the screen. Its way sexier and I think you will find it more intuitive to more people in this day and age. If you really want to get fancy you could do a set of up and down buttons to graphically show that the mouse is over the button and is about to be pressed. But all you really need do is place the text, track the mouse pointer location and loop a scan for a click over your button or text. If the click is over an item you placed on the screen switch the screen back to text mode and run the item's code or spawn it out to DOS. C source for mouse routines is widely available on the net. Hey, even I could post some 'read the bios' mouse source that I developed for my own use before the net was commonly available. But really, your C package should include some mouse and graphics routines.

John

.



Relevant Pages

  • Re: Oh, for the daze of Win98?
    ... Cirrus Logic CL-GD5428 graphics chip can do 1280x1024 ... ... I played around with it some more, tried installing some more DOS ... games and programs, but lost interest. ...
    (alt.comp.hardware.pc-homebuilt)
  • Re: Bit Rot (was Re: We are doomed..)
    ... Many graphical programs were written for DOS. ... system with very crappy graphics ability. ... Hardware that had hardware ...
    (rec.games.roguelike.development)
  • Re: [LogoForum] Logo compatiblilty and a little rug
    ... UCBLOGO and BL usually figure out correctly what kind of graphics board ... This is also done with a DOS ... note that Logo writes directly to the screen and is therefore ... incompatible with "screen accelerator" TSRs. ...
    (comp.lang.logo)
  • Re: Windows xp hangs, clock stops, cursor continues to be movable
    ... inactive, clock stops at the time of failure, and keyboard is dead, ... but I can move the cursor all over the place. ... (Be sure to scroll down to SeaTools for DOS.) ...
    (microsoft.public.windowsxp.general)
  • Re: ASCII Editor
    ... garyr wrote: ... I just can't get the cursor to go where I wanted. ... It works fine if all you want to use are the predefined graphics but it ... I believe that an ASCII editor should first ...
    (sci.electronics.design)