Difference between revisions of "Term resize (event)"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page)
 
m (Added links in example)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{NeedsWork|This page should be made ASAP. - [[User:Oeed|Oeed]] 01:11, 29 March 2014 (GMT)}}
+
{{lowercase}}{{Event
 
+
|name=term_resize
{{lowercase}}
+
|desc=Fired when the screen changes size (through opening a new tab with bg, etc). Requires version 1.6 or higher.
 +
|return1=Nothing
 +
}}
 +
{{Example
 +
|desc=Prints the screen size when it changes.
 +
|code=
 +
while true do
 +
  '''[[os.pullEvent]]("term_resize")'''
 +
  local w, h = [[term.getSize]]()
 +
  print('Term Size: '..w..', '..h)
 +
  --you should redraw your user interface here to ensure it fills the entire screen and is not clipped
 +
end
 +
}}

Latest revision as of 16:23, 10 April 2014



Grid Modem.png  Event term_resize
Fired when the screen changes size (through opening a new tab with bg, etc). Requires version 1.6 or higher.
Returned Object 1 Nothing


Grid paper.png  Example
Prints the screen size when it changes.
Code
while true do
  os.pullEvent("term_resize")
  local w, h = term.getSize()
  print('Term Size: '..w..', '..h)
  --you should redraw your user interface here to ensure it fills the entire screen and is not clipped
end