Posts: 17
Threads: 5
Joined: Feb 2002
hi again.
wanted to know, what code would do the following:
when u press a key for example, or infact when u run the program, a menu appears BUT, I want this menu to highlight the text it is currently at and u have to use the up and down arrow keys to select the menu item.....
like for example, same or similar stuff when u load up XP/2K, and u ht F8 to select options (like safe mode etc..) similar to that?
thanks
Posts: 2,020
Threads: 24
Joined: Jun 2002
wait, you can't properly access the keyboard or use text formatting, but you want to make an gui that accesses the internet?
*concerned frown*
well, anyhow, the arrow keys, using
inkey$, is chr$(75) and chr$(77) for left and right, and chr$(72 and chr$(80) for up and down, if my memory serves me correctly.
as for text formatting, if you dont want to access the text buffer, you can just use
color foreground, background and print out the same text to change the color.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Posts: 17
Threads: 5
Joined: Feb 2002
i thiink u got the wrong end of the stick
no, i ain't making a GUI (but it is nearly done) this is got nothing to do with a GUI
simple DOS window, what i want is a menu which will show options, then some sorta "bar" will allow u to select a highlighted option
???
Posts: 480
Threads: 24
Joined: Mar 2003
Code:
MaxChoice% = 5 'set number of menu choices
DIM Menu$(1 TO MaxChoice%) 'create array of choices
Menu$(1) = "Print text in Blue " 'fill array with text
Menu$(2) = "Print text in Green "
Menu$(3) = "Print text in Cyan "
Menu$(4) = "Print text in Red "
Menu$(5) = "Print text in Purple "
CurrentChoice% = 1 'sets initial highlighted spot
WHILE INKEY$ <> "": WEND 'clear keyboard buffer
DO
CLS
FOR i% = 1 TO MaxChoice%
IF CurrentChoice% = i% THEN
COLOR 0, 7 'highlight this option
END IF
PRINT i%; Menu$(i%)
COLOR 7, 0
NEXT i%
DO
k$ = UCASE$(INKEY$) 'get a keystroke into k$
LOOP UNTIL k$ <> ""
SELECT CASE k$
CASE CHR$(0) + "H" 'up arrow key pressed
CurrentChoice% = CurrentChoice% - 1
IF CurrentChoice% = 0 THEN
CurrentChoice% = MaxChoice%
END IF
CASE CHR$(0) + "P" 'down arrow key pressed
CurrentChoice% = CurrentChoice% + 1
IF CurrentChoice% > MaxChoice% THEN
CurrentChoice% = 1
END IF
END SELECT
LOOP UNTIL k$ = CHR$(13) 'exit when enter is pressed
COLOR CurrentChoice%, 0
PRINT
PRINT "You have selected option"; CurrentChoice%
WHILE INKEY$ <> "": WEND
WHILE INKEY$ = "": WEND
SYSTEM
*peace*
Meg.