Ok i know i'm jumping around projects but i'm still doing the window functions well redoing them. it's going ok. i have it set up so later it's going to work like MS Windows api commands where you can specify a type (button,menu,window) and i was working on moving windows but it's not moving any ideas? heres the code.
remstart
-------------------------------------------------------------------
program name:
-------------------------------------------------------------------
written by: Caleb Stewart
date:
-------------------------------------------------------------------
comments:
-------------------------------------------------------------------
remend
Sync on
Sync rate 0
WinX=(640/2)/2+25
WinY=(480/2)/2+25
Set window on
Set window position WinX,WinY
dim TopWindow(0)
dim WindowData(1000,10)
Dim WindowTitle$(1000)
Dim WindowType$(1000)
Window = createWindow("Window","Window 1",100,100,300,400,0)
RefreshWindow(Window)
Do
wndsync()
Sync
Loop
Function CreateWindow(Type$,Title$,X,Y,width,Height,Parent)
handle = FindfreeHandle()
If Handle > 0
topWindow(0) = Handle
WindowData(Handle,0) = 1
If parent = 0
WindowData(Handle,1) = X
WindowData(Handle,2) = Y
else
If WindowData(Parent,0) = 1
WindowData(Handle,1) = WindowData(Parent,1)+X
WindowData(Handle,2) = WindowData(Parent,2)+Y
WindowData(Parent,8) = WindowData(Parent,8)+1
endif
endif
WindowData(Handle,3) = Width
WindowData(Handle,4) = Height
WindowData(Handle,5) = Parent
WindowData(Handle,6) = 0
WindowData(Handle,7) = 0
WindowTitle$(Handle) = Title$
WindowType$(Handle) = Type$
exitfunction handle
endif
endfunction -1
Function RefreshWindow(Handle)
If Handle>0
DrawWindow(WindowTitle$(Handle),Windowdata(Handle,1),WindowData(Handle,2),WindowData(Handle,3),WindowData(handle,4))
If WindowType$(Handle) = "Window" or WindowType$(Handle) = "Menu"
If WindowData(Handle,8)>0
For Item = 1 to 100
If WindowData(Item,5) = Handle
DrawWindow(WindowType$(Item),WindowData(Item,1),WindowData(Item,2),WindowData(Item,3),WindowData(Item,4))
endif
next item
endif
endif
endif
endfunction
Function FindFreeHandle()
for X=1 to 1000
If WindowData(X,0)=0 then Exitfunction X
next x
endfunction
Function DrawWindow(Title$,WinX,WinY,WinWidth,Winheight)
winY = WinY + 20
WinX2 = WinX + WinWidth
WinY2 = WinY + WinHeight
TX = WinX
TY = WinY - 20
TX2 = WinX2
TY2 = WinY
ink rgb(192,192,192),0
Box WinX,WinY,WinX2,WinY2
ink rgb(0,0,255),0
box tx,ty,tx2,ty2
ink rgb(192,192,192),0
line Tx-2,ty-2,Tx-2,WinY2+2
Line Tx-2,Ty-2,tx2+2,ty-2
line tx2+2,ty-2,tx2+2,winy2+2
line tx-2,winy2+2,tx2+2,winy2+2
ink rgb(255,255,255),0
line Tx-1,TY-1,TX2+1,TY-1
line TX-1,Ty-1,TX-1,WinY2+1
line Tx,Ty2+1,tx2,ty2+1
ink rgb(0,0,0),0
line Tx2+1,ty-1,tx2+1,WinY2+1
line tx-1,WinY2+1,tx2+1,WinY2+1
line tx,ty2,tx2,ty2
endfunction
Function WndSync()
For Window=1 to 1000
If WindowData(Window,0)=1
If WindowType$(Window) = "Window"
If Mouse_Inside(WindowData(Window,1),WindowData(Window,2)-20,WindowData(Window,3),WindowData(Window,2))=1
If mouseclick()
WindowData(Window,1) = MouseX() - (WindowData(Window,1)-MouseX())
WindowData(Window,2) = MouseY() - (WindowData(Window,2)-MouseY())
DrawWindow(WindowTitle$(Window),WindowData(Window,1),WindowData(Window,2),WindowData(Window,3),WindowData(Window,4))
endif
endif
endif
else
exitfunction
endif
next x
endfunction
Function Mouse_inside(X,Y,W,D)
if mouseX()>X and MouseX()<W
If mouseY()>Y and MouseY()<D
exitfunction 1
endif
endif
endfunction -1
New Site! Check it out \/