This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
DannySMc's profile picture

Window API CC1.6?

Started by DannySMc, 02 April 2014 - 09:10 PM
DannySMc #1
Posted 02 April 2014 - 11:10 PM
Okay so I have no idea how to use this new Window API from the pre-release of ComputerCraft 1.6! I took this off the actual computer using

help window
in the shell.

Window API:

window.create(parent, intX, intY, intWidth, intHeight, bolVisible)

I don't understand the "parent" bit? what is this? I have tried a string, an integer, a boolean. Nothing works. It says it is expecting an object.. Now I have been using CC for about a year and a bit but I don't actually understand what it is asking for… a table? and if so how is the table supposed to be structured? It isn't explained anywhere (that I have searched) and not in the API's list.

Can someone please help me?

also do you use the following code to actually make a window?

window1 = window.create(parent, intX, intY, intWidth, intHeight, bolVisible)
then use:

window1.write("Hello World!")
???
I think that is the write syntax?:S

Also!! The mod has a few problems with it's file system, when I installed it, all my computers shared the same file system >.< so I couldn't use different startup programs… It has stopped now, but sometimes reverts to it.

Thanks guys!!
theoriginalbit #2
Posted 02 April 2014 - 11:18 PM
the parent is suggested to be a call to term.current1

as for the bugs, they're well and truly known that they've made it to the full release.

1 taken directly from ComputerCraft Window API source (as the wiki page is not yet made)

function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
  --# snip validation

  if parent == term then
	error( "term is not a recommended window parent, try term.current() instead", 2 )
  end

  --# snip remainder of code
end
Edited on 02 April 2014 - 09:19 PM
Lyqyd #3
Posted 02 April 2014 - 11:19 PM
I believe the first parameter wants a redirect object. Try passing term.current().