Mark <kamma@iname.com> writes Wed, 22 Jul 1998 17:02:55 -0400: >I was wondering how to put an input textfield into a window, in other >words the code below will accept an input value, however this extra >window pops up when I run it. So my question is how do you 'attach' a >input like textfield area to the '$win'. > >this is probably in a book someone, so sorry if I'm being lazy, but >could someone point me to some example. I suspect you can probably do everything you want using MacDialogs. There are good examples in <MacPerl Ä:ext:Mac:Dialogs:t:> and further examples in the book "MacPerl: Power and Ease" on pages 214-217. If you haven't got the book then now might be an excellent time to visit a bookshop, but the examples in 'ext:' should get you going. Use a 'kEditTextDialogItem' to get the input string rather than STDIN, which has nasty side effects. The prompt could be in a 'kStaticTextDialogItem'. You could write something like: $dlg = MacDialog->new( $winr, $title, 1, $style, 1, [kStaticTextDialogItem, Rect->new(10, 10, 300, 30), 'Please type etc.'], [kEditTextDialogItem, Rect->new(10, 50, 300, 70), ''], .... [kButtonDialogItem, Rect->new(220, 160, 300, 180), 'LETTERS'] ); Your three buttons could each pick up the string entered into the edit box in the following way (assuming for the sake of argument the 'LETTERS' button is number 6 in the list): $dlg->item_hit(6 => \&get_letters); sub get_letters { my ($dlg, $item) = @_; my $str = $dlg->item_text(2); ... } I am not sure quite what you want to do eventually with the strings returned by your buttons. But if you want, instead of using MacPerl::Answer(), you could write back directly to the dialog window like so: $dlg->item_text(3, $str); Here a 'kStaticTextDialogItem' is assumed as item 3 in the list. I hope this is clear and will be some help. Alan Fry "MacPerl Power and Ease" by Vicki Brown and Chris Nandor ISBN 1-881957-32-2 Published by Prime Time Freeware info@ptf.com <http://www.ptf.com> ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch