A.7 DomDemo.oz

functor 
import 
   QTk at 'http://www.info.ucl.ac.be/people/ned/qtk/QTk.ozf' 
   TkTools
   Application
   Compiler
   Explorer
   Dominance
define 
   TextBox
   proc {Clear} {TextBox delete("1.0" "end")} end 
   proc {Solve}
      Text = {TextBox getText("1.0" "end" $)}
   in 
      try 
         Desc = {Compiler.virtualStringToValue '['#Text#']'}
         Pred = {Dominance.solutionPredicate Desc}
      in 
         {Explorer.object all(Pred)}
      catch _ then 
         {New TkTools.error
          tkInit(master:Window text:'error') _}
      end 
   end 
   proc {Quit } {Application.exit 0} end 
   Window={QTk.build
           lr(text(height:20 width:50 bg:white handle:TextBox)
              continue continue newline
              button(text:'Solve' glue:ew action:Solve)
              button(text:'Clear' glue:ew action:Clear)
              button(text:'Quit'  glue:ew action:Quit))}
   {Window show}
end


Denys Duchier
Version 1.2.0 (20010221)