Windows - ZvontyFlugence/NiGui GitHub Wiki

Here we will learn about the NiGui Window Type. The Window type allows NiGui to display a window to on the screen and to hold all of your applications controls and containers.

Window Properties

Here are all of the properties of the Window Type:

Window* = ref object of RootObj
    fDisposed: bool
    fTitle: string
    fVisible: bool
    fMinimized: bool
    fWidth, fHeight: int
    fClientWidth, fClientHeight: int
    fX, fY: int
    fControl: Control
    fIconPath: string
    fOnDispose: WindowDisposeProc
    fOnCloseClick: CloseClickProc
    fOnResize: ResizeProc
    fOnDropFiles: DropFilesProc
    fOnKeyDown: WindowKeyProc

Window Procedures and Methods

These are all of the procedures and methods available for use with the Window type

proc newWindow*(title: string = nil): Window

proc init*(window: WindowImpl)

proc dispose*(window: var Window)
method dispose*(window: Window)

proc disposed*(window: Window): bool

method visible*(window: Window): bool
method `visible=`*(window: Window, visible: bool)

method show*(window: Window)

method showModal*(window: Window, parent: Window)

method hide*(window: Window)

method minimized*(window: Window): bool
method `minimized=`*(window: Window, minimized: bool)

method minimize*(window: Window)

method control*(window: Window): Control
method `control=`*(window: Window, control: Control)

method add*(window: Window, control: Control)

method title*(window: Window): string
method `title=`*(window: Window, title: string)

method x*(window: Window): int
method `x=`*(window: Window, x: int)

method y*(window: Window): int
method `y=`*(window: Window, y: int)

method centerOnScreen*(window: Window)

method width*(window: Window): int
method `width=`*(window: Window, width: int)

method height*(window: Window): int
method `height=`*(window: Window, height: int)

method clientWidth*(window: Window): int

method clientHeight*(window: Window): int

method iconPath*(window: Window): string
method `iconPath=`*(window: Window, iconPath: string)

method closeClick*(window: Window)

method handleResizeEvent*(window: Window, event: ResizeEvent)

method handleKeyDownEvent*(window: Window, event: WindowKeyEvent)

method handleDropFilesEvent*(window: Window, event: DropFilesEvent)

method onDispose*(window: Window): WindowDisposeProc
method `onDispose=`*(window: Window, callback: WindowDisposeProc)

method onCloseClick*(window: Window): CloseClickProc
method `onCloseClick=`*(window: Window, callback: CloseClickProc)

method onResize*(window: Window): ResizeProc
method `onResize=`*(window: Window, callback: ResizeProc)

method onDropFiles*(window: Window): DropFilesProc
method `onDropFiles=`*(window: Window, callback: DropFilesProc)

method onKeyDown*(window: Window): WindowKeyProc
method `onKeyDown=`*(window: Window, callback: WindowKeyProc)

Window Events

Here are all of the Events associated with the Window type

WindowDisposeEvent* = ref object window*: Window

CloseClickEvent* = ref object window*: Window

ResizeEvent* = ref object window*: Window

DropFilesEvent* = ref object window*: Window

WindowKeyEvent* = ref object window*: Window
    key*: Key
    unicode*: int
    character*: string
    cancel*: bool
⚠️ **GitHub.com Fallback** ⚠️