Git Product home page Git Product logo

Comments (8)

ArthurSonzogni avatar ArthurSonzogni commented on July 21, 2024 1

Yes, sorry.
I had a predefined idea about how this should be implemented and wanted to complete it. Thanks for filling this issue, this forced me to complete it.

from ftxui.

ArthurSonzogni avatar ArthurSonzogni commented on July 21, 2024

Thanks you!

I initially hoped we could get this using the "dbox" Element.
This is a container (like hbox, vbox) that superpose the elements.

It turns out I also needed some few more features:

  • Adding the TakeFocus() function to component.
  • Adding the clear_under Element

I just added an example: ./examples/component/modal_dialog.cpp
This is on the dev branch.

This give me:
asciicast

from ftxui.

ArthurSonzogni avatar ArthurSonzogni commented on July 21, 2024

This is mostly included in this pull request:
#44

from ftxui.

VedantParanjape avatar VedantParanjape commented on July 21, 2024

Ohhh, Great man !!

I thought I would be able to contribute this 😄

from ftxui.

lanza avatar lanza commented on July 21, 2024

Have you thought about baking this modal functionality into the ComponentBase such that you'd always have the functionality to call showModal(ModalComponent component) where we have something like using ModalComponent = std::shared_ptr<ModalComonentBase>? And then dismiss could be just on the ModalComponent and it held a reference to its host ComponentBase which would toggle the depth variable for us.

from ftxui.

ArthurSonzogni avatar ArthurSonzogni commented on July 21, 2024

What about creating an API like this;

auto main_component  = ...;
auto modal = ...;

bool show_modal = false;
auto main_component_and_modal = Modal(main_component, modal, &show_modal);

Alternatively we are now supporting "nested" InteractiveScreen. So you can already use right now:

void ShowModal() {
  auto modal_screen = ...;
  auto modal_component = ...;
  modal_screen.Loop(modal_component);
}

void main() {
  auto main_screen = ...;
  auto main_component = ... (show_modal);
  main_screen.Loop(main_component);
}

from ftxui.

ArthurSonzogni avatar ArthurSonzogni commented on July 21, 2024

I added Modal in the PR. What do you think of it?

from ftxui.

lanza avatar lanza commented on July 21, 2024

Yup, looks good to me! Thanks!

from ftxui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.