Dear Mary,

The problem in your program is not related to the user interface itself. It is simply the most common mistake made by Oz newbies ;-)

declare [QTk]={Module.link["x-oz://system/wp/QTk.ozf"]}
declare A C D W H T E

(...)

D=lr(lr(label(text: 'Numero') entry(handle:H))
     button(text:"Show" action:proc {$}T={H get($)} end glue:we)
     button(text:"Others"  glue:we)
     button(text:"Others" glue:we)
empty button(text:"Exit" action: toplevel#close glue:we)continue) W={QTk.build D}
{W show}
{Numero T}

The variable T is declared global. If you enter 42, then click "Show", the action procedure of the button assigns T to "42". Now if you change the entry to 57, and click "Show" again, the action procedure attempts T="57", i.e., "42"="57", which doesn't work.

A solution to this issue is to browse the value of the entry in the action procedure of the button, therefore avoiding the use of a global variable. Your window description will look like

D=lr(lr(label(text: 'Numero') entry(handle:H))
     button(text:"Show" action:proc {$}
                                  {Numero {H get($)}}
                               end
            glue:we)
     button(text:"Others"  glue:we)
     button(text:"Others" glue:we)
empty button(text:"Exit" action: toplevel#close glue:we)continue)


Cheers,
raph

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users
  • Interface! Mary Aranda Cabezas
    • Re: Interface! Raphael Collet

Reply via email to