_window = 1 begin enum 1 _label _clickMeBtn end enum void local fn BuildWindow window _window, @"Simple Windowed Application", (0,0,366,59) textlabel _label, @"There have been no clicks yet", (18,23,250,16) button _clickMeBtn,,, @"Click Me", (267,13,86,32) end fn void local fn ButtonClicked static long clickCount = 0 clickCount++ textlabel _label, fn StringWithFormat( @"The button has been clicked %ld times", clickCount ) end fn void local fn DoDialog( ev as long, tag as long ) select ( ev ) case _btnClick select ( tag ) case _clickMeBtn : fn ButtonClicked end select end select end fn fn BuildWindow on dialog fn DoDialog HandleEvents