On this page:
Window  Child  View
Window  View
Window  View.render
Window  View.run
Window  View.show
Window  View.close
Window  Child  View.focus
Window  Child  View.client_  to_  screen
Window  Child  View.screen_  to_  client
Window  Child  View.popup
Window  Callbacks
Window  Callbacks.accepts_  drop_  file
Window  Callbacks.drop_  file
Window  Callbacks.focus
Window  Callbacks.move
Window  Callbacks.size
Window  Callbacks.sub_  key
Window  Callbacks.sub_  mouse
Window  Callbacks.sub_  focus
Window  Callbacks.super_  activate
Window  Callbacks.super_  enable
Window  Callbacks.super_  show
0.45+9.0

3.3.1 Window View Interfaces🔗ℹ

interface

interface gui.WindowChildView:

  extends View

  implementable hidden

A window-child view represents a view that can be included within a window.

Create a WindowView using classes like Button, Canvas, and VPanel,

A window view creates a window when the view is rendered. A window view is an instance of WindowChildView because it supports the methods associated with that interface, but a window view cannot be provided as a child of a container view like HPanel or TabsPanel.

Create a WindowView using Window or Dialog.

method

method (wv :: gui.WindowView).render(parent :: maybe(Renderer) = #false)

  :: Renderer

Renders the view by creating and showing a window or dialog. The resulting window or dialog might be closed by the user; use WindowView.close to close it programmatically.

The result rendered should be destroyed using Renderer.destroy. Otherwise, the underlying GUI objects may be retained, especially via registrations with observables.

method

method (wv :: gui.WindowView).run(parent :: maybe(Renderer) = #false)

  :: Void

Renders the view, waits until the rendered window or dialog is closed, and then destroys the renderer.

method

method (wv :: gui.WindowView).show(on :: Any.to_boolean) :: Void

Shows or hides the most recent rendering of wv.

If a window is being shown via wv.run(), then hiding the window with wv.show(#false) will not cause wv.run() to complete. Use wv.close() to close the window.

method

method (wv :: gui.WindowView).close() :: Void

Hides the most recent rendering of wv and notifies the renderer, which can allow wv.run() to complete for a window.

method

method (v :: gui.WindowChildView).focus() :: Void

Moves keyboard focus to the most recent rendering of v.

Maps a position within the most recent rendering of v to a position in screen coordinates, or vice versa.

method

method (v :: gui.WindowChildView).popup(

  menu :: PopupMenu,

  x :: View.PositionInt,

  y :: View.PositionInt

) :: Void

Renders menu as a poupup menu at the position specified by x and y within v.

class

class gui.WindowCallbacks(

  ~accepts_drop_file: accepts_drop_file :: ObsOrValue.of(Boolean) = #false,

  ~drop_file: drop_file :: Path -> ~any = values,

  ~focus: focus :: Boolean -> ~any = values,

  ~move: move :: (View.PositionInt, View.PositionInt) -> ~any = values,

  ~size: size :: (View.SizeInt, View.SizeInt) -> ~any = values,

  ~sub_key: sub_key :: (WindowChildView, KeyEvent) -> Boolean

              = fun (v, e): #false,

  ~sub_mouse: sub_mouse :: (WindowChildView, MouseEvent) -> Boolean

                = fun (v, e): #false,

  ~sub_focus: sub_focus :: (WindowChildView, Boolean) -> ~any = values,

  ~super_activate: super_activate :: Boolean -> ~any = values,

  ~super_enable: super_enable :: Boolean -> ~any = values,

  ~super_show: super_show :: Boolean -> ~any = values

)

Configuration and callbacks that apply to all WindowChildView constructors, but grouped as WindowCallbacks because they are less commonly needed.

  • accepts_drop_file: Determines whether the view accepts drag-and-drop files.

  • drop_file: Called when the view receives a drag-and-drop file (when enabled).

  • focus: Called when the view gains or loses the keyboard focus, where the callback argument indicates whether the focus was gained.

  • move: Called when the view changes position relative to its parent. The callback arguments indicate the new horizontal and vertical positions. This callback is mostly useful for Window or Dialog views.

  • size: Like move, but called when the view changes size. The callback arguments indicate the new horizontal and vertical size.

  • sub_key: Call when a key event is to be delivered to the view or a view that it contains. If the result is a true value, then the event is considered handled and not propagated further. The first argument is the view whose (rendered form) is to receive the event if it is propagated.

  • sub_mouse: Call when a mouse event is to be delivered to the view or a view that it contains. If the result is a true value, then the event is considered handled and not propagated further. The first argument is the view whose is to receive the event if it is propagated.

  • sub_focus: Call when the view or a view that it contains gains or loses the keyboard focus. The first argument is the view whose changed focus, and the second argument is true if it gained the focus.

  • super_activate: Call when the view’s enclosing window has become the active window for keyboard focus or lost that status. The callback argument is true when the window became the active window.

  • super_enable: Called when the enable state of the view or an enclosing view changes. The callback argument indicates the new enable state

  • super_show: Called when the visibility of the view or an enclosing view changes. The callback argument is true when the view becomes shown.