Git Product home page Git Product logo

Comments (2)

FloVanGH avatar FloVanGH commented on May 27, 2024 1

API draft

This is the collection of some ideas how the TimePicker could looks like from API side and should be used as base for discussions.

export component TimePicker {
      in-out property <date-time> current-time;
      in property <string> local: "en_US";
}

Use as component and inside of a PopupWindow

import { Button, TimePicker } from "std-widgets.slint";

export component MainWindow inherits Window {
      width: 600px;
      height: 400px;
      
      time-picker-popup := PopupWindow {
          width: 200px;
          height: 200px;
          
          TimePicker {}
      }
      
      VerticalLayout {
          time-picker := TimePicker {}
          Text {
              text: time-picker.current-time;
          }
          
          Button {
                text: "Open TimePicker Popup";
                clicked => {
                    time-picker-popup.show();
                }
          }
      }
      
}

Ready to use dialog

export component TimePickerPopup {
      in-out property <date-time> current-time;
      in property <string> local: "en_US";
      
      public function show() -> date-time {
            //...
      }
}
import { TimePickerPopup } from "std-widgets.slint";

export component MainWindow inherits Window {
      width: 600px;
      height: 400px;
      
      time-picker-popup := TimePickerPopup {
            width: 200px;
            height: 200px;
      }
      
        Button {
                text: "Open TimePicker Popup";
                clicked => {
                    debug(time-picker-popup.show());
                }
          }
}

Use with LineEdit

The idea is that if input-type of LineEdit is set and it gets focus a time picker popup open automatically. As alternative a more explicit method that give more flexibility when the popup should be open could be possible.

import { LineEdit } from "std-widgets.slint";

export component MainWindow inherits Window {
      width: 600px;
      height: 400px;
      
      LineEdit {
            input-type:  InputType.time;
      }
}

from slint.

WilstonOreo avatar WilstonOreo commented on May 27, 2024

Regarding the date-time type, I added a separate issue to track this: #5122

from slint.

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.