Alan Oswald wrote:
I'm a complete newcomer to Mozart-Oz and am having difficulty handling
text input and output. Not to put too fine a point on it, I don't
seem to get the hang of it al all. I've checked various sources and
the only place I can find that actually deals with this deals only
with output. Please can someone help me to write a functor to do the
following
Request a number from the user at the command prompt
Output a text message to the user at the command prompt saying "N
bottles of beer chosen" where N is the number entered in response to
the request.
Thanking anyone who can help in advance.
My suggestion is that you start with **GUIs** for user I/O. It's very
simple.
Here is how to request something from the user:
declare [QTk]={Module.link ["x-oz://system/wp/QTk.ozf"]}
fun {GetText A}
H T D W in
D=td(lr(label(text:A) entry(handle:H))
button(text:"Ok"
action:proc {$} T={H get($)} {W close} end))
W={QTk.build D}
{W show} {W wait}
T
end
declare
N={GetText "How many bottles of beer?"}
{Browse {VirtualString.toString N#" bottles of beer chosen"}}
This starts by loading the QTk module, which is a high-level way to do GUIs.
See chapter 10 in CTM (the example is from page 684)! You can use the
function GetText for all your text input.
(In the Browser you have to select the Representation entry in the menu
Options
and click on Strings, so that the list of ASCII codes is displayed as text.)
Good luck!
Peter
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users