Can you control the index of a SCREEN in the main tabsheet when you open it in OpenMode.NEW_TAB mode?
Hi,
Could you please describe in more details what you want to achieve?
Regards,
Gleb
when a screen is showed, I want to set the location of screen in the main tabsheet.
I want to show it behind the current screen, not at the end of the main tabsheet.
There is no such possibility out of the box. You can try to achieve this by overriding WebScreens
class. However, I strongly advise against it since you will have to revise behaviour each time you upgrade the platform.
whether to consider adding this feature in the new version or not, the default behavioral user experience is too bad now.
Ok maybe I misunderstood you, could you please describe what is wrong with current behavior?
Also consider the following:
- There is cuba.web.appWindowMode app property. Maybe
SINGLE
mode is what you are looking for. - You can specify launch mode when opening screen programmatically (see OpenMode enum reference), e.g:
screenBuilders.lookup(User.class, this)
.withScreenId("sec$User.browse")
.withLaunchMode(OpenMode.THIS_TAB)
assuming that the current Main Tab Sheet has opened two Screens, AScreen (position:0) and BScreen (position:1), users want to automatically return to the current AScreen after AScreen has opened a new CScreen in OpenMode.NEW_TAB mode.
since the new CScreen is placed at the end of Main Tab Sheet (the position of the CScreen is 2), when the CScreen is closed, the current tab will not go to AScreen but to BScreen, and users will need to switch to AScreen manually.
if the newly opened CScreen is inserted into AScreen, it will automatically return to AScreen after closing.
I wonder if I have made myself clear.
I looked at the source code and found that the addTab (Component Component Component, int position) method is already available on TabSheet, but not on the TabSheetBehaviour interface. It should be easy to expose. I sincerely hope to consider my suggestion that you can set position in ScreenBuilders
Ok, thank you for the explanation it’s clear now!
We will think about what API to provide for such case. Maybe something like OpenType.NEXT_TAB makes sense.