• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: right way to load initial data in controls when opening a window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: right way to load initial data in controls when opening a window


  • Subject: Re: right way to load initial data in controls when opening a window
  • From: Steve Woodward <email@hidden>
  • Date: Thu, 3 Apr 2003 19:30:09 -0500

On Wednesday, April 2, 2003, at 10:37 PM, Tito Ciuro wrote:

Actually that does sound like a good idea Tito, will give it a try. Thanks!
The core of the problem for me is that I don't have a complete handle on inter-class communications. I know about sending messages and about accessor methods...but in this case I am confused because I am creating a window controller from another "parent" window controller and I'm not sure how the second window controller should reference data from the first window controller. The main window contains a tableView that I want to let users double click on to open a second window with the data from the selected row. Then they edit that data in the textfields and then save it, which closes the second window and sends the edited data back to the main window. Maybe I shouldn't have put that second window in it's own nib, maybe I should have added the window to the main nib?
I've got 4 Cocoa books on the coffee table...time to do some reading! Many thanks for all the help.

Steve W


One solution could send a notification with an updated dictionary. The window delegate (or a subclass of the window perhaps) would listen to that notification, extract the values and refresh the UI. Finish with a call to makeAndOrderFront.

Would that work for you?

-- Tito

On miircoles, abri 2, 2003, at 16:23 Europe/Madrid, Carrie Brezine wrote:

I'd also like to hear answers to this...

If I am understanding your question correctly, what I have done in these situations is to put the code in the window controller's showWindow method. Usually I have a method such as refreshScreen which clears controls or sets them to default values. I call this in showWindow, and reset any variables too. Seems to work for me, but maybe there is a more appropriate way...

carrie

On Tuesday, April 1, 2003, at 06:36 PM, email@hidden wrote:

Let's say you open a window and want to fill in some of the controls
with values (the window is in a separate nib). I create an instance of
the new window's controller and load the nib. I use an init method to
load up the data in the fields. But if the user closes the window then
reopens it it still has the old values...I'm assuming that's because
the window is not being released when it's closed, it's just being
hidden. What is the proper method to insure that I can load up the
values whether it's on the initial opening of the window or subsequent
"unhiding"? Thanks in advance for any tips.

Steve W
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: right way to load initial data in controls when opening a window
      • From: Bill Cheeseman <email@hidden>
References: 
 >Re: right way to load initial data in controls when opening a window (From: Tito Ciuro <email@hidden>)

  • Prev by Date: Re: NSTask autorelease OR retain/release -> SIGBUS
  • Next by Date: Re: NSTask autorelease OR retain/release -> SIGBUS
  • Previous by thread: Re: right way to load initial data in controls when opening a window
  • Next by thread: Re: right way to load initial data in controls when opening a window
  • Index(es):
    • Date
    • Thread