Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Modal support (dialogs) #24

Closed
3 tasks done
adam-arold opened this issue Oct 6, 2017 · 3 comments
Closed
3 tasks done

Modal support (dialogs) #24

adam-arold opened this issue Oct 6, 2017 · 3 comments
Assignees
Labels
feature New functionality for the program

Comments

@adam-arold
Copy link
Member

adam-arold commented Oct 6, 2017

Currently we use ComponentsLayerable:

class ComponentsLayerable(
        private val layerable: Layerable,
        private val components: DefaultContainer)
    : Layerable by layerable {

    override val layers: List<Layer>
        get() = components.toFlattenedLayers().plus(layerable.layers)
}

which composes a simple Layerable and a Container to manage both Components and simple Layers.

This should be improved by having a stack of Layerables:

  • At the bottom there should be Components
  • Above Components should be ModalComponents which have a size of the screen so the user can't interact with ordinary Components below a modal.
  • At the top there are the "ordinary" Layers.

Things to do:

  • Add addModal next to addComponent to ComponentContainer.
  • Implement the layers stack in CompoentContainer instead of what we have now in TileGridScreen
  • Factor out focus handling from DefaultComponentContainer into its own class
@adam-arold adam-arold added enhancement Enhances existing functionality without introducing new features needs planning labels Oct 6, 2017
@adam-arold adam-arold added this to the Component system upgrade milestone Oct 6, 2017
@coldwarrl
Copy link
Member

Possible Feature List:

  • obviously the possibility to position the modal dialog (and some defaults, like CENTER)
  • title for dialog
  • default submit button row (like Ok, Yes/No/Cancel etc.)
  • the possibility to define a custom submit button row
  • support for hotkeys (but I guess this should be more of a general feature ...shall we create a separate issue for that -> binding hotkeys to buttons and other UI elements ?)
  • stacking of model dialogs (although from an ux perspective this is often an anti-pattern but there might be some usecases where stacking is helpful)

@adam-arold
Copy link
Member Author

Good ideas! I think the dialog should work like a Panel (it can have shadow and a box around it with a title if using the latter option), but with the additional feature of having a button bar at the bottom (can be customized) and it blocks interaction with other components on the screen.

So the things you suggested are fine for a basic implementation but I think that stacking should be an enhancement later (if feasible). I was thinking about how the implementation should look like. Since a dialog should handle its own focus I think that behind the scenes a dialog should be a Screen with transparent background (because it has its own focus handling).

@coldwarrl
Copy link
Member

That sounds good :) Yes, the stacking of dialogs is secondary...

@adam-arold adam-arold added feature New functionality for the program Story Points: 8 and removed Story Points: 5 enhancement Enhances existing functionality without introducing new features labels Oct 26, 2018
@adam-arold adam-arold self-assigned this Oct 26, 2018
This was referenced Oct 26, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature New functionality for the program
Projects
None yet
Development

No branches or pull requests

2 participants