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

window.setPriority(num)?

Started by Blue, 23 December 2015 - 01:18 PM
Blue #1
Posted 23 December 2015 - 02:18 PM
window.setPriority(num)?
Windows with the highest priority get displayed at the front(eg. a 'focused' window). It might be hard to do due to the way the window API is coded,but I'll suggest it anyway.
Bomb Bloke #2
Posted 23 December 2015 - 02:39 PM
Certainly do-able, but there'd be a fair bit of slow-down involved - say you've got two windows with the one parent, and the left and right sides of the low-pri one are visible, but the rest of it's obscured by the high-pri window on top. Subsequent renders to the lower window would have to split row strings into segments in order to prevent overwrites of the upper window.

Given that this sort of extra processing doesn't suit most use-cases (but slows them all down anyway), you may be better off building a solution of your own.

One "simple" method is to have to have all windows in your priority system have a single "main" window as their parent. Make the whole lot invisible, "main" window included. Whenever a child window's content changes, make that window visible and then invisible again, then do the same for each window with a higher priority which overlaps a window you already toggled, in order until you hit the top-most one. Finally, toggle visibility of the main window on and off again to update your actual display.
Blue #3
Posted 23 December 2015 - 07:32 PM
Ok,thanks!