Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newformac

macrumors regular
Original poster
May 24, 2011
107
0
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.
 
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:
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.
 
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?
 
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.
 
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

https://forums.macrumors.com/showthread.php?p=12675673#post12675673
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.