Rough & ready - could be tidied up, especially with regard to using an array & variables. You can easily turn this into a proper Windows-style menu/submenu with the relevant screen formatting.
This is the guts of the code - function over form!
Nowhere near as bulky as it looks - mainly remarks for n00bs
`Menu ~ Submenu ~ Internal Hyperlinking ~ Clickable Screen Areas
`Rough & ready - could be tidied up, especially with regard to
`using an array & variables.
`You can easily turn this into a proper Windows-style menu/submenu
`with the relevant screen formatting.
`This is the guts of the code - function over form!
origin$="click here"
menu$="and again..."
submenu$="DB Rules!"
menu=0
sub=0
do
`mouse position
x=mousex()
y=mousey()
cls
`the original screen
text 200,200,origin$
`-------------------
`if the menu was requested in the last loop - show it
if menu=1 then gosub clicker
`----------------------------------------------------
`if the submenu was requested in the last loop - show it
if sub=1 then gosub submenu
`-------------------------------------------------------
`if the menu is clicked, then show the submenu
if x>100 and x<100+(text width(menu$)) and y>100 and y<100+(text height(menu$)) and mouseclick()=1 and menu=1 then gosub submenu
`-------------------------------------------
`if the menu's showing & you want to hide it - click any non-linked area of the screen to reset
if menu=1 and mouseclick()=1 and sub=0 then menu=0
`-------------------------------------------
`this is the final order which you're calling - it forces the submenu to do something
`in this instance, it resets the program
`you could make it load something else by altering after the 'then'
if menu=1 and sub=1 and mouseclick()=1 then wait 1000 : sub=0
`-----------------------------------------------
`tidy the pixel positions up with an array and variables 'xstr' & 'ystr'
`so, for instance...
`if x>xstr and x<xstr+(text width... etc.
`these are DarkBASIC's equivalent to html 'hyperlinks'
`you activate a clickable area of the screen
`n.b. this is set up to allow you to click any area of the screen, in order to reset the menu
if x>200 and x<200+(text width(origin$)) and y>200 and y<200+(text height(origin$)) and mouseclick()=1 and menu=0 then gosub clicker
if x>100 and x<100+(text width(menu$)) and y>100 and y<100+(text height(menu$)) and mouseclick()=1 and menu=1 then sub=1 : gosub submenu
`--------------------------------------------------------------------------------------------
loop
clicker:
text 100,100,menu$ : menu=1
return
submenu:
text 300,300,submenu$ : sub=1
return
I have an XP3000+, 1.5gb DDR333, a 6600GT and I'm programming 3k text-based exe's?!