Hi all. for some reason, my hyperlink code is malfunctioning. I don't want any submenus, or regular menus. I just want a hyperlink to appear at the correct x,y. and when i mouse over it, i want it to underline, but when i take my mouse off of it, i want the underline to disappear.
For some reason, the link is not showing up..
Rem Project: links
Rem Created: Wednesday, August 11, 2010
Rem ***** Main Source File *****
`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!
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:
x=100
y=100
if mousex()>x and mousex()<x+text width(menu$) and mousey()>y and mousey()<y+text height(menu$)
underline_text(x,y,menu$) : menu=1
if mouseclick()=1
if file exist("C:\Program Files\Mozilla FireFox\firefox.exe")
execute file "firefox.exe","http://microsoft.com","C:\program files\Mozilla Firefox"
else
execute file "iexplore.exe","http://microsoft.com","C:\program files\Microsoft Internet Explorer"
endif
end
endif
else
text x,y,menu$ : menu=1
endif
return
function underline_text(x as integer, y as integer, text$ as string)
text x, y, text$
line x,y+text height(text$),x+text width(text$),y+text height(text$)
endfunction
and i need to be able to use it in any dbpro program.
thanks!
CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/