EDITED after comment from MartinP belowMartinP wrote: Sun Feb 16, 2025 11:23 am Martin,
So you could use the second variable in the usr() command, as suggested by Zenerdiode, but this time put the address of the filename string there:
usr(addr(mc%()),addr(f$))
Code: Select all
TRY:
LOCAL f$(8),A%(4),m%
REM TRY to access database from a Top Level Menu List
REM NONE.odb does not exist Reports an error (try it)
REM CTEST is on Rampak C: TEST and MORE are on A:
REM As before 1st [ON/CLEAR] closes xFiles (cursor off)
REM 2nd [ON/CLEAR] Returns
TOP::
DO
m%=MENU("CTEST,TEST,MORE,NONE")
IF m%=0 :RETURN
ELSEIF m%=1 :f$="CTEST"
ELSEIF m%=2 :f$="TEST"
ELSEIF m%=3 :f$="MORE"
ELSEIF m%=4 :f$="NONE"
ENDIF
UNTIL m%>0
REM should check length of f$=LEFT$(f$,8)
REM XFILES
A%(1)=$DD41 :REM STD $41 store pointer to filename in $41-$42 (utw_s0)
A%(2)=$C603 :REM Function 3 - Find a file as from top-level menu.
A%(3)=$3FA8 :REM REM SWI $A8 XF$ENTR
A%(4)=$3901 :REM RTS, NOP
USR(ADDR(A%()),ADDR(f$))
GOTO TOP::
Daren, you could adapt this, don't forget to add some error trapping... I figure that if you don't know the name of the database to put it in the MENU then you will probably use xFiles anyway.Daren wrote: Thu Feb 13, 2025 1:57 am Is it possible to use the menu function in opl to give a folder like function?
Sincerely and in good faith
Martin
PS Thanks everyone I enjoyed that..
.