oh sorry my english is not that good sometimes but I made sven function mimic buttons like standard windows. it doesn't work 100% of the time due to the "wait 10" part and it tends to slow down your program.
function button(cx,cy,text$)
tx = text width(text$)/2
ty = text height(text$)/2
mouseover =0
pressed = 0
mclick# = 1
if mousex() > cx - tx - 10 and mousex() < cx + tx + 10
if mousey() > cy - ty - 5 and mousey() < cy + ty + 5
mouseover = 1
endif
endif
if mouseover = 1
rem turns button red when mouse is over it
box cx - tx - 11, cy - ty - 6, cx + tx + 11, cy + ty + 6,RGB(0,0,0),RGB(0,0,0),RGB(0,0,0),RGB(0,0,0) `border
box cx - tx - 10, cy - ty - 5, cx + tx + 10, cy + ty + 5,RGB(196,96,96),RGB(128,128,128),RGB(196,96,96),RGB(128,128,128)
else
rem button is grey since mouse isn't over it
box cx - tx - 11, cy - ty - 6, cx + tx + 11, cy + ty + 6,RGB(0,0,0),RGB(0,0,0),RGB(0,0,0),RGB(0,0,0) `border
box cx - tx - 10, cy - ty - 5, cx + tx + 10, cy + ty + 5,RGB(96,96,96),RGB(128,128,128),RGB(96,96,96),RGB(128,128,128)
endif
ink 0,0
center text cx,cy - ty, text$
if mouseover = 1 and mouseclick() = 1
rem turns box blue when you press it down like standard button
box cx - tx - 11, cy - ty - 6, cx + tx + 11, cy + ty + 6,RGB(0,0,0),RGB(0,0,0),RGB(0,0,0),RGB(0,0,0) `border
box cx - tx - 10, cy - ty - 5, cx + tx + 10, cy + ty + 5,RGB(96,96,196),RGB(96,96,196),RGB(96,96,196),RGB(96,96,196)
ink 0,0
center text cx,cy - ty, text$
mclick# = 0 : wait 10
endif
if mouseover = 1 and mouseclick() = 0
if mclick# = 0
pressed = 1
endif
endif
endfunction pressed