Editable Print.
Started by Left, Mar 11 2013 08:14 PM
15 replies to this topic
#1
Posted 11 March 2013 - 08:14 PM
Like the edit program how can I print something that can then be edited?
#2
Posted 11 March 2013 - 08:41 PM
By print do you mean on screen print or paper print?
#3
Posted 11 March 2013 - 08:43 PM
Print on screen then be able to edit it.... Like the program edit.
#4
Posted 11 March 2013 - 08:50 PM
You can do it by copying the edit program into your program
#5
Posted 11 March 2013 - 09:13 PM
Print only draws text to the screen. Making it editable is not a trivial task. I recommend you take a look at edit. What do you need this for?
#6
Posted 11 March 2013 - 09:30 PM
I am also interested in this, for like a config file, so you don't have to go into the config file to change options.
#7
Posted 11 March 2013 - 09:43 PM
So basically you want to make something simliar to the adress bar on your browser?
#8
Posted 11 March 2013 - 10:22 PM
Yeah
#9
Posted 11 March 2013 - 10:27 PM
I believe this has been asked before about a week ago.. Im on my tablet right now so i cant look it up easily for you, but i suggest using the search button and see what you can find
#10
Posted 11 March 2013 - 10:45 PM
I looked at the edit program and it seems to just return lines. I dont know how this works
#11
Posted 11 March 2013 - 10:49 PM
This isn't all the code, and its really basic, but here is the start of what you need to do
local function editableInput( initial, mask ) local sx, sy = term.getCursorPos() while true do local event, param = os.pullEvent() if event == 'key' then if param == key.backspace then initial = initial:sub( 1, #initial - 1 ) end elseif event == 'char' then initial = initial..param end end term.setCursorPos(sx,sy) if mask then write( string.rep( mask, #initial )..' ' ) else write( initial..' ' ) end end
#12
Posted 11 March 2013 - 11:16 PM
@TOB What exactly is the mask? Like I see where is it used, but don't fully understand what it is.
#14
Posted 11 March 2013 - 11:33 PM
Oh, I see thank you
#15
Posted 11 March 2013 - 11:35 PM
no problems.
#16
Posted 12 March 2013 - 03:27 AM
if all you want is a single line of editable input, basically read() that can be pre-loaded with a value, you can simply queue an up arrow key event before calling read, and pass the initial value in a table as the 2nd argument to read, as so:
os.queueEvent("key",keys.up)
read(nil, { "initial value" })
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












