Jump to content

Simple windowed application: Difference between revisions

Line 3,057:
 
top open</lang>
 
=={{header|Standard ML}}==
Works with PolyML
<lang Standard ML>open XWindows ;
open Motif ;
val countWindow = fn () =>
let
val ctr = ref 0;
val shell = XtAppInitialise "" "demo" "top" [] [XmNwidth 300, XmNheight 150 ] ;
val main = XmCreateMainWindow shell "main" [XmNmappedWhenManaged true ] ;
val frame = XmCreateForm main "frame" [XmNwidth 390, XmNheight 290 ] ;
val text = XmCreateLabel frame "show" [XmNlabelString "No clicks yet" ] ;
val buttn = XmCreateDrawnButton frame "press" [XmNwidth 75 , XmNheight 30 ,
XmNlabelString "Click me" ,
XmNbottomAttachment XmATTACH_POSITION,XmNbottomPosition 98 ] ;
val report = fn (w,c,t) =>
(XtSetValues text [XmNlabelString (Int.toString (ctr:= !ctr +1; !ctr)) ] ; t )
in
(
XtSetCallbacks buttn [ (XmNactivateCallback , report) ] XmNarmCallback ;
XtManageChildren [ text,buttn ] ;
XtManageChildren [ frame ] ;
XtManageChild main ;
XtRealizeWidget shell
)
end;
</lang>
call
countWindow () ;
 
 
=={{header|Tcl}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.