Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 3, 2011, 04:23 AM   #1
newformac
Banned
 
Join Date: May 2011
How to do something on launching of NSWindow?

Hi all,

i have and main NSWindow here on button click i open another NSWindow

like this.

Code:
[NSApp beginSheet: Child_Window modalForWindow: Main_Window modalDelegate: nil didEndSelector: NULL contextInfo: nil];
	
	int result = [NSApp runModalForWindow:Child_Window];
	[Child_Window orderOut:nil];
	[NSApp endSheet: Child_Window];
i want to set some text and label of child window before opening this,to display new text and label when its launched.

where i can do something when child window is launching.

thanks.
newformac is offline   0 Reply With Quote
Old Jun 3, 2011, 04:29 AM   #2
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
Why not just before calling beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:? Where are the outlets for the text and label? I'm presuming the text and label are in the sheet to be displayed, not in the window parenting the sheet.

BTW Is the code you posted above all in the same method?!

Last edited by jiminaus; Jun 3, 2011 at 04:36 AM.
jiminaus is offline   0 Reply With Quote
Old Jun 3, 2011, 04:34 AM   #3
newformac
Thread Starter
Banned
 
Join Date: May 2011
can i call any function before this.
newformac is offline   0 Reply With Quote
Old Jun 3, 2011, 05:11 AM   #4
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
Well not really any function. But you should be able to call setStringValue on an NSTextField object before it's on screen.

BTW. Please explain why you're calling both beginSheet and runModalForWindow on the same window. And where are orderOut and endSheet calls happening? The code you posted doesn't make much sense.
jiminaus is offline   0 Reply With Quote
Old Jun 3, 2011, 05:22 AM   #5
newformac
Thread Starter
Banned
 
Join Date: May 2011
this is commented now

//int result = [NSApp runModalForWindow:Child_Window];

if i open an widnow on which i m using a image view browser ,how can initialize the path for images before opening this window?
newformac is offline   0 Reply With Quote
Old Jun 3, 2011, 05:44 AM   #6
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
Quote:
Originally Posted by Learner View Post
this is commented now

//int result = [NSApp runModalForWindow:Child_Window];

if i open an widnow on which i m using a image view browser ,how can initialize the path for images before opening this window?
Set up an outlet to the image browser somewhere. Then setup the image browser using the outlet just before beginSheet.

The normal place to put the orderOut and endSheet calls is in the actions attached to the button(s) inside the sheets. Well, not so normal for orderOut, that's normally in the didEndSelector:, but you're not using one, so you need to do it in the button's action.
jiminaus is offline   0 Reply With Quote
Old Jun 3, 2011, 05:59 AM   #7
newformac
Thread Starter
Banned
 
Join Date: May 2011
Quote:
Originally Posted by jiminaus View Post
Set up an outlet to the image browser somewhere. Then setup the image browser using the outlet just before beginSheet.

The normal place to put the orderOut and endSheet calls is in the actions attached to the button(s) inside the sheets. Well, not so normal for orderOut, that's normally in the didEndSelector:, but you're not using one, so you need to do it in the button's action.
thanks

please provide help for my previous thread also i m stuck again

http://forums.macrumors.com/showthre...3#post12675673
newformac is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
NSWindow closes immediately after opening BadWolf13 Mac Programming 1 Apr 26, 2014 03:04 PM
Multiple Instances of NSWindow? Blakeasd Mac Programming 8 Sep 7, 2013 10:06 PM
Safari not launching bmorris Mac OS X 10.7 Lion 0 Jan 9, 2013 02:00 PM
NSWindow doesn't receive keyboard events qwaser Mac Programming 0 Aug 27, 2012 12:34 PM
iPhoto 9.3 not launching in ML amoda OS X 10.8 Mountain Lion 4 Jul 12, 2012 10:03 AM

Forum Jump

All times are GMT -5. The time now is 11:43 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC