icons/buttons?
#1
Posted 24 October 2012 - 06:46 AM
Im planning to do so that my OS will have program icons that function as buttons to start the program. The question is-HOW?
How can i load the icons(unique for every program) and have them work as clickable buttons to open the program?
also-how to color the entire terminal window not just the area with text?
#2
Posted 24 October 2012 - 07:09 AM
#3
Posted 24 October 2012 - 07:10 AM
#4
Posted 24 October 2012 - 07:16 AM
#5
Posted 24 October 2012 - 07:21 AM
just use a normal name that you can click on
#6
Posted 24 October 2012 - 07:23 AM
EDIT: works like a charm, thanks, but now i need to get rid of the cursor, the > is making an area around it blcak, the rest is perfectly lightblue
#7
Posted 24 October 2012 - 07:54 AM
#8
Posted 24 October 2012 - 02:26 PM
and how do i create small color boxes? i would need a taskbar thats on 1,16 and is yellow the background of the rest is lightBlue
#9
Posted 25 October 2012 - 06:11 AM
makerimages, on 24 October 2012 - 02:26 PM, said:
and how do i create small color boxes? i would need a taskbar thats on 1,16 and is yellow the background of the rest is lightBlue
width, height = term.getSize()
term.setBackgroundColor(colors.blue)
term.clear()
term.setCursorPos(1, height)
term.setBackgroundColor(colors.yellow)
for i = 1, width - 2, 1 do
write(" ")
end
This should work.
#10
Posted 25 October 2012 - 06:18 AM
EDIT
local function icon(x1,y1,x2,y2,color)
if colors[color] then
term.setBackgroundColor(colors[color])
for y=y1,y2 do
for x=x1,x2 do
term.setCursorPos(x,y)
write(' ')
end
end
end
end
icon(1,3,1,3,blue)
#11
Posted 25 October 2012 - 08:53 AM
briman0094, on 25 October 2012 - 06:11 AM, said:
makerimages, on 24 October 2012 - 02:26 PM, said:
and how do i create small color boxes? i would need a taskbar thats on 1,16 and is yellow the background of the rest is lightBlue
width, height = term.getSize()
term.setBackgroundColor(colors.blue)
term.clear()
term.setCursorPos(1, height)
term.setBackgroundColor(colors.yellow)
for i = 1, width - 2, 1 do
write(" ")
end
This should work.
it doesnt, it gives me a taskbar that looks like the one in the photo below, i need a taskbar that goes from 1,16 to the low end of the terminal and doesnt scroll the terminal area, and i should be able to print in the taskbar as i want, not like it is now with the word taskbar? filling it, i need to be able to choose, what to show there and when and where, any ideas?
[attachment=618:2012-10-25_11.50.41.png]
#12
Posted 25 October 2012 - 09:00 AM
TOP:
local size={term.getSize()}
term.setCursorPos(1,1)
for x=1,size[1]-1 do
write(' ')
end
BOTTOM:
local size={term.getSize()}
term.setCursorPos(1,size[2])
for x=1,size[1]-1 do
write(' ')
end
if the bottom one scrolls then just use
local size={term.getSize()}
term.setCursorPos(1,size[2]-1)
for x=1,size[1]-1 do
write(' ')
end
EDIT: Don't forget to change the background colour to whatever you need first
#13
Posted 25 October 2012 - 09:05 AM
EDIT: the same text writing thing still remains!!
EDIT2: do i use the last code you gave if i want it to scroll or if i dont want it to?
#14
Posted 25 October 2012 - 09:11 AM
top
local width=3
local size={term.getSize()}
for w=1,width do
term.setCursorPos(1,w)
for x=1,size[1]-1 do
write(' ')
end
end
bottom
local width=3
local size={term.getSize()}
for w=1,width do
term.setCursorPos(1,size[2]-w+1)
for x=1,size[1]-1 do
write(' ')
end
end
#15
Posted 25 October 2012 - 09:23 AM
#16
Posted 25 October 2012 - 09:48 AM
Computercraft has an interface, that '>' is part of the interface, it means that you can enter input there, it does not show while a program is running, only after the program is finished. you run your program and it generates the taskbar and then closes, when it closes the '>' is shown. when the program is ready it will continue to run after you generate the taskbar so that '>' will not show, nothing to worry about
to display text on the taskbar just setCursorPos on it, set the background colour to the taskbar colour and use write(text). I will post an example in a minute
#17
Posted 25 October 2012 - 09:51 AM
#18
Posted 25 October 2012 - 10:13 AM
example code
local function pCenter(text,colour)
local pos={term.getCursorPos()}
local col=term.getBackgroundColor()
term.setCursorPos(math.floor(({term.getSize()})[1]/2-#text/2),pos[2])
if colors[colour] then term.setBackgroundColor(colors[color]) end
local output=write(text)
term.setCursorPos(unpack(pos))
if col then term.setBackgroundColor(col) end
return output
end
term.setBackgroundColor(colors.blue)
local width=3
local size={term.getSize()}
for w=1,width do
term.setCursorPos(1,w)
for x=1,size[1]-1 do
write(' ')
end
end
term.setCursorPos(1,2)
pCenter('--TASKBAR--','blue')
#19
Posted 30 March 2014 - 04:42 PM
I have looked up everywhere and i cant find a way of doing this. :/
#20
Posted 03 April 2014 - 01:03 PM
RoD, on 30 March 2014 - 04:42 PM, said:
I have looked up everywhere and i cant find a way of doing this. :/
yes, it is very similar to what was done above in fact. Just parse a table of all the files...
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











