Sure! The 'customer' is always correct
Actually that takes away one if lol.
edit:
is this up to your specifications???? hahaha nah it's cool i always love suggestions =P
sync on
sync rate 0
dim WinMenu(100, 100, 15)
dim WinMenuText$(100, 100)
dim MF_SPACER(1) : dim MF_CHILD(1)
MF_SPACER(1) = 2 : MF_CHILD(1) = 1
menu = CreateMenu()
m2 = CreateMenu()
rem AppendMenu will add a item to the specified menu
rem the flags are used to specify a Spacer(horizontal line) or a child menu
rem Item ID is what is return from the ShowMenu Function. they must be unique to EVERY item
rem if you do specify a spacer then the text you entered will be erased.
AppendMenu(menu, 0, 1, "Undo")
AppendMenu(menu, MF_SPACER(1), 0, "")
AppendMenu(menu, 0, 2, "Cut")
AppendMenu(menu, 0, 3, "Copy")
AppendMenu(menu, 0, 4, "Paste")
AppendMenu(menu, MF_SPACER(1), 0, "")
AppendMenu(menu, 0, 5, "Delete")
AppendMenu(menu, MF_SPACER(1), 0, "")
rem to add a child menu specify the MF_CHILD flag and the menu as the
rem item ID
AppendMenu(menu, MF_CHILD(1), m2, "Sub-Menu")
ink rgb(0,0,255),0
box 0,0,16,16
get image 1,0,0,16,16
rem to add a icon to the item put you image number
rem in brackets like this <00001> in right justified
rem 5 digits. so 10 would be <00010> and 11 is <00011>
AppendMenu(m2, 0, 6, "<00001>Sub-Menu 1")
AppendMenu(m2, 0, 7, "Sub-Menu 2")
do
mc = mouseclick()&2
ink rgb(255,255,255),0
print LastMenu
if mc
repeat : sync : until mouseclick() = 0
LastMenu = ShowMenu(menu, mousex(), mousey() )
endif
sync
cls
loop
function CreateMenu()
index = -1
for x=0 to 100
if Winmenu(x, 0, 0) = 0
Index = x
exit
endif
next x
if index = -1 then exitfunction -1
WinMenu(index, 0, 0) = 1
WinMenu(index, 0, 1) = 0
WInMenu(index, 0, 3) = 8
WinMenu(index, 0, 2) = 4
endfunction index
function DestroyMenu(menu)
for x=0 to 100
for y = 0 to 15
WinMenu(menu, x, y) = 0
next x
next y
endfunction
function AppendMenu(menu, flags, itemID, itemText$)
if WinMenu(menu, 0, 0) = 0 then exitfunction -1
item = WinMenu(menu, 0, 1)
if item = 0 then item = 1
if item = 101 then exitfunction -1
WinMenu(menu, item, 0) = 1
WinMenuText$(menu, item) = itemText$
if (flags|MF_SPACER(1)) = flags
itemText$ = ""
WinMenu(menu, 0, 3) = WInMenu(menu, 0, 3) + 8
else
if mid$(itemText$, 1) = "<" and mid$(itemText$, 7) = ">"
itemText$ = right$(itemText$, len(ItemText$)-7)
endif
if text width(itemText$)+30 > WinMenu(menu, 0, 2)
WinMenu(menu, 0, 2) = text width(itemText$) + 45
endif
WinMenu(menu, 0, 3) = WinMenu(menu, 0, 3) + 15
endif
WinMenu(menu, item, 1) = flags
WinMenu(menu, item, 2) = itemID
WinMenu(menu, 0, 1) = item+1
endfunction item
function ShowMenu(menu, x, y)
oldCurrentBitmap = Current Bitmap()
set current bitmap 0
img = 65535
Get image img,0,0,screen width(),screen height()
MouseUp = 0 : mouseclick = 0
Selected = 0
width = WinMenu(menu, 0, 2) : heiht = WinMenu(menu, 0, 3)
x2 = x + width : y2 = y + height
if x2 > screen width()
x2 = x
x = x - width
endif
if y2 > screen height()
y2 = y
y = y - height
endif
while MouseUp = 0
paste image img,0,0
Selected = CheckMenu(menu, x, y)
if mouseclick()
if Selected = -1
mouseup = 1
else
mouseclick = 1
endif
else
if mouseclick = 1
MouseUp = 1
endif
endif
DrawMenu(menu, x, y)
sync
endwhile
WinMenu(menu, 0, 4) = 0
if selected = -1 then selected = 0
set current bitmap oldCurrentBitmap
endfunction Selected
function CheckMenu(menu, x, y)
OldI = 0
Selected = 0 : MaybeSelected = 0
x2 = x + WinMenu(menu, 0, 2)
y2 = y + WinMenu(menu, 0, 3)
osy = 0
osx = 0
Result = 0
Selected = 0
iy = y+4
for i=1 to WinMenu(menu, 0, 1)-1
x2 = x+WinMenu(menu, 0, 2)
if (WInMenu(menu, i, 1)|MF_SPACER(1)) ! WinMenu(menu, i, 1)
if mousex() > x and mousex() < x2
if mousey() > iy and mousey() < iy+15
WinMenu(menu, 0, 4) = i
Selected = Winmenu(menu, I, 2)
if (WinMenu(menu, I, 1) | MF_CHILD(1)) = WinMenu(menu, I, 1)
Result = 0
else
Result = Selected
endif
endif
endif
if (WinMenu(menu,i,1)|MF_CHILD(1)) = WinMenu(menu, i, 1)
if Winmenu(menu, 0, 4) = i
osx = x2 : osy = iy
OldI = i
Selected = 0
exit
endif
endif
iy = iy + 15
else
if mousex() > x and mousex() < x2
if mousey() > iy and mousey() < iy+8
WInMenu(menu, 0, 4) = 0
Selected = 0
Result = 0
endif
endif
iy = iy + 8
endif
next i
if MouseInside(x, y, WinMenu(menu, 0, 2), WinMenu(menu, 0, 3)) = 0
Selected = 0
Result = 0
current = WInMenu(menu, 0, 4)
if (WinMenu(menu,current,1) | MF_CHILD(1)) ! WinMenu(menu, current, 1) then WinMenu(menu, 0, 4) = 0
endif
if OldI > 0
if Selected = 0 and (WinMenu(menu, OldI, 1) | MF_CHILD(1)) = WinMenu(menu, OldI, 1)
Selected = 0
subM = WinMenu(menu, OldI, 2)
if (osx+Winmenu(subM, 0, 2)) > screen width()
osx = x - Winmenu(subM, 0, 2)
endif
if (osy+WInMenu(subM, 0, 3)) > screen Height()
osy = osy - WinMenu(subM, 0, 3)
endif
MaybeSelected = CheckMenu(WinMenu(menu, OldI, 2), osx, osy)
if MaybeSelected > 0
Result = MaybeSelected
endif
endif
endif
endfunction Result
function DrawMenu(menu, x, y)
if WinMenu(menu, 0, 0) = 0 then exitfunction -1
width = WinMenu(menu, 0, 2) : height = WinMenu(menu, 0, 3)
x2 = x + width : y2 = y + height
ink rgb(212,208,200),0
box x,y,x2,y2
ink rgb(255,255,255),0
box x+1,y+1,x2-1,y+1
box x+1,y+1,x+1,y2-1
ink rgb(128,128,128),0
box x+1,y2-1,x2-1,y2-1
box x2-1,y+1,x2-1,y2-1
ink rgb(5,5,5),0
box x2,y,x2,y2
box x,y2,x2,y2
size = text size()
set text size 15
style = text style()
set text to normal
font$ = text font$()
set text font "Times New Roman",1
ink rgb(5,5,5),0
ty = y+4
for i = 1 to WinMenu(menu,0,1)-1
if WinMenu(menu, i, 0) = 1
if (WinMenu(menu, i, 1)|MF_SPACER(1)) ! WinMenu(menu, i, 1)
if WinMenu(menu, 0, 4) = I
ink rgb(0,0,255),0
box x+4,ty,x+width-4,ty+15
ink rgb(255,255,255),0
else
ink rgb(5,5,5),0
endif
imgNum$ = left$(right$(left$(WinmenuText$(menu, i), 7), 6), 5)
text$ = right$(WinMenuText$(menu, i), len(WinmenuText$(menu, i))-7)
imgNum = val(imgNum$)
if imgNum > 0
text x+22,ty,Text$
if Image Exist(imgNUm) then paste image imgNum,x+4,ty,1
else
text x+22,ty,WinMenuText$(menu, i)
endif
if (WinMenu(menu, i, 1) | 1) = WinMenu(menu, i, 1)
ax = x2-10 : th = 7 : ay = ty+4
for var=1 to 4
box ax,ay,ax,ay+th
th = th - 2 : ay = ay + 1 : ax = ax + 1
next x
if WinMenu(menu, 0, 4) = i
sx = x + width - 1 : sy = ty : s = WinMenu(menu, i , 2)
if (sx+WinMenu(s, 0, 2)) > screen width()
sx = x - Winmenu(s, 0, 2)
endif
if (sy+Winmenu(s, 0, 3)) > screen Height()
sy = ty - WinMenu(s, 0, 3)
endif
DrawMenu(WinMenu(menu, i, 2), sx, sy)
endif
endif
ty = ty + 15
else
ink rgb(128,128,128),0
box x+4,ty+4,x+width-4,ty+4
ink rgb(255,255,255),0
box x+4,ty+5,x+width-4,ty+5
ty = ty + 8
endif
endif
next i
if (1|style) = style then set text to italic
if (2|style) = style then set text to bold
set text font font$
set text size size
endfunction
function MouseInside(X, Y, width, height)
mx = mousex() : my = mousey() : x2 = x+width : y2 = y + height
if mx >= x and mx <= x2 and my >= y and my <= y2 then exitfunction 1
endfunction 0
New Site! Check it out \/