window

your first window

the whole runnable thing, from ahk and from c++

pick a door

you are writingyou getstatus
stock ahk v2Kit, over window.abi.dllready
c++window.core directly, raii, no marshallingready
finns ahk builda built-in class, no dll at allnot built yet, it is P1.34

from ahk

#Requires AutoHotkey v2.0
#Include %A_ScriptDir%\Kit.ahk

root := Kit.Blank()
root.Theme(Kit.Theme())

label := Kit.Label("kit, the ahk wrapper")
label.SetBounds(24, 20, 300, 20)

ok := Kit.Button("ok", Kit.Btn.Primary)
ok.SetBounds(24, 56, 90, 32)
ok.OnClick(_ctrl => MsgBox("clicked"))

root.Add(label).Add(ok)

app := Kit.Window("kit demo", 380, 210)
app.Root(root).Show()

three things worth knowing before you change anything

  • Show starts the pump, a SetTimer that drains the event queue. your script keeps its own thread, its hotkeys and every gui it already had
  • a fresh window is chromed and opaque, i.e. a real resizable app window. pass an options object for anything else
  • bounds set by hand are a choice, not a workaround, since P1.42 the tree measures itself, so a flow places a fresh label at its real width

ahk/demo.ahk is this script with a working click counter, and ahk/demo-flow.ahk is the same window with every bound taken out


from c++

the step by step lives in the c++ tutorials, five short pages from an empty folder to shapes and text. this is the shape of it at a glance

gui::host_desc_t desc;								// title, logical size, x/y, always_on_top, kind, present

desc.kind		= gui::host_kind_t::chromed;
desc.present	= gui::present_kind_t::opaque;		// chromed plus the default layered is refused

gui::host_t host;
host.create(desc);
host.set_paint([](gui::renderer_t& _r, gui::sizei_t _size) { /* draw */ });
host.show(true);

gui::run(host);										// or pump_once(host) from a loop of your own
  • update() draws one frame, and only if something asked for one
  • paint() is the forced full frame, written as an invalidate plus an update so it cannot drift away from a dirty one
  • coordinates are logical px. the host pushes the dpi scale as a transform for the frame, so a 150% monitor takes care of itself

next

you wantgo to
to draw something, one step at a timethe tutorials
the whole Kit surfacethe ahk side
the c++ api, per headerthe c++ api
what each control doeswidgets
it drew the wrong thingthe backend

On this page