Re: Getting a return value from a dialog
Re: Getting a return value from a dialog
- Subject: Re: Getting a return value from a dialog
- From: email@hidden
- Date: Wed, 28 Jun 2006 20:08:45 -0700
Your controller should be the one to slide out a sheet/window and
display it to the user.
In Interface Builder, wire-up/bind (preferably bindings) all the
connections before hand to your (dialog) window that will gather info
from the user.
When appropriate, the controller grabs the window, displays the sheet/
window, and a button on the sheet, when clicked, can tell the
controller (via action/target) to dismiss the sheet/window.
IOW, its not a "built in functionality" to get a return from a
window, instead you set up the window before hand just as if it were
a normal window that always shows up (except this one doesn't display
automatically), then your controller "orders" it to front, or as a
sheet to slide out.
So, just to clarify, you just set up a normal window, you don't need
to get a return value unless your want a cancel/o.k button (which you
can get with a sheet display method).
Then you just order it to front from your controller or use a sheet
display method. The controls (text fields, menus etc) are wired up to
the controller just like normal.
You just then hide and display that window when appropriate.
(Try to think in a Model/View/Controller way and its easier)
Hope this helps.
Andre
Dan Cavanagh wrote:
Hello all,
I am very much an amateur programmer, but have been learning Obj-C
for a while now, and am to the point where I am struggling more
with concepts rather than the language. (That's a good thing). I
have learned much from this list, and I thank the regular
contributers for my better understanding.
I have run into a conceptual roadblock: I am looking for a way to
pop a dialog and get a return value. My first fully-functioning app
is a tetris clone, so when someone gets a high score, I ask for
their name in a dialog (sheet, modal window, doesn't matter to me).
I have poured through Apples docs, searched mailing lists, and
Googled a lot, but the most I could come up with is the following
post:
http://www.omnigroup.com/mailman/archive/macosx-dev/2002-October/
042490.html
The reply says that there is no built-in function/method/class to
do that. So, my question to everyone is, what is the best way to
get a user-inputted value from a dialog? Several solutions come to
mind: global variable (doesn't really seem appropriate) and
notification (lots of overhead, I would think). I guess I'm looking
to implement something similar to a dialog "function/method" that
gives a return value.
Any help is greatly appreciated. A shove in the right direction
would do me well. Thanks!
Dan Cavanagh
_______________________________________________
MacOSX-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/macosx-dev
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden