Posted 31 October 2013 - 09:20 AM
Hi, I have thi pieceof API code
a window Is created
windowSystem
local window=nil;
function createWindow(title,x,y,w,h,closeable,text)
window=
{
titlew=title;
x=x;
y=y;
W=w;
H=h;
ca=closeable;
text=text;
}
return window
end
function drawWindow(windowp)
term.setCursorPos(window.x,window.y)
term.setBackgroundColor(colors.lightGray)
for i=0, windowp.W do
term.setCursorPos(windowp.x+i,windowp.y)
print(" ")
term.setCursorPos(windowp.x+i,windowp.y+windowp.H)
print(" ")
end
for j=0, windowp.H do
term.setCursorPos(windowp.x,windowp.y+j)
print(" ")
term.setCursorPos(windowp.x+windowp.W,windowp.y+j)
print(" ")
end
for k=0, windowp.H-2 do
term.setBackgroundColor(colors.white)
term.setCursorPos(windowp.x+1,windowp.y+1+k)
print(" ")
term.setBackgroundColor(colors.lightGray)
end
term.setCursorPos(windowp.x+windowp.W/2-string.len(windowp.titlew)/2,windowp.y)
term.setTextColor(colors.gray)
print(windowp.titlew)
if(windowp.ca) then
term.setBackgroundColor(colors.red)
term.setCursorPos(windowp.x+windowp.W+1,windowp.y)
print("X")
term.setBackgroundColor(colors.white)
end
term.setCursorPos(windowp.x+2,windowp.y+2)
for i in string.gmatch(windowp.text,"[^\n]+") do
term.setBackgroundColor(colors.white)
print(i)
x,y=term.getCursorPos()
if i== " " then
term.setCursorPos(windowp.x+1,y)
end
end
end
a window Is created
local window=windowSystem.createWindow("About this Device",21,3,20,14,true,"Version:"..afData[1].."\n \n \n \n System:"..afData[2])
and the for k=0 block in drawWindow draws a white column at the specified position(windowp.x+1, windowp.y+k), I would like to have the entire inside of a window(from windowp.x to windowp.W-2) to be with a white bg, how can I achieve that?