





This thread will be full of concepts.
The following code contains basic User Interface code, written in dbp's native commmans.
Rem ***** Included Source File *****
//Turn camera on
Sync On
Sync Rate 0
Backdrop On
Do
//Print paragraphes onto the screen using deliminators to seperate the lines
act_out(10,10,10, "This is a test,,of the delim,,linner" , ",," )
//Change the number in at the end of the function to rotate colors
Standard_Box(100,y,100,100,Rgb(128,0,59),Rgb(87,128,255),1)
//Just a ok button returning one
Standard_Button(100,100,10,Rgb(192,192,192) ,"Processing!Finished","!")
//With yes no buttons that return 1 or 2
Standard_ButtonTwin(400,100,10,Rgb(192,192,192) ,"Processing!Finished","!")
//
ListUpdate(300,200,30,Rgb(135,135,135))
`OulinedBox(300,300,10,Rgb(192,0,75) )
Sync
Loop
Function DropListA()
Endfunction
//Returns one if mouse is over an specific area
Function MouseOverArea(x,y,w,h)
mx = mousex() : my = Mousey() : mc = mouseclick()
if mx > x and mx < x+w and my > y and my < y+h then retun = 1
if retun = 1 and mc = 1 then retun = 2
Endfunction retun
//Listed selectors
Function ListUpdate(x,y,s,c)
OulinedBox(x,y,s,c)
For n = 0 to 10
If MouseOverArea(x+2,y+2+(n*12),100,12) = 1
text x+2,y+2+(n*12),"Test text <"
act_out(x+92,y+2,30, "TEXT A!! !! This is some!! body of text!! !! Administrator!" , "!!" )
Else
text x+2,y+2+(n*12),"Test text"
Endif
Next n
Endfunction
//
Function OulinedBox(x,y,s,c)
w = s*10
h = s*5
Box x,y,x+w,y+h,c,c,c,c
Box Outline x,y,x+w-1,y+h-1,Rgb(0,0,0)
Endfunction
Function ButtonBox(x,y,s,c,t$)
OulinedBox(x,y,s,c)
Text x+s+2,y,t$
Endfunction
Function Standard_Button(x,y,s,c,message$,delim$)
//Main large box
OulinedBox(x,y,s,c)
//Get total lines and show text
TotalLines = act_out(x-10,y+1,3, message$ , delim$)
//Detect mouse over smaller button
masx = mousex() : masy = mousey() : msc = mouseclick()
SBC = Rgb(165,165,165)
If masx > x+30 and masx < x+(30*2) and masy > y+30 and masy < y+(30+15)
cml = 0
//Change the color of the box
SBC = Rgb(255,0,0)
If msc = 1
SBC = Rgb(70,255,0)
cml = 1
Endif
Endif
//Smaller button box
ButtonBox(x+35,y+30,s/3,SBC,"OK")
`Center Text x+30+((size2*2)/2),y+7+(size2/1.5)+TotalLines,"OK"
Endfunction cml
Function Standard_ButtonTwin(x,y,s,c,message$,delim$)
//Main large box
OulinedBox(x,y,s,c)
//Get total lines and show text
TotalLines = act_out(x-10,y+1,3, message$ , delim$)
//Detect mouse over smaller button
masx = mousex() : masy = mousey() : msc = mouseclick()
SBC = Rgb(165,165,165)
If masx > x+10 and masx < x+(10*4) and masy > y+30 and masy < y+(30+15)
cml = 0
//Change the color of the box
SBC = Rgb(255,0,0)
If msc = 1
SBC = Rgb(70,255,0)
cml = 1
Endif
Endif
//Smaller button box
ButtonBox(x+10,y+30,s/3,SBC,"YES")
SBC = Rgb(165,165,165)
If masx > x+50 and masx < x+(50*2) and masy > y+30 and masy < y+(30+15)
cml = 0
//Change the color of the box
SBC = Rgb(255,0,0)
If msc = 1
SBC = Rgb(70,255,0)
cml = 2
Endif
Endif
ButtonBox(x+50,y+30,s/3,SBC,"NO")
`Center Text x+30+((size2*2)/2),y+7+(size2/1.5)+TotalLines,"OK"
Endfunction cml
Function Standard_Box(x,y,w,h,c,c2,r)
Select r
Case 0
Box x,y,x+w,y+h,c2,c,c2,c
Endcase
Case 1
Box x,y,x+w,y+h,c,c2,c,c2
Endcase
Case Default
Box x,y,x+w,y+h,c2,c,c2,c
Endcase
Endselect
Endfunction
//Test wrapping engine
Function act_out(x,y,h, text_in$ , Delim$ )
Dim PrintLines(99) as String
//Count the amount of
TxtinP1$ = FIRST TOKEN$(text_in$, Delim$)
//Start array at zero
IndexAct = 0
PrintLines(IndexAct) = TxtinP1$
//Extract every line and store in an array
Repeat
IndexAct = IndexAct+1
//Find deliminator
TxtinP2$ = Next TOKEN$(Delim$)
//Process the text some more and break them down to include width
//
PrintLines(IndexAct) = TxtinP2$
Until TxtinP2$ = ""
ttll = 0
//
For n = 0 to h
If PrintLines(n) <> ""
Center Text x+60,y+(n*12),PrintLines(n)
//Total lines
ttll = ttll + 1
Endif
Next n
//Release array
Undim PrintLines(0)
Endfunction ttll
//All initiations start with in_
Version 1.0 as I work on it this will evolve.