Awaking from Nib...Again...

whitesaint

cocoa love
Hi there, is there anyway that once an application is awaken from the Nib file, is it able to awake again while still running? The reason i wanna do this is because I'm working on an Mp3 Player and everything is cool, except i want it to have skin support. So Is there a way to set up a custom window/custom view, while the Application is running? Or perhaps another way to delete the current window and add a new one? All feedback is welcome and appreciated, thanks.

-whitesaint
 

Darkshadow

wandering shadow
Heh, I've been thinking of doing the same thing.

You can get a window to reload by first changing the window, then sending it a display message [window display] - that should redisplay everything that you just set. You could make a menu of the skins available, have the menu action be setting up the new window, and having the end of it be [window display]. That should work fine.
 

whitesaint

cocoa love
Yeah im pretty much almost done with it with Visualisations and everthing...however drag and drop is still a problem, but thats a whole nother story. Could you be clearer on how to display the window again? Because most of the stuff that needs to be redisplayed is alot! Such as playlists, buttons, button positions, custom views, custom window shapes, and the visualisation.

I would think it would be easier to close the window, and create a new one in IB. :rolleyes: Of course though, to just create another window and in IB along with all the interface objects along with it, and just send a [close] message to the previous one.

I would think it would go somthing like this:

- (IBAction)putThisSkinOn(id):sender
{
[previousWindow close:sender];
[newWindow display:sender];
[newWindow makeKeyorderFront:sender];
}

It would be somewhere along those lines...:rolleyes:

-whitesaint
 

Darkshadow

wandering shadow
That would be the long way of doing it IMO, though. Then you'd have to mess with multiple windw controllers...make sure everything is dealloced from the old window...etc, etc. Just a big pain if you ask me. :p

I think it's easier to do [newWindow display]. Right now, I'm working on a small app. This thing has an invisible window with a TextView in it. Programmatically, I turn on or off the border around the view (actually, the scroll view...but anyway), turn on or off the scroll bars, change the background color/make it clear, change the color of the text in it...resize the window...err, I think that's the full list.

After I do most of those, all I do is [newWindow display] - where newWindow is my invisible window. This updates everything in the window. Admittedly, I don't have buttons moving around, but telling it to display should update their positions as well.

Something like this

- (IBAction)putThisSkinOn: (id)sender
{
//code to update the skin & interface elements
[theWindow display];
}

..should do the trick.
 

whitesaint

cocoa love
maybe your right, i havnt tinkered around with both ways, but i will. I think if it's less code, such as doing most of it in IB it would be easier. That's just my opinion and I would rather have it done that way. By the way, do you have an clue where to start with NSDragandDrop?

-whitesaint
 
Top