Several switcheble windows, fixed position, on screen, recommended way to implement?

I’m new to corona development.

In my application I have two places for application windows on screen (left half and right half of letterbox screen). I have several windows (lets say 4), each has a TableView with a dynamic amount of rows.

By clicking buttons on toolbar I’m picking what windows are visible now.

The problem is - I do not understand correct data structures, to implement this in Corona.

In native Windows environment, I would create several fixed size borderless windows, add some list structure inside, and will just use window:hide, window:show according to buttons pressed on toolbar. All lists will process add/remove entries and forced scrolling without any problem being visible or hidden.

Question 1: how to implement same on Corona. Without destroying and reconstructing lists every time?

I tried to follow Sample Code\Interface\WidgetDemo sample.

I used tab1, tab2, etc, modules from that example to create windows. As I understand those tabs are different scenes. But when I try to visualize or change something on hidden tab application fails with an error. I tried to use scene overplay, to show 2nd window, since without overlay windows prefers to stay alone on a screen.

But problem with crashes, when attempting to change something on invisible window stays.

Then I took newPanel.lua from Corona web site. I’do not remember exact web link. That widget shows new window above existing scene. It works better, while off screen (no crashes and content do not vanish), but I have serious problems with visual content positioning inside this widget. On different android devices widgets tend to visualize up to 50% off right screen.

Question 2: Idea that anchor point of visual object is attached not to it’s upper left corner, but to center really piss me off. WHY??? Is it possible to change this behavior to “normal” windows behavior for all elements at once? Because writing .anchorX = 0, .anchorY = 0 every time is too annoying.

re: question 2

https://docs.coronalabs.com/daily/api/library/display/setDefault.html#display-object-keys

regarding why center is the default…

Corona SDK can be used to make games and apps, but most folks use it for game making.  Having said that, it make sense for the <x,y> position of a game object (bullet, player ship, etc.) to be the center, not the upper-left corner.

Upper-left corner is more of an app thing, especially when one is laying out windows, menu bars, etc.

re: question 1 - Put your discrete switchable windows in separate display groups and move/hide the groups as needed.

https://docs.coronalabs.com/daily/api/library/display/newGroup.html

I probably need display.newContainer(), since it’s same as group but with defined sizes and content is clipped.

But I can’t find, do this container have methods :show() and :hide() ?

Since in mentioned above newPanel.lua, they use:

self.completeState = “shown”

self.completeState = “hidden”

transition.to( self, options )

Also, do I need to use scene at all?

Containers are display objects and have an ‘isVisible’ flag:

re: question 2

https://docs.coronalabs.com/daily/api/library/display/setDefault.html#display-object-keys

regarding why center is the default…

Corona SDK can be used to make games and apps, but most folks use it for game making.  Having said that, it make sense for the <x,y> position of a game object (bullet, player ship, etc.) to be the center, not the upper-left corner.

Upper-left corner is more of an app thing, especially when one is laying out windows, menu bars, etc.

re: question 1 - Put your discrete switchable windows in separate display groups and move/hide the groups as needed.

https://docs.coronalabs.com/daily/api/library/display/newGroup.html

I probably need display.newContainer(), since it’s same as group but with defined sizes and content is clipped.

But I can’t find, do this container have methods :show() and :hide() ?

Since in mentioned above newPanel.lua, they use:

self.completeState = “shown”

self.completeState = “hidden”

transition.to( self, options )

Also, do I need to use scene at all?

Containers are display objects and have an ‘isVisible’ flag: