FROM : Jean-Daniel Dupas
DATE : Thu Mar 06 14:29:10 2008
As your window is in the same nib than your menu, you can simply bind
your menu item's action to the makeKeyAndOrderFront: method of the
window.
If you also want to add a button to close your window, bind the
button's action to performClose:
If you need a more complex logic, you can create an Outlet in your
controller (and create a controller class if you do not already have
one), bind this Outlet to your window, and then do whathever you want
with your window.
Le 6 mars 08 à 13:37, <email_removed> a écrit :
> Hi Jean-Daniel,
>
> I thought it would be something simple, which is probably why I
> couldn't find any reference for it on Google :-)
>
> Will check this when I get home.
>
> If this is the case, how does one then go about opening and closing
> the window, from say a menu item attached to an action ??
>
> Thanks
>
> -Mic
>
> On Mar 6 2008, Jean-Daniel Dupas wrote:
>
> Hi,
>
> To prevent your window to open at startup, uncheck the 'Visible At
> Launch' box in your window settings (in Interface Builder).
>
> I don't know a supported way to create an application that appears
> in the Dock but has the same behaviour than a LSUIElement.
>
>
>
> Le 6 mars 08 à 12:55, <email_removed> a écrit :
>
>> Hi,
>>
>> I'm relatively new to Cocoa but have an application that's coming
>> along nicely. Mostly when I have come across an issue I have
>> managed to find a solution using Google but this particular one
>> has me stumped.
>>
>> My application has three window, a notification window (similar to
>> Growl) that pops up when particular events happen, a window that
>> pops-up when the user clicks the dock icon and a preferences
>> window that pops up when the user selects preferences from a
>> StatusBarItem I have added to the status bar (or at least thats
>> how it should work). All windows are in MainMenu.nib
>>
>> The problem I'm having is that I don't want any windows to open
>> when the application launches, and at the moment the notification
>> window opens (as it's the only windows I've actually implemented
>> so far), and I also don't want a main menu because I've added a
>> custom menu to the status bar. I've looked at NSUIElement and
>> LSUIElement but they remove the dock icon also, and I need the
>> dock icon, plus they still launch the window.
>>
>> So ultimatley my question is, how do launch/setup my application
>> so that I get a dock icon, but no menu bar and so that no window
>> is opened when launched, only when the user does something that
>> prompts a window.
>>
>> Thanks in advance.
>>
>> -Mic
>> _______________________________________________
>>
>> Cocoa-dev mailing list (<email_removed>)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>>
>> This email sent to <email_removed>
>>
>
>
>
>
DATE : Thu Mar 06 14:29:10 2008
As your window is in the same nib than your menu, you can simply bind
your menu item's action to the makeKeyAndOrderFront: method of the
window.
If you also want to add a button to close your window, bind the
button's action to performClose:
If you need a more complex logic, you can create an Outlet in your
controller (and create a controller class if you do not already have
one), bind this Outlet to your window, and then do whathever you want
with your window.
Le 6 mars 08 à 13:37, <email_removed> a écrit :
> Hi Jean-Daniel,
>
> I thought it would be something simple, which is probably why I
> couldn't find any reference for it on Google :-)
>
> Will check this when I get home.
>
> If this is the case, how does one then go about opening and closing
> the window, from say a menu item attached to an action ??
>
> Thanks
>
> -Mic
>
> On Mar 6 2008, Jean-Daniel Dupas wrote:
>
> Hi,
>
> To prevent your window to open at startup, uncheck the 'Visible At
> Launch' box in your window settings (in Interface Builder).
>
> I don't know a supported way to create an application that appears
> in the Dock but has the same behaviour than a LSUIElement.
>
>
>
> Le 6 mars 08 à 12:55, <email_removed> a écrit :
>
>> Hi,
>>
>> I'm relatively new to Cocoa but have an application that's coming
>> along nicely. Mostly when I have come across an issue I have
>> managed to find a solution using Google but this particular one
>> has me stumped.
>>
>> My application has three window, a notification window (similar to
>> Growl) that pops up when particular events happen, a window that
>> pops-up when the user clicks the dock icon and a preferences
>> window that pops up when the user selects preferences from a
>> StatusBarItem I have added to the status bar (or at least thats
>> how it should work). All windows are in MainMenu.nib
>>
>> The problem I'm having is that I don't want any windows to open
>> when the application launches, and at the moment the notification
>> window opens (as it's the only windows I've actually implemented
>> so far), and I also don't want a main menu because I've added a
>> custom menu to the status bar. I've looked at NSUIElement and
>> LSUIElement but they remove the dock icon also, and I need the
>> dock icon, plus they still launch the window.
>>
>> So ultimatley my question is, how do launch/setup my application
>> so that I get a dock icon, but no menu bar and so that no window
>> is opened when launched, only when the user does something that
>> prompts a window.
>>
>> Thanks in advance.
>>
>> -Mic
>> _______________________________________________
>>
>> Cocoa-dev mailing list (<email_removed>)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>>
>> This email sent to <email_removed>
>>
>
>
>
>
| Related mails | Author | Date |
|---|---|---|
| micpringle | Mar 6, 12:55 | |
| Jean-Daniel Dupas | Mar 6, 13:13 | |
| micpringle | Mar 6, 13:37 | |
| Jean-Daniel Dupas | Mar 6, 14:29 | |
| Alastair Houghton | Mar 6, 15:02 | |
| Nir Soffer | Mar 6, 16:27 | |
| Michael Pringle | Mar 6, 17:30 | |
| Nir Soffer | Mar 6, 22:07 |






Cocoa mail archive

