Saurabh Kumar wrote:
I am trying to run the simple 'notepad application' given in the documentation of mozart.
While compiling the prog.
I am getting an error  saying :  variable Module not introduced .
for my first line in the prog :
declare [QTk]={Module.link ["http://www.info.ucl.ac.be/people/ned/qtk/QTk.ozf"]} <http://www.info.ucl.ac.be/people/ned/qtk/QTk.ozf"]}>
I am trying to compil by running the command :   ozc notepad.oz

This bit of code is intended to be compiled in the OPI (the editor). The OPI compiler automatically declares some identifiers like Module, and Open, which the shell compiler "ozc" does not.

Solution #1: compile it in the OPI.

Solution #2: make it an application functor, like the file in attachement. You can make an executable with it (notepad under unix/linux, notepad.exe under windows):

   ozc -x notepad.oz

Cheers,
raph
functor

import
   Open
   QTk at 'http://www.info.ucl.ac.be/people/ned/qtk/QTk.ozf'

define
   proc{SaveText}
      Name={QTk.dialogbox save($)}
   in 
      try 
         File={New Open.file init(name:Name flags:[write create])}
         Contents={TextHandle get($)}
      in 
         {File write(vs:Contents)}
         {File close}
      catch _ then skip end 
   end 

   proc{LoadText}
      Name={QTk.dialogbox load($)}
   in 
      try 
         File={New Open.file init(name:Name)}
         Contents={File read(list:$ size:all)}
      in 
         {TextHandle set(Contents)}
         {File close}
      catch _ then skip end 
   end

   Toolbar=lr(glue:we
              tbbutton(text:"Save" glue:w action:SaveText)
              tbbutton(text:"Load" glue:w action:LoadText)
              tbbutton(text:"Quit" glue:w action:toplevel#close))

   TextHandle

   Window={QTk.build td(Toolbar
                        text(glue:nswe handle:TextHandle bg:white 
tdscrollbar:true))}

   {Window show}
end
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to