Posted: 18th Feb 2004 10:52
I didn't even remember doing this one. Now that I've found this code, I may finish it.
Draws some selectable and movable windows. Use arrow keys to resize the selected window. Buttons do nothing but show a pressed action.

+ Code Snippet
REM VARIABLES
screen_width=1024
screen_height=768
screen_width2=screen_width/2
nob=3
dim status(nob)
now=5
dim active(now)
dim win(now,4)
flag=0
temp=0


`1-originx
`2-originy
`3-width
`4-height

REM MORE STUFF
set display mode screen_width,screen_height,16
sync on

`set window on
`set window title "CCÃ¥DB  v.0.2"


REM CURSOR
ink rgb(255,0,0),0
for y=1 to 16
  for x=1 to 16 
    read z
    if z=1 then dot x,y
  next x
next y 
get image 1,1,1,16,16,1
hide mouse

REM WINDOWZ INFO
for c=1 to now
  read z
  win(c,1)=z
  read z
  win(c,2)=z
  read z
  win(c,3)=z
  read z
  win(c,4)=z
next c

REM ============================= MAIN LOOP ===========================
do
cls

  sprite 1,mousex(),mousey(),1
  gosub _draw_screen
  box(10,19,28,14,"File",status(1)) 
  box(45,19,30,14,"Edit",status(2)) 
  box(82,19,35,14,"Help",status(3))
  ink rgb(0,0,250),0
  text screen_width-40,screen_height-17,formatted_time()
  if button_check(10,19,38,33) and mouseclick() : status(1)=0 : else : status(1)=1 : endif
  if button_check(45,19,75,33) and mouseclick() : status(2)=0 : else : status(2)=1 : endif
  if button_check(82,19,117,33) and mouseclick() : status(3)=0 : else : status(3)=1 : endif

  if mouseclick() and n=0 and thing=0
    for c=1 to now
      if mousex()>win(c,1) and mousex()<win(c,1)+win(c,3) and mousey()>win(c,2) and mousey()<win(c,2)+win(c,4)
       active(c)=1
       thing=1
       ra=c
      else
        active(c)=0
      endif  
   next c
  endif

  if mouseclick()=1 and n=0
    for c=1 to now
      if mousex()>win(c,1)+2 and mousex()<(win(c,1)+win(c,3))-2 and mousey()>win(c,2)+2 and mousey()<win(c,2)+17
        wdx=mousex()-win(c,1)
        wdy=mousey()-win(c,2)
        wdx2=win(c,3)-wdx
        wdy2=win(c,4)-wdy
        n=c
      endif
    next c
  endif

  if mouseclick()=0 then n=0:thing=0

  gosub _move_windowz
  gosub _resize_windowz

  for c=1 to now
    if active(c)=0
      windowz(win(c,1),win(c,2),win(c,3),win(c,4),"Windowz #"+str$(c),active(c))
    endif
  next c

  for c=1 to now
    if active(c)=1
      windowz(win(c,1),win(c,2),win(c,3),win(c,4),"Windowz #"+str$(c),active(c))
    endif
  next c


sync
loop

REM +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


_draw_screen:
  ink rgb(212,208,200),0
  box 1,1,screen_width-1,35
  box 1,screen_height-20,screen_width-1,screen_height-1
  ink rgb(0,0,250),0
  box 1,1,screen_width-1,15
  ink rgb(128,128,128),0
  line 1,16,screen_width-1,16
  ink rgb(255,255,255),0
  line 1,17,screen_width-1,17
  ink rgb(128,128,128),0
  line 1,35,screen_width-1,35
  ink rgb(255,255,255),0
  line 1,screen_height-20,screen_width-1,screen_height-20
  box(screen_width-42,screen_height-17,40,14,"",0)
  ink rgb(0,0,0),0
  center text screen_width2+2,2,"CCÃ¥DB"
  ink rgb(255,0,0),0
  center text screen_width2,0,"CCÃ¥DB"

RETURN


function box(originx,originy,length,height,title$,upordown)
  if upordown=1 then ink rgb(255,255,255),0
  if upordown=0 then ink rgb(128,128,128),0
  line originx,originy,originx+length,originy
  line originx,originy,originx,originy+height
  if upordown=0 then ink rgb(255,255,255),0
  if upordown=1 then ink rgb(128,128,128),0
  line originx,originy+height,originx+length,originy+height
  line originx+length,originy,originx+length,originy+height
  ink 0,0
  text originx+2,originy-1,title$
endfunction

function formatted_time()
  hour$=left$(get time$(),2)
  if val(hour$)>12 then hour$=str$((val(hour$)-12))
  if val(hour$)=0 then hour$="12"
  minutes$=mid$(get time$(),4)+mid$(get time$(),5)
  ft$=hour$+":"+minutes$
endfunction ft$


function button_check(x1,y1,x2,y2)
  if mousex()>x1 and mousex()<x2 and mousey()>y1 and mousey()<y2
    value=1
  else
    value=0
  endif
endfunction value

function windowz(originx,originy,width,height,title$,active)
  ink rgb(150,150,150),0
  box originx,originy,originx+width,originy+height
  if active=0 then ink rgb(50,50,50),0 
  if active=1 then ink rgb(0,0,150),0 
  box originx+2,originy+2,originx+width-2,originy+16
  ink rgb(255,255,255),0 
  line originx,originy,originx,originy+height
  ink rgb(255,255,255),0 
  line originx,originy,originx+width,originy
  ink 0,0
  line originx+width,originy,originx+width,originy+height
  ink 0,0
  line originx,originy+height,originx+width,originy+height
  ink rgb(85,85,85),0 
  line originx+2,originy+18,originx+width-2,originy+18
  ink 0,0
  text originx+7,originy+3,title$
  if active=0 then ink rgb(150,150,150),0 
  if active=1 then ink rgb(250,250,250),0 
  text originx+5,originy+1,title$
endfunction

_move_windowz:
  if n<>0 and active(n)=1
`    if mousex()<win(n,1)+2 then position mouse win(n,1)+2,mousey(): wdx2=win(n,3)-wdx
`    if mousex()>(win(n,1)+win(n,3))-2 then position mouse (win(n,1)+win(n,3))-2,mousey(): wdx2=win(n,3)-wdx
`    if mousey()<win(n,2)+2 then position mouse mousex(),win(n,2)+2:wdy2=win(n,4)-wdy
`    if mousey()>win(n,2)+16 then position mouse mousex(),win(n,2)+16:wdy2=win(n,4)-wdy
    win(n,1)=mousex()-wdx
    win(n,2)=mousey()-wdy
    if mousex()<wdx+1 then win(n,1)=1:wdx=mousex()-win(n,1):wdx2=win(n,3)-wdx
    if mousey()<wdy+1 then win(n,2)=1:wdy=mousey()-win(n,2):wdy2=win(n,4)-wdy
    if mousex()>screen_width-(wdx2+1) then win(n,1)=(screen_width-2)-win(n,3):wdx=mousex()-win(n,1):wdx2=win(n,3)-wdx
    if mousey()>screen_height-(wdy2+1) then win(n,2)=(screen_height-2)-(win(n,4)):wdy=mousey()-win(n,2):wdy2=win(n,4)-wdy
  endif

_resize_windowz:
  if ra<>0  
    if upkey() then win(ra,4)=win(ra,4)-1
    if downkey() then win(ra,4)=win(ra,4)+1
    if rightkey() then win(ra,3)=win(ra,3)+1
    if leftkey() then win(ra,3)=win(ra,3)-1
  endif
RETURN


RETURN

rem mouse cursor
data 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0
data 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0
data 1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0
data 1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0
data 1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0
data 1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0
data 1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0
data 1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0
data 1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0
data 1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0
data 1,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

rem windowz info
data 30,100,175,50
data 80,110,200,145
data 400,20,150,80
data 300,100,90,70
data 85,250,275,200