Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help me with these stupid questions

Status
Not open for further replies.

redstar

Programmer
Aug 29, 2000
1
SE
I would like to know how I can do menus, where you mark your choice with the arrows, like this:

choice1
>choice2
choice3

If I for an example press the up-arrow, it should mark "choice1" and so on.

I would also like to know if I can put images into my programs, like bmp:s.

(Pardon my english, and thank You)
 
As far as images go, I'm not too knowledgeable.

However, here's an example of a menu:

[tt]
LOCATE 14,35:pRINT "choice 1"
LOCATE 16,35:pRINT "choice 2"
LOCATE 18,35:pRINT "choice 3"
row=14
DO
SELECT CASE INKEY$
CASE CHR$(13)
'routine to handle enter key
CASE CHR$(0) + CHR$(80)
GOSUB DOWNKEY
CASE CHR$(0) + CHR$(72)
GOSUB UPKEY
END SELECT
IF OLDROW <> ROW AND OLDROW <> 0 THEN LOCATE OLDROW, 30: PRINT &quot; &quot;
IF OLDROW <> ROW THEN LOCATE ROW, 30: PRINT &quot;>&quot;
OLDROW = ROW
LOOP

UPKEY:
OLDROW = ROW
IF ROW > 14 THEN ROW = ROW - 2
RETURN
DOWNKEY:
OLDROW = ROW
IF ROW < 18 THEN ROW = ROW + 2
RETURN
[/tt]


You just print your options two rows apart and set up a loop that effectively traps the up and down arrow keys and moves the little > around. Then write your routine to handle the enter key.
 
redstar,
to answer your images question:
yes you can load .bmp images but the loaders
(subroutines that translate .bmp's and put
them on the screen, which you can get on
most QB download sites) are slow and .bmp
files can often be huge by Qbasic standards
.bsv(bsave or binary) files are the way to go.
You can load a .bmp on screen then save the
screen image as a .bsv
if you are drawing sprites check out acid works draw
(just do a web search for acidworks) you can draw .bmp's
and binaries and convert between the two. the only limitation of the program is the 50x50 pixel limit.

good luck in your struggles, [sig]<p>Lupine<br><a href=mailto:RobertCorrina@patownsend.com>RobertCorrina@patownsend.com</a><br><a href= > </a><br> [/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top