03-16-2005, 04:30 PM
Here is my attempt at a button menu that does not need the usual Windows buttons, to do as you wish once a file is selected. I failed to get it to reconise the usual X abort, as I had to avoid the use of INKKEY$ in the original code.
Gordon
Gordon
Code:
Screen 19
#include once "win\winbase.bi"
#inclib "kernel32"
Declare Function Sound Alias "Beep" (ByVal dwFreq As Integer, ByVal dwDuration As Integer) As Integer
DIM x AS INTEGER, y AS INTEGER, buttons AS INTEGER
DEFSNG A-Z
dim f$(100)
COLOR 14,1
locate 2, 46 : print " BUTTON MENU "
locate 3, 40 : print " Maximum of 80 options. "
locate 1, 92 : print "**ABORT**"
T = 3 : V = 5
for B = 1 to 80
locate V, T : print " ";
T = T + 20
if T > 90 then T = 3 : V = V + 2
next B
t$ = DIR$("*.*") : C = 1 : T = 3 : V = 5
Do while t$ <> ""
if t$ = "." or t$ = ".." or instr(t$,".") = 0 then goto miss
if len(t$) > 15 then txt$ = left$(t$,15) else txt$ = t$
locate V, T : print " ";txt$
f$(C)=t$
C = C + 1 : T = T + 20
if T > 90 then T = 3 : V = V + 2
miss:
t$ = DIR$("")
loop
check: C = C -1 : fin = 0 : sound 1000, 200 : color 12,0
' Set video mode and enter loop
DO
' Get mouse x, y and buttons. Discard wheel position.
GETMOUSE x, y, , buttons
LOCATE 1, 1
IF x < 0 THEN
print " ";
ELSE
PRINT x; y;" ";
IF buttons AND 1 THEN fin = 1
IF buttons AND 2 THEN fin = 2
IF buttons AND 4 THEN fin = 3
END IF
LOOP WHILE fin = 0
if x > 725 and Y < 16 then sound 200, 200 : end
if x < 15 or x > 790 then goto check
if y < 62 or y > 558 then goto check
uy = 62 : ly = 78 : row = -1
for dat = 1 to 18
if y > uy and y < ly then row = dat -1
uy = uy + 32 : ly = ly + 32
next dat
row = row * 5
ux = 15 : lx = 150 : p = 0
for dat = 1 to 5
if x > ux and x < lx then p = dat
ux = ux + 175 : lx = lx + 175
next dat
if dat = 0 or row < 0 or p = 0 then goto check
p = p + row
rem if p > C+10 then goto check
opt$ = f$(p)
if opt$="" then goto check
locate 1,1 : print opt$; " SELECTED";
sleep 1000: goto check