package quickterface
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Quick-to-program app interfaces in OCaml for terminal and web
Install
dune-project
Dependency
Authors
Maintainers
Sources
quickterface-0.1.0.tbz
sha256=8261e3819564fb5d05f1f313e62b73382152591d7a4349ae5b1b08a4fc2469f3
sha512=e739a971bb0e696ab716c168419c59a3d195922d2d1e4963106a845e3442ffa085b05106f36cceeec9b806bf7d6ef2c31e98db04911fbf73c5ac0ce626449d0f
doc/src/quickterface.terminal_app/input_field_container.ml.html
Source file input_field_container.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51open! Core type t = { mutable input_field : Input_field.t option } let make () = { input_field = None } let render ~render_info { input_field } = match input_field with | Some input_field -> Input_field.render ~render_info input_field | None -> Notty.I.empty let handle_key_event t key_event = match t.input_field with | Some input_field -> ( match Input_field.injest_key_event input_field key_event with | `Updated_to new_input_field -> t.input_field <- Some new_input_field | `Ready_to_be_destroyed -> t.input_field <- None) | None -> () let get_input ({ input_field } as t) ~refresh_render ~input_field_maker = match input_field with | Some _ -> Error (Error.create_s [%message "Input field is already active"]) | None -> let promise, resolver = Lwt.wait () in let new_input_field = input_field_maker ~resolver () in t.input_field <- Some new_input_field; Ok (let%lwt () = (* Before waiting for the result, refresh the render to show the input box *) refresh_render () in promise) let get_input_any_key t ~refresh_render () = get_input t ~refresh_render ~input_field_maker:Input_field.make_any_key let get_input_text ~prompt t ~refresh_render () = get_input t ~refresh_render ~input_field_maker:(Input_field.make_text ~prompt) let get_input_integer t ~refresh_render () = get_input t ~refresh_render ~input_field_maker:Input_field.make_integer let get_input_single_selection t ~refresh_render ~options ~option_to_string () = get_input t ~refresh_render ~input_field_maker: (Input_field.make_single_selection ~options ~option_to_string) let get_input_multi_selection t ~refresh_render ~options ~option_to_string () = get_input t ~refresh_render ~input_field_maker: (Input_field.make_multi_selection ~options ~option_to_string)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>