First, I think I've to tell you I didn't choose "ms" because of Microsoft, but because of my name.
What does it do ? It makes windows with three kind of gadgets. I'll add more, but I don't know when.
How does it works ?
Right click on the blue bar to move the window, right click again to stop moving it.
Left click on the white X to close the windows
Left click on the input box to be able to write it (move the mouse to stop writting)
Left click on a button to click on it (hmm... I wonder if I really had to tell you how to use a button...)
`%msWindows%
`======================
`©Mathias T. Seuret (Atreides)%
`======================
`Main and only Source File
rem works with any resolution
set display mode 800,600,32
sync on
sync rate 0
set text font "arial"
set text size 21
global g_mmx
global g_mmy
global g_clic
global g_selected
rem FENETRES
type t_window
open as integer
x as integer
y as integer
width as integer
height as integer
title as string
reposx as integer
reposy as integer
move as integer
gadgets as integer
fermable as boolean
endtype
dim window(32) as t_window
dim wingadget(32,16)
dim winpos(32) as integer
for t=1 to 32
winpos(t)=t
next t
REM GADGETS
type t_gadget
sorte as integer
win as integer
x as integer
y as integer
width as integer
height as integer
entier as integer
flottant as float
chaine as string
endtype
dim gadget(512) as t_gadget
openwindow(1, 100, 150, 300, 200, 1, "Title of the first window")
addbutton(1, 1, 10, 30, "Exit")
addlabel(1, 5 ,30, 70, 250, "Click there and enter some text")
addinput(1, 3, 30, 90, 150, "")
openwindow(2, 50, 100, 300, 105, 1, "Information window")
addlabel(2, 2, 10, 10, 290, "")
openwindow(4, 65, 300, 200, 60, 0, "Main menu")
addbutton(4, 8, 5, 5, "Show first window")
addbutton(4, 9, 5, 30, "Show second window")
do
CLS
ink rgb(255,255,255),0
set cursor 0,0
print screen fps()
if gadget(1).entier = 1 then end
if gadget(8).entier = 1 then window(1).open = 1
if gadget(9).entier = 1 then window(2).open = 1
gadget(2).chaine = gadget(3).chaine
update_windows()
update_mouse()
sync
loop
function update_windows()
rem si on clique sur une fenêtre, elle vient en avant
if g_clic>0 and winundermouse()>0
var = winundermouse()
if winpos(1)<>var
for t=1 to 32
if winpos(t)=var
var2=t
exit
endif
next t
for t=var2 to 2 step -1
winpos(t)=winpos(t-1)
next t
winpos(1)=var
endif
endif
for u=0 to 31
t = winpos(32-u)
if window(t).open = 1 and windowvisible(t)=1
rem arrière-plan de la fenêtre
ink rgb(196,196,196),0
box window(t).x, window(t).y, window(t).x + window(t).width, window(t).y + window(t).height
rem barre de titre
ink rgb(0,0,255),0
box window(t).x, window(t).y-text height("|"), window(t).x+window(t).width, window(t).y
rem écriture du titre
ink rgb(255,255,255),0
while text width(window(t).title)>window(t).width-text width(" X")
window(t).title = left$(window(t).title, len(window(t).title)-1)
endwhile
text window(t).x, window(t).y - text height("|"), window(t).title
rem écriture du bouton FERMER
if window(t).fermable = 1 then text window(t).x+window(t).width-text width("|X"),window(t).y-text height("|"),"|X"
rem dessin d'une bordure
ink 0,0
line window(t).x, window(t).y-text height("|"), window(t).x+window(t).width, window(t).y-text height("|")
line window(t).x+window(t).width, window(t).y-text height("|"), window(t).x+window(t).width, window(t).y+window(t).height
line window(t).x+window(t).width, window(t).y+window(t).height, window(t).x, window(t).y+window(t).height
line window(t).x, window(t).y+window(t).height,window(t).x, window(t).y-text height("|")
rem dessin des gadgets
if window(t).gadgets>0
for g=1 to window(t).gadgets
gg = wingadget(t, g)
select gadget(gg).sorte
rem BOUTONS
case 1
ink rgb(128,128,128),0
box window(t).x+gadget(gg).x, window(t).y+gadget(gg).y, window(t).x + gadget(gg).x + gadget(gg).width, window(t).y + gadget(gg).y + gadget(gg).height
ink rgb(0,0,0),0
text window(t).x+gadget(gg).x, window(t).y+gadget(gg).y, gadget(gg).chaine
line window(t).x+gadget(gg).x, window(t).y+gadget(gg).y, window(t).x+gadget(gg).x+gadget(gg).width, window(t).y+gadget(gg).y
line window(t).x+gadget(gg).x+gadget(gg).width, window(t).y+gadget(gg).y, window(t).x+gadget(gg).x+gadget(gg).width, window(t).y+gadget(gg).y+gadget(gg).height
line window(t).x+gadget(gg).x+gadget(gg).width, window(t).y+gadget(gg).y+gadget(gg).height,window(t).x+gadget(gg).x, window(t).y+gadget(gg).y+gadget(gg).height
line window(t).x+gadget(gg).x, window(t).y+gadget(gg).y, window(t).x+gadget(gg).x, window(t).y+gadget(gg).y+gadget(gg).height
if mouseongadget(gg)=1 and g_clic=1 and gadget(gg).entier=0
gadget(gg).entier = 1
else
gadget(gg).entier = 0
endif
endcase
REM LABELS
case 2
if text width(gadget(gg).chaine)>gadget(gg).width
var$ = gadget(gg).chaine
var2 = -text height("|")
repeat
var = 0
repeat
inc var
until text width(left$(var$, var+1))>gadget(gg).width or var >=len(var$)
if text width(left$(var$, var+1))>gadget(gg).width
while var < len(var$) and var > 0.6*gadget(gg).width/text width("_") and mid$(var$, var)<>" "
dec var
endwhile
endif
inc var2, text height("|")
text window(t).x+gadget(gg).x, var2+window(t).y+gadget(gg).y, left$(var$, var)
var$ = right$(var$, len(var$)-var)
until var$=""
else
text window(t).x+gadget(gg).x, window(t).y+gadget(gg).y, gadget(gg).chaine
endif
endcase
REM INPUT
case 3
ink rgb(150,150,150),0
box window(t).x+gadget(gg).x, window(t).y+gadget(gg).y, window(t).x + gadget(gg).x + gadget(gg).width, window(t).y + gadget(gg).y + gadget(gg).height
ink 0,0
line window(t).x+gadget(gg).x, window(t).y+gadget(gg).y + gadget(gg).height, window(t).x + gadget(gg).x + gadget(gg).width, window(t).y+gadget(gg).y+gadget(gg).height
var = 0
repeat
inc var
until text width(right$(gadget(gg).chaine, var+1)+"|")>gadget(gg).width or var>=len(gadget(gg).chaine)
if gadget(gg).entier = 1 then var$ = "|" else var$=""
text window(t).x+gadget(gg).x, window(t).y+gadget(gg).y, right$(gadget(gg).chaine, var)+var$
var$ = ""
rem clic dessus
if mouseongadget(gg)=1 and g_clic=1 and gadget(gg).entier=0
gadget(gg).entier=1
hide mouse
endif
rem modification
if gadget(gg).entier=1
if mouseongadget(gg)=0 or returnkey()=1
gadget(gg).entier = 0
show mouse
endif
if scancode()=14
if len(gadget(gg).chaine)>0
gadget(gg).chaine = left$(gadget(gg).chaine, len(gadget(gg).chaine)-1)
var = 0
repeat
inc var
wait 10
until var = 5 or scancode()<>14
endif
else
if entry$()<>"" and returnkey()=0
var$ = entry$()
endif
if returnkey()=0 then gadget(gg).chaine = gadget(gg).chaine + var$
if var$<>""
clear entry buffer
var$ = ""
endif
endif
endif
endcase
endselect
next g
endif
rem clic pour déplacer
if g_clic=2 and winundermouse()=t
if mousex()>window(t).x and mousex()<window(t).x+window(t).width
if mousey()>window(t).y-text height("|") and mousey()<window(t).y
if window(t).move = 0
window(t).move=1
window(t).reposx = mousex()-window(t).x
window(t).reposy = mousey()-window(t).y
else
window(t).move=0
endif
endif
endif
endif
if window(t).move=1
window(t).x = mousex()-window(t).reposx
window(t).y = mousey()-window(t).reposy
endif
rem clic pour fermer
if g_clic=1 and winundermouse()=t and window(t).fermable=1
if mousex()>window(t).x + window(t).width - text width("X") and mousex()<window(t).x + window(t).width
if mousey()>window(t).y-text height("|") and mousey()<window(t).y
window(t).open=0
endif
endif
endif
endif
next u
endfunction
function winundermouse()
res as integer
for u=0 to 31
t = winpos(32-u)
if window(t).open = 1
if mousex()>window(t).x and mousex()<window(t).x+window(t).width
if mousey()>window(t).y-text height("|") and mousey()<window(t).y+window(t).height
res = t
endif
endif
endif
next u
endfunction res
function windowvisible(n)
res as integer
start = 33
repeat
dec start
until winpos(start)=n or start = 0
if start=1 then exitfunction 1
res = 1
for t=start-1 to 1 step -1
m = winpos(t)
if (window(n).x < window(m).x or window(n).x+window(n).width > window(m).x+window(m).width or window(n).y<window(m).y or window(n).y+window(n).height > window(m).y+window(m).height) or window(m).open=0 then res=1 else res=0
if res=0 then exitfunction res
next t
endfunction res
function openwindow(n, x, y, width, height, fermable, title as string)
window(n).open = 1
window(n).x = x
window(n).y = y
window(n).width = width
window(n).height = height
window(n).title = title
window(n).reposx = 0
window(n).reposy = 0
window(n).move = 0
window(n).gadgets = 0
window(n).fermable = fermable
endfunction
function mouseongadget(n)
if winpos(1)=gadget(n).win
t = gadget(n).win
if mousex()>window(t).x+gadget(n).x and mousex()<window(t).x + gadget(n).x + gadget(n).width
if mousey()>window(t).y+gadget(n).y and mousey()<window(t).y + gadget(n).y + gadget(n).height
exitfunction 1
endif
endif
else
exitfunction 0
endif
endfunction 0
function addbutton(w, n, x, y, chaine as string)
inc window(w).gadgets
g = window(w).gadgets
wingadget(w, g)=n
gadget(n).sorte = 1
gadget(n).win = w
gadget(n).x = x
gadget(n).y = y
gadget(n).width = text width(chaine)
gadget(n).height = text height(chaine)
gadget(n).entier = 0
gadget(n).flottant = 0.0
gadget(n).chaine = chaine
endfunction
function addlabel(w, n, x, y, width, chaine as string)
inc window(w).gadgets
g = window(w).gadgets
wingadget(w, g)=n
gadget(n).sorte = 2
gadget(n).win = w
gadget(n).x = x
gadget(n).y = y
gadget(n).width = width
gadget(n).height = 0
gadget(n).entier = 0
gadget(n).flottant = 0.0
gadget(n).chaine = chaine
endfunction
function addinput(w, n, x, y, width, chaine as string)
inc window(w).gadgets
g = window(w).gadgets
wingadget(w, g)=n
gadget(n).sorte = 3
gadget(n).win = w
gadget(n).x = x
gadget(n).y = y
gadget(n).width = width
gadget(n).height = text height("|")
gadget(n).entier = 0
gadget(n).flottant = 0.0
gadget(n).chaine = chaine
endfunction
function update_mouse()
mmx = mousemovex()
mmy = mousemovey()
if mouseclick()>0
if g_clic <> mouseclick() and g_clic <> -1
g_clic = mouseclick()
else
g_clic = -1
endif
else
g_clic = 0
endif
endfunction
I usually have some problems to post my codes (that's why I don't post often), I hope it will works. I posted it in the message (just above here) but also in the code box.
The sleeper must awaken !