I did mean click on button detection, that has to be the easiest part of GUI.
And it's only enhances that doesn't support windows things, otherwise, you could make them all from scratch.
`Setup
sync on
Set display mode 1024,768,16
Set window on
`System Colour
Sys_Col=rgb(100,100,100)
system_col(1,sys_col)
`Load button bitmaps and grab images
`Create Button Images
create bitmap 1,100,50 : set current bitmap 1
ink rgb(200,200,200),0 : box 1,1,100,50
ink rgb(20,20,20),0
line 1,1,100,1 : line 1,2,99,2 : line 1,1,1,50 : line 2,1,2,49
ink rgb(230,230,230),0
line 1,49,100,49 : line 1,50,99,50 : line 99,2,99,50 : line 100,1,100,50
get image 10,0,0,100,50
set current bitmap 0 : delete bitmap 1
create bitmap 1,100,50 : set current bitmap 1
ink rgb(230,230,230),0 : box 1,1,100,50
ink rgb(100,100,100),0
line 1,1,100,1 : line 1,2,99,2 : line 1,1,1,50 : line 2,1,2,49
ink rgb(255,255,255),0
line 1,49,100,49 : line 1,50,99,50 : line 99,2,99,50 : line 100,1,100,50
get image 11,0,0,100,50
set current bitmap 0 : delete bitmap 1
create bitmap 1,100,50 : set current bitmap 1
ink rgb(100,100,100),0 : box 1,1,100,50
ink rgb(230,230,230),0
line 1,1,100,1 : line 1,2,99,2 : line 1,1,1,50 : line 2,1,2,49
ink rgb(20,20,20),0
line 1,49,100,49 : line 1,50,99,50 : line 99,2,99,50 : line 100,1,100,50
get image 12,0,0,100,50
set current bitmap 0 : delete bitmap 1
create bitmap 1,100,50 : set current bitmap 1
ink rgb(200,200,200),0 : box 1,1,100,50
ink rgb(20,20,20),0
line 1,1,100,1 : line 1,2,99,2 : line 1,1,1,50 : line 2,1,2,49
ink rgb(230,230,230),0
line 1,49,100,49 : line 1,50,99,50 : line 99,2,99,50 : line 100,1,100,50
ink rgb(20,20,20),0
for l=1 to 100 step 2
dot l,1
dot l,10:dot l,20:dot l,30:dot l,40:dot l,50
next l
get image 13,0,0,100,50
set current bitmap 0 : delete bitmap 1
`Create window
create bitmap 1,50,50 : set current bitmap 1
ink rgb(128,128,128),0 : box 0,0,50,50
get image 14,0,0,50,50
set current bitmap 0 : delete bitmap 1
`Button Data
dim Button_State(20)
for b=1 to 20
Button_state(b)=1
next b
`Window data
type window
x as integer
y as integer
sx as integer
sy as integer
state as boolean
selected as boolean
endtype
dim window(100) as window
`Data for 2 windows
window(50).x=100
window(50).y=100
window(50).sx=500
window(50).sy=400
window(50).state=1
window(51).x=200
window(51).y=200
window(51).sx=300
window(51).sy=200
window(51).state=1
`Text
set text font "tahoma" : set text size 20
`Setup Sprites
draw sprites first
`*Main Loop*
Do
`Create window
for w=50 to 51
makewindow(w,window(w).x,window(w).x,window(w).sx,window(w).sy,"Window")
next w
`A few window buttons
pushbutton(10,window(50).x+20,window(50).y+50,100,30,"A button")
pushbutton(11,window(50).x+20,window(50).y+90,100,30,"Another")
pushbutton(12,window(51).x+20,window(51).y+50,100,30,"Hello")
pushbutton(13,window(51).x+130,window(51).y+50,100,30,"Goodbye")
`X button
pushbutton(2,screen width()-30,10,20,20,"x")
if button_state(2)=3 then end
`Hide buttons in window
for w=1 to 100
for b=1 to 20
if sprite exist(w) and sprite exist(b)
if sprite x(b)>sprite x(w) and sprite x(b)<sprite x(w)+window(w).sx and sprite y(b)>sprite y(w) and sprite y(b)<sprite y(w)+window(w).sy
if window(w).state=0 then hide sprite b
if window(w).state=1 then show sprite b
endif
endif
next w
next b
`move all windows
for w=1 to 100
if mousex()>window(w).x and mousex()<window(w).x+window(w).sx and mousey()>window(w).y and mousey()<window(w).y+20 and mouseclick()=1
window(w).selected=1
endif
if window(w).selected=1
if mousex()<window(w).x or mousex()>window(w).x+window(w).sx or mousey()<window(w).y or mousey()>window(w).y+20
window(w).selected=1
endif
endif
if window(w).selected=1 and mouseclick()=0 then window(w).selected=0
if window(w).selected=1
window(w).x=mousex()-(window(w).sx/2)
window(w).y=mousey()-5
endif
next w
`*End Loop*
sync
Loop
`Create Buttons
Function PushButton(num,x,y,sx,sy,caption$)
if button_state(num)<4 or button_state(num)>5
if mousex()>x and mousex()<x+sx and mousey()>y and mousey()<y+sy
if mouseclick()=0
button_state(num)=2
else
button_state(num)=3
endif
else
button_state(num)=1
endif
endif
if button_state(num)=1
sprite num,x,y,10 : size sprite num,sx,sy
endif
if button_state(num)=2
sprite num,x,y,11 : size sprite num,sx,sy
endif
if button_state(num)=3
sprite num,x,y,12 : size sprite num,sx,sy
endif
if button_state(num)=4
sprite num,x,y,13 : size sprite num,sx,sy
endif
if sprite visible(num)
if button_state(num)=1 or button_state(num)=2
ink rgb(255,255,255),0 : center text x+(sx/2),(y+(sy/2))-12,caption$:ink rgb(0,0,0),0 : center text (x+(sx/2))+1,((y+(sy/2))-12)+1,caption$
endif
if button_state(num)=3
ink rgb(200,200,200),0 : center text x+(sx/2)+1,(y+(sy/2))-11,caption$:ink rgb(128,128,128),0 : center text (x+(sx/2))+2,((y+(sy/2))-12)+2,caption$
endif
if button_state(num)=4 then ink rgb(100,100,100),0 : center text x+(sx/2),(y+(sy/2))-12,caption$
endif
Endfunction
`Create Window
Function makewindow(num,x,y,sx,sy,caption$)
sprite num,window(num).x,window(num).y,14
size sprite num,sx,sy
if window(num).state=1
show sprite num
else
hide sprite num
endif
if window(num).state=1
ink rgb(200,200,200),0
box window(num).x,window(num).y,window(num).x+window(num).sx,window(num).y+20
box window(num).x,window(num).y+20,window(num).x+2,window(num).y+window(num).sy
box window(num).x+(window(num).sx-2),window(num).y+20,window(num).x+window(num).sx,window(num).y+window(num).sy
box window(num).x,window(num).y+(window(num).sy-2),window(num).x+window(num).sx,window(num).y+window(num).sy
ink rgb(0,128,255),0
box window(num).x+3,window(num).y+3,window(num).x+window(num).sx-3,window(num).y+17
ink rgb(200,200,200),0
text window(num).x+5,window(num).y,caption$
box (window(num).x+window(num).sx)-45,(window(num).y+window(num).sy)-22,window(num).x+window(num).sx,window(num).y+window(num).sy
ink rgb(255,0,0),0
box window(num).x+window(num).sx-20,window(num).y+window(num).sy-20,window(num).x+window(num).sx-2,window(num).y+window(num).sy-2
ink rgb(0,128,255),0
box window(num).x+window(num).sx-43,window(num).y+window(num).sy-20,window(num).x+window(num).sx-24,window(num).y+window(num).sy-2
`Close window
if mousex()>window(num).x+window(num).sx-22
if mousex()<window(num).x+window(num).sx-2
if mousey()>window(num).y+window(num).sy-22
if mousey()<window(num).y+window(num).sy-2
ink rgb(255,255,255),0
box window(num).x+window(num).sx-11,window(num).y+window(num).sy-11,window(num).x+window(num).sx-9,window(num).y+window(num).sy-9
if mouseclick()=1
window(num).state=0
endif
endif
endif
endif
endif
endif
Endfunction
`System Color
Function system_col(num,sys_col)
create bitmap 1,screen width(),screen width() : set current bitmap 1
ink sys_col,0
box 0,0,bitmap width(1),bitmap height(1)
get image 1,0,0,bitmap width(1),bitmap height(1)
set current bitmap 0 : delete bitmap 1
sprite num,0,0,1
endfunction
