Re: addsubview

2012-04-24 Thread Keary Suska
On Apr 20, 2012, at 9:19 AM, koko wrote:

> Here is the code that creates and adds the subview The method 
> -makeAndWrapViews is in the custom class of the NSTabViewItem view.
> 
> I do get -viewDidMoveToSuperview when addSubview is called.
> 
> When the tab is clicked I do get viewdidMoveToWindow
> 
> But I never see thev iew!
> 
> - (void)makeAndWrapViews
> {
>NSRect frame = [self frame];

Who is "self" here? Is it the tab view item view? If so, does the tab view item 
know that you are using a custom subclass? Lastly, what is the origin point (to 
make sure it isn't being placed outside the viewable area)?

>frame.size.width = 288;
>frame.size.height = 259;
> 
>m_text = [[NSPDText alloc] initWithFrame:frame];
> 
>  BOOL text = [NSBundle loadNibNamed:@"NSPDText" owner:m_text];
> 
>  if (text) 
>{
>[self addSubview:m_text];
>}
> }

Does this code work when you substitute NSPDText with a canned cocoa UI object?

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Updating NSMenu while it's open

2012-04-24 Thread vinayak pai
Yes. I am facing the same problem. I am updating the menu in
performSelectorOnMainThread. If the menu is kept open without any
event then there is menu refreshing issue ie. sometimes some items
will be shown twice. When I move the mouse over items then it will
update. But, when the menu is open and mouse is still then  the menu
won't update. Is there a way to update the menu while it's open
without any mouse movement like System WiFi menu?

Best regards,
VinPai

On Fri, Apr 20, 2012 at 11:42 AM, Ken Thomases  wrote:
> On Apr 18, 2012, at 3:14 PM, vinayak pai wrote:
>
>> I have a NSMenu with dynamically added NSMenuItems. The NSMenu is not
>> refreshing properly while it's kept open.
>> The NSMenu update method is called in NSRunLoopCommonModes.
>
> I think I've answer you in another forum, but you can simply call the 
> appropriate methods of NSMenu and NSMenuItem to modify them.
>
> For example, my company's application, CrossOver, populates a "Programs" menu 
> by scanning the contents of a particular folder.  The menu starts out with a 
> single disabled "Loading…" item.  In a background thread, the app scans the 
> folder and builds a hierarchy of programs.  When the scan is complete, it 
> does a -performSelectorOnMainThread:… to install that hierarchy in the menu.
>
> Since the scanning is occurring on a background thread, it is "spontaneous" 
> from the point of view of the UI.  If the Programs menu is pulled down when 
> it completes, the menu will update itself.  However, in doing some testing 
> right now, I see that it only updates when some event occurs.  Mouse movement 
> is enough.  However, if I pull down the menu and leave the mouse still, it 
> will not update no matter how long I leave it.  Then, when I move the mouse, 
> poof, the menu updates.  Testing done on Lion 10.7.3.
>
> Regards,
> Ken
>

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSDateFormatter problem

2012-04-24 Thread Lorenzo Thurman

On Apr 20, 2012, at 9:32 AM, Keary Suska wrote:

> On Apr 20, 2012, at 6:08 AM, Lorenzo Thurman wrote:
> 
>> On Apr 19, 2012, at 10:18 PM, Keary Suska wrote:
>> 
>>> 
>>> Perhaps this excerpt from the API doc is key: "Do not use these constants 
>>> if you want an exact format." Why, might be academic, but if you require a 
>>> specific style, you may want to specify the style specifically.
>>> 
>> I have tried using strings to specify the styles, but no luck.
> 
> It is next to impossible that specifying a fixed format will not render the 
> precisely requested results, except programmer error. We can't tell you what 
> you are doing wrong if you don't show us what you are doing.
> 
>> Is there a way to reset the Language and Text Preferences? Is there an 
>> associated Preferences I can throw away?
> 
> I think it is part of com.apple.systempreferences.plist in 
> ~/Library/Preferences. You can test that by dragging it to the desktop and 
> restarting.
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 



I agree. This should not happen, but here is my original code:
-(NSString*)formattedDate:(NSDate*)aDate{

NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"mm-dd- hh:mm a"];


NSString * dateString = [formatter stringFromDate:aDate];

return [self stringWithSentenceCapitalization:dateString];
}
and it produces the incorrect format.
It is called like this:

[weathervane formattedDate:[timer fireDate]];

[timer fireDate]
returns a date in this format:
2012-04-20 18:23:43 +

I've also rebuilt the revision of the source for the old build that I have and 
it produces the same flawed results. 
In any case, I'll edit the global prefs and see if it makes a difference. I 
really hope that I made an error somewhere. Thats a problem I can fix.


"...Business! Mankind was my business. The common welfare was my business; 
charity, mercy, forbearance, and benevolence, were all my business. The 
dealings of my trade were but a drop of water in the comprehensive ocean of my 
business!"

Marly's ghost - A Christmas Carol


Lorenzo Thurman
lore...@thethurmans.com




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: addsubview

2012-04-24 Thread koko

On Apr 20, 2012, at 12:13 PM, Keary Suska wrote:

> On Apr 20, 2012, at 9:19 AM, koko wrote:
> 
>> Here is the code that creates and adds the subview The method 
>> -makeAndWrapViews is in the custom class of the NSTabViewItem view.
>> 
>> I do get -viewDidMoveToSuperview when addSubview is called.
>> 
>> When the tab is clicked I do get viewdidMoveToWindow
>> 
>> But I never see thev iew!
>> 
>> - (void)makeAndWrapViews
>> {
>>   NSRect frame = [self frame];
> 
> Who is "self" here? Is it the tab view item view? If so, does the tab view 
> item know that you are using a custom subclass? Lastly, what is the origin 
> point (to make sure it isn't being placed outside the viewable area)?

self is the custom class of the view that is owned by the tab view item.
you do not use a custom class for the tab view item
the origin is 10,25

> 
>>   frame.size.width = 288;
>>   frame.size.height = 259;
>> 
>>   m_text = [[NSPDText alloc] initWithFrame:frame];
>> 
>> BOOL text = [NSBundle loadNibNamed:@"NSPDText" owner:m_text];
>> 
>> if (text) 
>>   {
>>   [self addSubview:m_text];
>>   }
>> }
> 
> Does this code work when you substitute NSPDText with a canned cocoa UI 
> object?
Yes.  I created an NSButton in the same method, added it and it 
displays.

> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSDateFormatter problem

2012-04-24 Thread Lorenzo Thurman

On Apr 20, 2012, at 9:32 AM, Keary Suska wrote:

> On Apr 20, 2012, at 6:08 AM, Lorenzo Thurman wrote:
> 
>> On Apr 19, 2012, at 10:18 PM, Keary Suska wrote:
>> 
>>> 
>>> Perhaps this excerpt from the API doc is key: "Do not use these constants 
>>> if you want an exact format." Why, might be academic, but if you require a 
>>> specific style, you may want to specify the style specifically.
>>> 
>> I have tried using strings to specify the styles, but no luck.
> 
> It is next to impossible that specifying a fixed format will not render the 
> precisely requested results, except programmer error. We can't tell you what 
> you are doing wrong if you don't show us what you are doing.
> 
>> Is there a way to reset the Language and Text Preferences? Is there an 
>> associated Preferences I can throw away?
> 
> I think it is part of com.apple.systempreferences.plist in 
> ~/Library/Preferences. You can test that by dragging it to the desktop and 
> restarting.
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 



I agree. This should not happen, but here is my original code:
-(NSString*)formattedDate:(NSDate*)aDate{

NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"mm-dd- hh:mm a"];


NSString * dateString = [formatter stringFromDate:aDate];

return [self stringWithSentenceCapitalization:dateString];
}
and it produces the incorrect format.
It is called like this:

[weathervane formattedDate:[timer fireDate]];

[timer fireDate]
returns a date in this format:
2012-04-20 18:23:43 +

I've also rebuilt the revision of the source for the old build that I have and 
it produces the same flawed results. 
In any case, I'll edit the global prefs and see if it makes a difference. I 
really hope that I made an error somewhere. Thats a problem I can fix.


"...Business! Mankind was my business. The common welfare was my business; 
charity, mercy, forbearance, and benevolence, were all my business. The 
dealings of my trade were but a drop of water in the comprehensive ocean of my 
business!"

Marly's ghost - A Christmas Carol


Lorenzo Thurman
lore...@thethurmans.com




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: addsubview

2012-04-24 Thread Keary Suska
On Apr 20, 2012, at 1:02 PM, koko wrote:

>> Does this code work when you substitute NSPDText with a canned cocoa UI 
>> object?
>   Yes.  I created an NSButton in the same method, added it and it 
> displays.

Then it is most likely the case that the issue is with the NSPDText, that it is 
not displaying itself as it should. What is NSPDText anyway? It isn't a Cocoa 
class that I know of.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSDateFormatter problem

2012-04-24 Thread Lorenzo Thurman

On Apr 20, 2012, at 11:30 AM, Charles Srstka wrote:

> On Apr 20, 2012, at 9:32 AM, Keary Suska wrote:
> 
>>> Is there a way to reset the Language and Text Preferences? Is there an 
>>> associated Preferences I can throw away?
>> 
>> I think it is part of com.apple.systempreferences.plist in 
>> ~/Library/Preferences. You can test that by dragging it to the desktop and 
>> restarting.
> 
> The com.apple.systempreferences.plist file only determines the settings for 
> the System Preferences app itself. What you want is actually part of 
> .GlobalPreferences.plist, although that file also contains a lot of other 
> settings, so I wouldn’t nuke the whole plist file, but rather open it with 
> Xcode and edit it a bit more surgically.
> 
> The pref keys you are interested in, I believe, would be AppleLocale, 
> AppleICUDateFormatStrings, and AppleICUTimeFormatStrings.
> 
> Charles
> 


[formatter setFormatterBehavior:NSDateFormatterBehavior10_4]

this fixed it. 

Thanks for the help

"Yes Virginia, there is a Chaminade"
--unknown

Lorenzo Thurman
lore...@thethurmans.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSDateFormatter problem

2012-04-24 Thread Keary Suska

On Apr 20, 2012, at 12:16 PM, Lorenzo Thurman wrote:

> I agree. This should not happen, but here is my original code:
> -(NSString*)formattedDate:(NSDate*)aDate{
>   
>   NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
>   [formatter setDateFormat:@"mm-dd- hh:mm a"];
>   
>   
>   NSString * dateString = [formatter stringFromDate:aDate];
>   
>   return [self stringWithSentenceCapitalization:dateString];
> }
> and it produces the incorrect format.
> It is called like this:
> 
> [weathervane formattedDate:[timer fireDate]];
> 
> [timer fireDate]
> returns a date in this format:
> 2012-04-20 18:23:43 +

This may be because the format is invalid, although I wouldn't have thought so. 
It should be: @"MM-dd-yyy hh:mm a". Might be worth a try.

For giggles, what does -[formatter formatterBehavior] return? Does setting it 
explicitly to NSDateFormatterBehavior10_4 change anything?

> I've also rebuilt the revision of the source for the old build that I have 
> and it produces the same flawed results. 
> In any case, I'll edit the global prefs and see if it makes a difference. I 
> really hope that I made an error somewhere. Thats a problem I can fix.

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSDateFormatter problem

2012-04-24 Thread Lorenzo Thurman

On Apr 20, 2012, at 11:30 AM, Charles Srstka wrote:

> On Apr 20, 2012, at 9:32 AM, Keary Suska wrote:
> 
>>> Is there a way to reset the Language and Text Preferences? Is there an 
>>> associated Preferences I can throw away?
>> 
>> I think it is part of com.apple.systempreferences.plist in 
>> ~/Library/Preferences. You can test that by dragging it to the desktop and 
>> restarting.
> 
> The com.apple.systempreferences.plist file only determines the settings for 
> the System Preferences app itself. What you want is actually part of 
> .GlobalPreferences.plist, although that file also contains a lot of other 
> settings, so I wouldn’t nuke the whole plist file, but rather open it with 
> Xcode and edit it a bit more surgically.
> 
> The pref keys you are interested in, I believe, would be AppleLocale, 
> AppleICUDateFormatStrings, and AppleICUTimeFormatStrings.
> 
> Charles
> 


[formatter setFormatterBehavior:NSDateFormatterBehavior
"Yes Virginia, there is a Chaminade"
--unknown

Lorenzo Thurman
lore...@thethurmans.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSDateFormatter problem

2012-04-24 Thread Lorenzo Thurman


"My Break-Dancing days are over, but there's always the Funky Chicken" -- The 
Full Monty

On Apr 20, 2012, at 3:47 PM, Keary Suska  wrote:

> 
> On Apr 20, 2012, at 12:16 PM, Lorenzo Thurman wrote:
> 
>> I agree. This should not happen, but here is my original code:
>> -(NSString*)formattedDate:(NSDate*)aDate{
>>
>>NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
>>[formatter setDateFormat:@"mm-dd- hh:mm a"];
>>
>>
>>NSString * dateString = [formatter stringFromDate:aDate];
>>
>>return [self stringWithSentenceCapitalization:dateString];
>> }
>> and it produces the incorrect format.
>> It is called like this:
>> 
>> [weathervane formattedDate:[timer fireDate]];
>> 
>> [timer fireDate]
>> returns a date in this format:
>> 2012-04-20 18:23:43 +
> 
> This may be because the format is invalid, although I wouldn't have thought 
> so. It should be: @"MM-dd-yyy hh:mm a". Might be worth a try.
> 
> For giggles, what does -[formatter formatterBehavior] return? Does setting it 
> explicitly to NSDateFormatterBehavior10_4 change anything?
> 
>> I've also rebuilt the revision of the source for the old build that I have 
>> and it produces the same flawed results. 
>> In any case, I'll edit the global prefs and see if it makes a difference. I 
>> really hope that I made an error somewhere. Thats a problem I can fix.
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 

I just got this one after I changed the behavior. And yes indeed, the format is 
wrong. Thanks again. 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: addsubview

2012-04-24 Thread Martin Wierschin
> I have searched high and low and can find no reason for a subview to not 
> display.  Is this a trivial problem not worthy of list comment or is it truly 
> a difficult problem that cannot be dealt with as easily as more mundane 
> topics found here?

You've waited only about 90 minutes since your last email. This message list 
isn't a service you pay for, it's just a great community, and your impatient 
attitude doesn't encourage others to help.

>>   NSRect frame = [self frame];
>>   frame.size.width = 288;
>>   frame.size.height = 259;

You should probably be calling [self bounds], since you're positioning the new 
subview inside the receiver (self), not inside the view containing the receiver.

~Martin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: addsubview

2012-04-24 Thread Jerry Krinock

On 2012 Apr 20, at 09:49, koko wrote:

> Is this a trivial problem not worthy of list comment or is it truly a 
> difficult problem … ?

When no one replies, it's usually the latter, but it might be something easy.

When a programmatically-created subview doesn't show for me, it's usually 
because I've screwed up its frame origin and placed it outside the bounds of 
the superview.  Pay attention to what -isFlipped.  Also, make sure your new 
subview is not 'hidden'.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: addsubview

2012-04-24 Thread Scott Ribe
On Apr 20, 2012, at 10:49 AM, koko wrote:

> I have searched high and low and can find no reason for a subview to not 
> display.  Is this a trivial problem not worthy of list comment or is it truly 
> a difficult problem that cannot be dealt with as easily as more mundane 
> topics found here?

Are you sure you're drawing it? Are you sure you're drawing it at the right 
location?

BTW, it is a horribly, horribly bad idea to use the "NS" prefix on your own 
classes.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Updating NSMenu while it's open

2012-04-24 Thread Ken Thomases
On Apr 20, 2012, at 1:32 PM, vinayak pai wrote:

> Yes. I am facing the same problem. I am updating the menu in
> performSelectorOnMainThread. If the menu is kept open without any
> event then there is menu refreshing issue ie. sometimes some items
> will be shown twice. When I move the mouse over items then it will
> update. But, when the menu is open and mouse is still then  the menu
> won't update. Is there a way to update the menu while it's open
> without any mouse movement like System WiFi menu?

I'm not sure.  If menus are shown twice, then I suspect a synchronization bug 
in your code.

You can try posting an application-defined event (NSEvent of type 
NSApplicationDefined) to the event queue after you've changed the menus.

Regards,
Ken


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Displaying history - potential ways to do it

2012-04-24 Thread The Rhythmic
Hi, Am a newbie to iOS development. I want to display the DB history i.e.
the changes the users make to a specific critical table in the DB, from
bottom-up, i.e. the first update appears bottom-most ...something like

...
...
Apr 10th - Changed 'status' field from 'boolean' to 'char'
Apr 5th - Granted Joe access to the table
Apr 2nd - Added a column to the table

And I would like to display it in a fancy way...something like the timeline
in Path app if I should say a recent example.

One possible way I see to do this is to use UITableViewCell. Is there any
other way to do this? Which is recommended/apt?


Thanks
Priya
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: addsubview

2012-04-24 Thread Aaron Burghardt

On Apr 20, 2012, at 10:49 AM, koko  wrote:

> Ah, ain't Cocoa a great, modern (85?) environment.

Ah yes, snarky potshots are time-proven way to get help from a forum. May I 
suggest you consider an alternative approach: 
http://www.catb.org/~esr/faqs/smart-questions.html.

> 
> 
> On Apr 20, 2012, at 9:23 AM, koko wrote:
> 
>> Here is the code that creates and adds the subview The method 
>> -makeAndWrapViews is in the custom class of the NSTabViewItem view.
>> 
>> I do get -viewDidMoveToSuperview when addSubview is called.
>> 
>> When the tab is clicked I do get viewdidMoveToWindow
>> 
>> But I never see thev iew!
>> 
>> - (void)makeAndWrapViews
>> {
>>   NSRect frame = [self frame];
>>   frame.size.width = 288;
>>   frame.size.height = 259;
>> 
>>   m_text = [[NSPDText alloc] initWithFrame:frame];
>> 
>> BOOL text = [NSBundle loadNibNamed:@"NSPDText" owner:m_text];
>> 
>> if (text) 
>>   {
>>   [self addSubview:m_text];
>>   }
>> }
>> 

Is NSPDText a subclass of NSView? If so, I guess it should work, but it's 
unusual to have a view be the owner of a NIB. You are mixing view and 
controller layers, so you may want to consider a different design just to 
clarify the roles of objects.

It appears you expect the content of the NIB to be visible. But, you add m_text 
as a subview and it has no subviews; the fact that m_text is the owner of the 
NIB does not cause views in the NIB to be added automatically to the owner. if 
m_text has an outlet to a view, that will be connected, but then m_text must 
add the view to itself as a subview. Try this quick experiment: in NSPDText, 
override -drawRect and scribble in the view, such as (written in Mail):

- (void)drawRect:(NSRect)rect {

[@"Hello World" drawAtPoint:rect.location withAttributes:nil];
}

Aaron


>> 
>> 
>> 
>> 
>> On Apr 20, 2012, at 7:56 AM, koko wrote:
>> 
>>> Good questions.
>>> 
>>> As an experiment, in the same method in which I create and add the subview 
>>> which is not displaying I create an NSButton using the same frame as for 
>>> the subview.  I add the NSButton and it displays.
>>> 
>>> So, I am sure the NSTabviewItem view is correct.
>>> 
>>> As to the subview, I added a delegate method for when the tab is clicked.  
>>> Breaking there and dumping the subviews I see my subview in the view 
>>> hierarchy.
>>> 
>>> This seems such a trivial task that I am quite puzzled.
>>> 
>>> -koko
>>> 
>>> 
>>> On Apr 19, 2012, at 9:27 PM, Keary Suska wrote:
>>> 
 On Apr 19, 2012, at 5:34 PM, koko wrote:
 
> I get the view for an NSTabViewItem.
> 
> To this view I add a subview.
 
 How do you (in code) identify the correct NSTabViewItem, retrieve the view 
 and add the subview? What is the frame of the subview?
 
> In the debugger displaying the subviews of view I see the subview.
 
 How do you know it is the correct/same subview?
 
> When  the NSTabViewItem displays  the subview is not being shown.  The 
> view does display.
> 
> The subview is not set hidden in IB.
> 
> Why would I not see the subview?
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Adding cells from the bottom (like a stack) in UITableView

2012-04-24 Thread The Rhythmic
Hi, Am a newbie to iOS programming. This is what am trying to do:

1. The user enters some text in the screen and it keeps getting added to a
UITableView.

2. As usual, it's getting added *from* the top.

3. But I want to add it from the bottom i.e. each new message that's added
is added *above *the rest/existing ones, and not below.

Can someone offer some pointer on this please!

Thanks
Priya
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


How to get the embossed look of the entire cell in UITableView?

2012-04-24 Thread The Rhythmic
Hi, Am a newbie to iOS programming. In the app am writing, am adding user
inputs dynamically/programmatically to UITableView. For each user input, I
put it in a UITableViewCell and add it to the UITableView. I want the table
cells to look like in the iPhone 'Messages' screen (like a bubble or some
embossed look of the 'entire' cell). How is this possible? Any help please?

Thanks
Priya
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Redrawing overlay views

2012-04-24 Thread Erik Stainsby
I have a window which owns a webview over which I place buttons (in their own 
subviews) where the user has clicked.  However, because they are not part of 
the webview's hierarchy of objects, when the window is resized the webview 
content will likely reflow. I therefore need to reposition the buttons. I have 
methods which annotate the DOM and which cache references to the nodes the user 
has selected.  I am thinking to walk the cache of nodes and redraw the button's 
views at the new location of the corresponding DOM element. I am halfway 
through implementing this strategy but would be interested to hear other 
opinions of how this might be achieved.

Below is some of the code I have in the works which responds to the window's 
windowDidResizeNotification in the windowController and instructs the webView 
to walk the cache of user-selected DOM nodes.   At present I cannot seem to 
recall the DOM nodes from the dictionary in which the code caches them.


#import 
#import 
#import "RSWebView.h"

//
//  this controller is both windowController and webview frameLoadDelegate

@interface RSTrixieController : NSWindowController < NSComboBoxDataSource, 
NSComboBoxDelegate >

@property (retain) IBOutlet RSWebView * webview;

- (void) refreshWebviewOverlay:(NSNotification*)nota;

@end


@implementation

@synthesize webview;

- (void)windowDidLoad
{
[super windowDidLoad];

[[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(refreshWebviewOverlay:) name:NSWindowDidResizeNotification 
object:[webview window]];
}

- (void) refreshWebviewOverlay:(NSNotification*)nota {
[[self webview] repositionLocatorViews];
}

[…]

@end



Then from the webView which responds:


@implementation

@synthesize boundingBox;// trivial view which draws it's outline
@synthesize locators;   // mutable dict - button-hosting views - 
keyed-alike to taggedNodes
@synthesize taggedNodes;// mutable dict - DOMElements adjacent - 
keyed-alike to locators


- (void) repositionLocatorViews {

// clean up
[self removeBoundingBox];

for(NSString * idtag in [taggedNodes allKeys]) 
{   
DOMElement * node = [taggedNodes objectForKey:idtag];
RSBoundingBox * bbox = [[RSBoundingBox alloc] 
initWithFrame:[node boundingBox]];
NSRect newBox = [self flipBoundingBox:[bbox frame] 
fromWebView:self];
[bbox setFrame:newBox];
RSLocatorViewController * lv = [locators objectForKey:idtag];
[[lv view]setFrame: [self frameRelativeTo:bbox]];
}
} 


- (NSRect) flipBoundingBox:(NSRect)htmlBox fromWebView:(WebView*)webView {
NSRect bounds = [[[webView window] contentView] bounds];
float newY = bounds.size.height - htmlBox.size.height - 
htmlBox.origin.y;
return NSMakeRect(htmlBox.origin.x,newY,htmlBox.size.width, 
htmlBox.size.height);
}


- (NSRect) frameRelativeTo:(RSBoundingBox*)bbox {
return NSMakeRect(bbox.frame.origin.x-20, bbox.frame.origin.y + 
bbox.frame.size.height - 20, 20, 20);
}


- (void) removeBoundingBox {
if(nil != boundingBox)
{
[boundingBox removeFromSuperview];
boundingBox = nil;
}
}

[ … ]


Any thoughts and suggestions welcomed.


Erik Stainsby
erik.stain...@roaringsky.ca

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: activating Delete menu item through binding

2012-04-24 Thread Koen van der Drift

On Apr 16, 2012, at 7:34 PM, Quincey Morris wrote:

> Yes, that's an awkward case. Although a NSViewController *is* a responder, it 
> *isn't* automatically added to the responder chain. Therefore it cannot be 
> found as first responder, and so its action method is not recognized by menu 
> validation. :)
> 
> You can manually add the view controller to the responder chain if you want, 
> in loadView perhaps. However, I've never quite figured out all the places 
> where I'd need to manually remove it again. (If you're not swapping views, 
> then maybe you don't need to worry about that -- just leave it there until 
> the responder chain gets pruned in the normal course of events.)
> 
> Otherwise, you have to move the validation code to the window controller (or 
> whatever object can receive the validation request), *and* put a duplicate 
> 'delete:' action method in the window controller, *and* have it call the view 
> controller's 'delete:' method.
> 
> Another alternative might be to implement 'delete:' in the view itself (if 
> you can use/are using a custom view subclass), and delegate both the 
> validation and the invocation to the view controller.
> 
> Sorry, I don't know of a cleaner way. Maybe someone else will jump in with an 
> improved solution.


So, I solved it as follows. I created a deleteObjects IBAction in my 
AppController class invoked by the delete menuItem. To remove the objects, I am 
more or less following the code in Hillegass' book, chapter 15 on NSAlerts.   
In this example, the line

[employeeController remove: nil] is used to remove the selected objects 
(employees)

However in my app it didn't remove anything (the code was called, though).  
After some searching, I ended up doing the following:

for (Employee *employee in employeeArrayController.selectedObjects)
{
[[self managedObjectContext] deleteObject: employee];
}


It seems to work, but just to be sure I am checking here to see if this is 
indeed the correct approach?


Thanks,

- Koen.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: activating Delete menu item through binding

2012-04-24 Thread Quincey Morris
On Apr 21, 2012, at 19:18 , Koen van der Drift wrote:

> So, I solved it as follows. I created a deleteObjects IBAction in my 
> AppController class invoked by the delete menuItem. To remove the objects, I 
> am more or less following the code in Hillegass' book, chapter 15 on 
> NSAlerts.   In this example, the line
> 
> [employeeController remove: nil] is used to remove the selected objects 
> (employees)
> 
> However in my app it didn't remove anything (the code was called, though).  
> After some searching, I ended up doing the following:
> 
>for (Employee *employee in employeeArrayController.selectedObjects)
>{
>[[self managedObjectContext] deleteObject: employee];
>}
> 
> 
> It seems to work, but just to be sure I am checking here to see if this is 
> indeed the correct approach?

It's *a* correct approach.

It's not clear what went wrong with '[employeeController remove: nil]', but 
that's a completely separate problem. For example, if you left the array 
controller in Class mode rather than Entity mode, 'remove:' won't update Core 
Data properly. Also, take a look at the class reference documentation for 
NSArrayController (for the 'removeObject:' method) for a discussion of how to 
configure the array controller's deletion behavior for Core Data.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Guidelines on using NSJSONSerialization

2012-04-24 Thread Uli Kusterer
On 19.04.2012, at 19:39, Fritz Anderson wrote:
> This confuses me. MKMapView.annotations is an NSArray. How can an NSArray be 
> nil-terminated? It has a count and there's no way to index into it that would 
> return anything but an object. There's no need and no way to terminate it.
> 
> (...) If, however, jAnnotations is an NSArray, the method should be able to 
> detect that its contents are not of the supported type. The method shouldn't 
> crash.

It could be a CFArrayRef. CFArrayRef can handle *any* kind of pointer for its 
values, if you give it the right callbacks, and it's toll-free-bridged to 
NSArray. Of course, if you try to get an object out of it and it actually 
contains something else (like a struct pointer), it'll still crash.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSDate value set in one method, vanishes when accessed from another

2012-04-24 Thread Uli Kusterer
On 19.04.2012, at 19:43, The Rhythmic wrote:
> Am sorry to ask such a trivial question. Am a newbie to Objective-C, &
> simply cannot see how to get this working, after having tried several
> possible ways & google'd around for it. Please help!
> My question is simple. I have a class-level NSDate object, which is
> declared outside any method in the class as:
> 
> *NSDate *fromDate;*

 There are no "class-level objects" in Objective C. There are only global 
variables (even if they are declared between @implementation and @end of a 
class), and instance variables (declared using @property and @synthesize, or 
declared between the curly brackets of the class. So if you google for "global 
variable", or "instance variable" you might find better information.

 But reading on, I think your main confusion is memory management. I presume 
you have not turned on ARC or the garbage collector, right?

> Now, within a method, am setting this value to the date from a DatePicker
> as:
> 
> *fromDate = [datePicker date];*

 "date" does not contain "retain", "copy", "new" or "alloc", so it gives you an 
object you do not own. Usually an autoreleased object, which stays around until 
your method returns or thereabouts, but maybe it's just owned by this date 
picker. fromDate contains the address (think "building number" of one building 
in a street) of that particular date. Now when your date picker gets destroyed 
(e.g. you close its window) or when its value changes, the date picker releases 
the old date (and creates a new one in the case of the change).

 (Going with a house metaphor, this means it tears down the house whose house 
number you remembered, and forgets its house number, then goes to build another 
house containing the new date)

 Now, the problem is, your fromDate variable still contains the address of the 
old, destroyed date. So when you later use it in another method, you end up not 
at a date object, but in a random memory location (an empty building site, if 
you want).

> Soon after the above assignment, I print its value into the log & it works
> fine.
> 
> *NSLog(@"From Date: %@", fromDate);*
> 
> Now, when I use NSDate's value in another/different method, the value's
> gone! Why is it not persisted across methods in the same class itself? What
> can I do for the value to be accessible across methods?

 Learn about memory management in Objective C, from this article:

https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.masters-of-the-void.com




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSDate value set in one method, vanishes when accessed from another

2012-04-24 Thread Uli Kusterer
On 19.04.2012, at 20:02, Alex Zavatone wrote:
> Make it a property so that it doesn't go away, but exists for the whole class.
> 
> Check out how to define a property.  There are lots of examples around.


 That's wrong. There are no properties on classes. There are only properties on 
instances of classes.

 It helps to think of a class as a blueprint. When you create a new object of 
that class (called an "instance" by geeks), you actually build, say, a radio 
according to those blueprints. When you destroy the radio because you no longer 
need it (OK, this is where the analogy becomes more violent and wasteful than I 
intended), the blueprint still exists, and you can create a new instance 
according to these plans, or several at the same time.

 Now, the blueprint (i.e. the @interface ... @end and @implementation ... @end 
in your source code) say that a radio has a "current frequency" property, a 
"volume" property, maybe even a "date" property if it has a built-in clock. But 
that *does not* mean that the *class* has a current frequency, volume or 
date/time.

 When you create a new radio from the blueprints, it will have those things. 
When you set the clock on your radio in San Francisco, it will not change the 
date on my radio in Munich. Each object/instance/radio gets its own property.

 OTOH, when you create a global variable like your fromDate, there is only one 
for your entire program. If you change the clock in San Francisco to be 
correct, it will suddenly be wrong for me in Munich.

 Now that's not necessarily wrong, if you intended to build a radio with a "San 
Francisco Local Time" clock, mind you. It just depends on what you are actually 
trying to do ... ?

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: activating Delete menu item through binding

2012-04-24 Thread Koen van der Drift

On Apr 21, 2012, at 11:01 PM, Quincey Morris wrote:

> It's not clear what went wrong with '[employeeController remove: nil]', but 
> that's a completely separate problem. For example, if you left the array 
> controller in Class mode rather than Entity mode, 'remove:' won't update Core 
> Data properly.

It is set to Entity mode


> Also, take a look at the class reference documentation for NSArrayController 
> (for the 'removeObject:' method) for a discussion of how to configure the 
> array controller's deletion behavior for Core Data.

Yes I did read that, but the suggestion there to enable "Deletes Objects On 
Remove" also didn't work. I suspect what is happening is that I also maintain 
an NSTreeController to control the source list on the left side, and that is 
the controller that is bound to the MOC. The content set of myArrayController 
is bound to myTreeController.

In any event, removing the objects from the MOC directly works seamlessly, it 
also updates the source list, etc.

- Koen.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Guidelines on using NSJSONSerialization

2012-04-24 Thread Fritz Anderson
On 22 Apr 2012, at 6:51 AM, Uli Kusterer wrote:

> It could be a CFArrayRef. CFArrayRef can handle *any* kind of pointer for its 
> values, if you give it the right callbacks, and it's toll-free-bridged to 
> NSArray. Of course, if you try to get an object out of it and it actually 
> contains something else (like a struct pointer), it'll still crash.

It could be a CFArrayRef with non-Foundation elements, but in the context of 
NSJSONSerialization, it had better not be.

— F


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Mail server test

2012-04-24 Thread tridiak
Mail server test
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Guidelines on using NSJSONSerialization

2012-04-24 Thread Alex Zavatone
What's odd is that I check the annotation array for nil termination earlier on 
and to alert me.  

No alerts.

But I do a check when rebuilding the array to ignore nil results and that 
exports fine.  

I'm still thinking that nil termination is creeping in there but all I have 
inside are locations with the coordinates as a struct of doubles, the address 
and the sub address as NSStrings.

Yeah, so from what you said, there's the CLlocation object in every annotation 
object that contains the struct of doubles.

I knew I should have handcoded the export to JSON.  Hours wasted.  So many 
hours.

On Apr 22, 2012, at 11:58 AM, Fritz Anderson wrote:

> On 22 Apr 2012, at 6:51 AM, Uli Kusterer wrote:
> 
>> It could be a CFArrayRef. CFArrayRef can handle *any* kind of pointer for 
>> its values, if you give it the right callbacks, and it's toll-free-bridged 
>> to NSArray. Of course, if you try to get an object out of it and it actually 
>> contains something else (like a struct pointer), it'll still crash.
> 
> It could be a CFArrayRef with non-Foundation elements, but in the context of 
> NSJSONSerialization, it had better not be.
> 
>   — F
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Problem with capturing view contents

2012-04-24 Thread Gideon King
Hi, I have a view I am trying to capture using the following code:

NSBitmapImageRep *rep = [view bitmapImageRepForCachingDisplayInRect:[view 
bounds]];
[view cacheDisplayInRect:[view bounds] toBitmapImageRep:rep];

My view coordinates in a typical test case are as follows:

"01_frame" = "{{0, 0}, {350, 190}}";
"02_bounds" = "{{-98, -95}, {350, 190}}";

The image rep created is the right size, but the contents are drawn up and to 
the right in the image rep (by 98,95 pixels).

If I instead use the frame, the contents are in the right place in the image 
rep, but it only includes the portions of the image with positive x and y 
values (bottom right seeing as it's a flipped view).

If I create an image that is bigger by the amount of the negative origins of 
the bounds, the entire thing is drawn, but then I would need to crop the image 
afterwards, which would be very messy and memory hungry since my views can get 
pretty big.

I tried applying an affine transform before grabbing it, but that made no 
difference.

So is it possible to capture views where the bounds go into the negatives, and 
if so, how?

 
TIA

Gideon
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSPopover ~ resize to match content?

2012-04-24 Thread Erik Stainsby

I'm trying to make a popover view resize to fit the content-of-the-moment.  
This is probably trivial and I have being over thinking myself into 
complications.

I have three classes of information to display in turn in a popover. The user 
clicks a segment control to advance and may return if she wishes.  My window 
xib contains the popover view and three differently sized 'client' views which 
are swapped in as needed. Great, works like a charm.

However I cannot for the life of me cause the popover 'host' view to resize. 
When I dump the dimensions to NSLog the outer view frame reports the correct 
(resized as I specified) dims. but the popover has not been resized. The 
numbers do not match the picture.

What am I missing?  Some code:



- (void) showPanel:(NSView*)panel {
// guard
if(!panel) panel = actionPanel; 

[self setActivePanelWidth: panel.frame.size.width];
[self setActivePanelHeight: panel.frame.size.height];

NSLog(@"%s- [%04d] %@: %0.2f", __PRETTY_FUNCTION__, __LINE__, [panel 
className], panel.frame.size.height);

NSRect newFrameSize = self.view.frame;
newFrameSize.size.height = popoverHeader.frame.size.height + 
activePanelHeight;

NSLog(@"%s- [%04d] %@: %0.2f", __PRETTY_FUNCTION__, __LINE__, 
[self.view className], self.view.frame.size.height);

[[self view] setFrame:newFrameSize];
if( currentPanel == nil) 
{
[[self view] replaceSubview:[self placeholderBox] with: panel];
}
else {

[[self view] replaceSubview:currentPanel with: panel];
}
// a custom category on NSView
[panel setFrameTopLeftPoint: popoverHeader.frame.origin];

currentPanel = panel;
[locator setCurrentPanel: panel];

[popover showRelativeToRect:[locator bounds] ofView:locator 
preferredEdge:NSMaxXEdge];
}



Any help appreciated. Thanks.


Erik Stainsby
erik.stain...@roaringsky.ca
-





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSComboBox

2012-04-24 Thread koko
I have been spelunking all afternoon with mixed results.  Some say I can put an 
image and text in an NSComboBoxCell.

Can this be done … put an image and text in an NSComboBoxCell?

I can find no examples and would appreciate one if possible.

-koko


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: addsubview

2012-04-24 Thread Peter Ammon
Hi koko,

This could be anything from "the view is added to the wrong subview" to "the 
view has a frame that moves it outside of its' parents bounds" to "the view is 
visible but does not draw anything."

Two powerful tools that will help you with debugging:

- Run with NSShowAllViews set to YES
- Use the _subtreeDescription method to get a list of all your views and where 
they are.

A web search will show you how to do either of those if you're not sure.

Hope that helps.


On Apr 20, 2012, at 9:49 AM, koko  wrote:

> I have searched high and low and can find no reason for a subview to not 
> display.  Is this a trivial problem not worthy of list comment or is it truly 
> a difficult problem that cannot be dealt with as easily as more mundane 
> topics found here?
> 
> Can you hear my cry for help ... this makes no sense ... 
> 
> Oh well, I guess I'll have to rewind and try another approach.  
> 
> Ah, ain't Cocoa a great, modern (85?) environment.
> 
> -koko
> 
> 
> 
> 
> 
> 
> 
> On Apr 20, 2012, at 9:23 AM, koko wrote:
> 
>> Here is the code that creates and adds the subview The method 
>> -makeAndWrapViews is in the custom class of the NSTabViewItem view.
>> 
>> I do get -viewDidMoveToSuperview when addSubview is called.
>> 
>> When the tab is clicked I do get viewdidMoveToWindow
>> 
>> But I never see thev iew!
>> 
>> - (void)makeAndWrapViews
>> {
>>   NSRect frame = [self frame];
>>   frame.size.width = 288;
>>   frame.size.height = 259;
>> 
>>   m_text = [[NSPDText alloc] initWithFrame:frame];
>> 
>> BOOL text = [NSBundle loadNibNamed:@"NSPDText" owner:m_text];
>> 
>> if (text) 
>>   {
>>   [self addSubview:m_text];
>>   }
>> }
>> 
>> 
>> 
>> 
>> 
>> On Apr 20, 2012, at 7:56 AM, koko wrote:
>> 
>>> Good questions.
>>> 
>>> As an experiment, in the same method in which I create and add the subview 
>>> which is not displaying I create an NSButton using the same frame as for 
>>> the subview.  I add the NSButton and it displays.
>>> 
>>> So, I am sure the NSTabviewItem view is correct.
>>> 
>>> As to the subview, I added a delegate method for when the tab is clicked.  
>>> Breaking there and dumping the subviews I see my subview in the view 
>>> hierarchy.
>>> 
>>> This seems such a trivial task that I am quite puzzled.
>>> 
>>> -koko
>>> 
>>> 
>>> On Apr 19, 2012, at 9:27 PM, Keary Suska wrote:
>>> 
 On Apr 19, 2012, at 5:34 PM, koko wrote:
 
> I get the view for an NSTabViewItem.
> 
> To this view I add a subview.
 
 How do you (in code) identify the correct NSTabViewItem, retrieve the view 
 and add the subview? What is the frame of the subview?
 
> In the debugger displaying the subviews of view I see the subview.
 
 How do you know it is the correct/same subview?
 
> When  the NSTabViewItem displays  the subview is not being shown.  The 
> view does display.
> 
> The subview is not set hidden in IB.
> 
> Why would I not see the subview?
 
 
 
 Keary Suska
 Esoteritech, Inc.
 "Demystifying technology for your home or business"
 
 
>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> 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:
>>> https://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net
>>> 
>>> This email sent to k...@highrolls.net
>>> 
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net
>> 
>> This email sent to k...@highrolls.net
>> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/pammon%40apple.com
> 
> This email sent to pam...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: addsubview

2012-04-24 Thread koko
Hi Peter … thanks for the debugging tips …  

I changed my approach, using instead of a view instanced in code a view from IB 
hooked up via outlet.  Same view and it works just fine. 

-koko


On Apr 23, 2012, at 7:30 PM, Peter Ammon wrote:

> Hi koko,
> 
> This could be anything from "the view is added to the wrong subview" to "the 
> view has a frame that moves it outside of its' parents bounds" to "the view 
> is visible but does not draw anything."
> 
> Two powerful tools that will help you with debugging:
> 
> - Run with NSShowAllViews set to YES
> - Use the _subtreeDescription method to get a list of all your views and 
> where they are.
> 
> A web search will show you how to do either of those if you're not sure.
> 
> Hope that helps.
> 
> 
> On Apr 20, 2012, at 9:49 AM, koko  wrote:
> 
>> I have searched high and low and can find no reason for a subview to not 
>> display.  Is this a trivial problem not worthy of list comment or is it 
>> truly a difficult problem that cannot be dealt with as easily as more 
>> mundane topics found here?
>> 
>> Can you hear my cry for help ... this makes no sense ... 
>> 
>> Oh well, I guess I'll have to rewind and try another approach.  
>> 
>> Ah, ain't Cocoa a great, modern (85?) environment.
>> 
>> -koko
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> On Apr 20, 2012, at 9:23 AM, koko wrote:
>> 
>>> Here is the code that creates and adds the subview The method 
>>> -makeAndWrapViews is in the custom class of the NSTabViewItem view.
>>> 
>>> I do get -viewDidMoveToSuperview when addSubview is called.
>>> 
>>> When the tab is clicked I do get viewdidMoveToWindow
>>> 
>>> But I never see thev iew!
>>> 
>>> - (void)makeAndWrapViews
>>> {
>>>  NSRect frame = [self frame];
>>>  frame.size.width = 288;
>>>  frame.size.height = 259;
>>> 
>>>  m_text = [[NSPDText alloc] initWithFrame:frame];
>>> 
>>> BOOL text = [NSBundle loadNibNamed:@"NSPDText" owner:m_text];
>>> 
>>>if (text) 
>>>  {
>>>  [self addSubview:m_text];
>>>  }
>>> }
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On Apr 20, 2012, at 7:56 AM, koko wrote:
>>> 
 Good questions.
 
 As an experiment, in the same method in which I create and add the subview 
 which is not displaying I create an NSButton using the same frame as for 
 the subview.  I add the NSButton and it displays.
 
 So, I am sure the NSTabviewItem view is correct.
 
 As to the subview, I added a delegate method for when the tab is clicked.  
 Breaking there and dumping the subviews I see my subview in the view 
 hierarchy.
 
 This seems such a trivial task that I am quite puzzled.
 
 -koko
 
 
 On Apr 19, 2012, at 9:27 PM, Keary Suska wrote:
 
> On Apr 19, 2012, at 5:34 PM, koko wrote:
> 
>> I get the view for an NSTabViewItem.
>> 
>> To this view I add a subview.
> 
> How do you (in code) identify the correct NSTabViewItem, retrieve the 
> view and add the subview? What is the frame of the subview?
> 
>> In the debugger displaying the subviews of view I see the subview.
> 
> How do you know it is the correct/same subview?
> 
>> When  the NSTabViewItem displays  the subview is not being shown.  The 
>> view does display.
>> 
>> The subview is not set hidden in IB.
>> 
>> Why would I not see the subview?
> 
> 
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 
> 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net
 
 This email sent to k...@highrolls.net
 
>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> 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:
>>> https://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net
>>> 
>>> This email sent to k...@highrolls.net
>>> 
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/pammon%40apple.com
>> 
>> This email sent to pam...@apple.com
> 
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Conta

Re: Updating NSMenu while it's open

2012-04-24 Thread vinayak pai
posting an application-defined event (NSEvent of type
NSApplicationDefined) to the event queue doesn't solve the menu
refreshing issue.

On Sat, Apr 21, 2012 at 3:44 PM, Ken Thomases  wrote:
> On Apr 20, 2012, at 1:32 PM, vinayak pai wrote:
>
>> Yes. I am facing the same problem. I am updating the menu in
>> performSelectorOnMainThread. If the menu is kept open without any
>> event then there is menu refreshing issue ie. sometimes some items
>> will be shown twice. When I move the mouse over items then it will
>> update. But, when the menu is open and mouse is still then  the menu
>> won't update. Is there a way to update the menu while it's open
>> without any mouse movement like System WiFi menu?
>
> I'm not sure.  If menus are shown twice, then I suspect a synchronization bug 
> in your code.
>
> You can try posting an application-defined event (NSEvent of type 
> NSApplicationDefined) to the event queue after you've changed the menus.
>
> Regards,
> Ken
>

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Losing attachments when saving rtfd

2012-04-24 Thread Matthew Weinstein
Dear programmers,

Trying to save an RTFD from an NSAttributedString with attachements. The text 
saves; the images don't...

I've been scouring the web but can't seem to figure out what's wrong.

I have a NSAttributedString with attachments. I check that the string really 
has the attachments by using setAttributedString to the textstorage of a 
NSTextView, and voila, there it is.

But I can't seem to save the attachment. This is what I'm trying:

//this is a category I found on the interwebs
myimagets = [[NSTextAttachment alloc] initWithAnImage: myimage];
//get doc string
//replace with the attributed string

myattstr =  [NSMutableAttributedString attributedStringWithAttachment: 
myimagets];

//stick on a little text at the end to see how it handles both...
addon = [[NSMutableAttributedString alloc] initWithString: @"and here's 
the extra bit"];
[myattstr appendAttributedString: addon];

//this is my test to see if the attachment is really there: it works!
[[myTextView textStorage] setAttributedString: myattstr];


//here's what fails:
myfw = [myattstr RTFDFileWrapperFromRange: NSMakeRange(0, [myattstr 
length])
   documentAttributes:nil];
[myfw writeToFile: [@"~/Desktop/outfile.rtfd" 
stringByExpandingTildeInPath]
   atomically:YES updateFilenames:YES];
What's created is an rtfd with only the rtf file in it and no images 

Thoughts? Help?

--Matthew Weinstein
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Updating NSMenu while it's open

2012-04-24 Thread Dave DeLong
Yes.  As I answered before, you have to get things scheduled in the right 
runloop mode.  But once you do, it's quite easy:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSStatusItem *item = [[[NSStatusBar systemStatusBar] 
statusItemWithLength:24] retain];
[item setImage:[NSImage imageNamed:NSImageNameApplicationIcon]];
[item setEnabled:YES];

NSMenu *m = [[NSMenu alloc] init];
[item setMenu:m];

NSTimer *t = [NSTimer timerWithTimeInterval:1.0 target:self 
selector:@selector(updateMenu:) userInfo:m repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:t forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:t forMode:NSEventTrackingRunLoopMode];
}

- (void)updateMenu:(NSTimer *)t {
NSMenu *m = [t userInfo];

NSString *s = [[NSDate date] description];
NSMenuItem *i = [[NSMenuItem alloc] initWithTitle:s action:nil 
keyEquivalent:@""];
[m addItem:i];
[m update];
}

Run that, open the poorly-iconed status item, and don't touch your mouse.

Yes, this code is terrible and leaks and all that.  It's just to illustrate the 
point.

Dave

On Apr 20, 2012, at 11:32 AM, vinayak pai wrote:

> Yes. I am facing the same problem. I am updating the menu in
> performSelectorOnMainThread. If the menu is kept open without any
> event then there is menu refreshing issue ie. sometimes some items
> will be shown twice. When I move the mouse over items then it will
> update. But, when the menu is open and mouse is still then  the menu
> won't update. Is there a way to update the menu while it's open
> without any mouse movement like System WiFi menu?
> 
> Best regards,
> VinPai
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to set the foreground and background colors of selected text in a field editor (NSTextView)?

2012-04-24 Thread Michael Crawford
Thanks for the suggestion, Kyle.  I subclassed NSTextViewCell and implemented 
-setUpFieldEditorAttributes.  My apologies to anyone who initially followed 
this thread and has had to wait till now for a solution/outcome.  This became a 
low-priority issue almost as soon as I posted it and I only got back to it two 
days ago.

-Michael

On Apr 10, 2012, at 3:09 PM, Kyle Sluder wrote:

> On Apr 10, 2012, at 11:29 AM, Stephane Sudre wrote:
> 
>> Allowing rich text, subclassing NSTextField and add some methods from
>> NSTextView did not work so far.
> 
> Subclassing NSTextField and implemented -setUpFieldEditor didn't do the trick?
> 
> --Kyle Sluder

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Updating NSMenu while it's open

2012-04-24 Thread Fritz Anderson
On 20 Apr 2012, at 1:32 PM, vinayak pai wrote:

> Is there a way to update the menu while it's open
> without any mouse movement like System WiFi menu?

Others may have some magic for you (the list has only just come unstuck, and 
hasn't gotten beyond Friday as I write this), but you should be prepared for 
the possibility that like many Apple status items, what looks like a menu may 
be a custom view that imitates a menu.

— F


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Updating NSMenu while it's open

2012-04-24 Thread Dave DeLong

On Apr 21, 2012, at 3:14 AM, Ken Thomases wrote:

> On Apr 20, 2012, at 1:32 PM, vinayak pai wrote:
> 
>> Yes. I am facing the same problem. I am updating the menu in
>> performSelectorOnMainThread. If the menu is kept open without any
>> event then there is menu refreshing issue ie. sometimes some items
>> will be shown twice. When I move the mouse over items then it will
>> update. But, when the menu is open and mouse is still then  the menu
>> won't update. Is there a way to update the menu while it's open
>> without any mouse movement like System WiFi menu?
> 
> I'm not sure.  If menus are shown twice, then I suspect a synchronization bug 
> in your code.
> 
> You can try posting an application-defined event (NSEvent of type 
> NSApplicationDefined) to the event queue after you've changed the menus.

(Resending this, since it didn't appear to go through before)

Yes.  As I answered before, you have to get things scheduled in the right 
runloop mode.  But once you do, it's quite easy:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSStatusItem *item = [[[NSStatusBar systemStatusBar] 
statusItemWithLength:24] retain];
[item setImage:[NSImage imageNamed:NSImageNameApplicationIcon]];
[item setEnabled:YES];

NSMenu *m = [[NSMenu alloc] init];
[item setMenu:m];

NSTimer *t = [NSTimer timerWithTimeInterval:1.0 target:self 
selector:@selector(updateMenu:) userInfo:m repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:t forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:t forMode:NSEventTrackingRunLoopMode];
}

- (void)updateMenu:(NSTimer *)t {
NSMenu *m = [t userInfo];

NSString *s = [[NSDate date] description];
NSMenuItem *i = [[NSMenuItem alloc] initWithTitle:s action:nil 
keyEquivalent:@""];
[m addItem:i];
[m update];
}

Run that, open the poorly-iconed status item, and don't touch your mouse.

Yes, this code is terrible and leaks and all that.  It's just to illustrate the 
point.

Dave
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: addsubview

2012-04-24 Thread Graham Cox

On 21/04/2012, at 2:49 AM, koko wrote:

> Ah, ain't Cocoa a great, modern (85?) environment.


Don't blame the framework for your own incompetence.

> But I never see thev iew!
> 
> - (void)makeAndWrapViews
> {
>NSRect frame = [self frame];
>frame.size.width = 288;
>frame.size.height = 259;
> 
>m_text = [[NSPDText alloc] initWithFrame:frame];
> 
>  BOOL text = [NSBundle loadNibNamed:@"NSPDText" owner:m_text];
> 
>  if (text) 
>{
>[self addSubview:m_text];
>}
> }


The code you posted is pretty bizarre. It might work, but there's certainly not 
enough to go on for others to help you.

What is NSPDText? Is that a class of your own (if so, it should NOT be prefixed 
'NS', that's Apple's reserved prefix. If it's supposed to be a Cocoa class, I 
have never heard of it). Using a view as 'Files Owner' for a NIB is very 
unusual and unconventional. It might work, but then again, it might not - it's 
not standard practice, so there won't be a large body of code to compare it 
with.

Have you tried simply instantiating NSPDText in a window and seeing whether it 
in fact does draw anything? Perhaps the reason nothing appears is because that 
class is broken.

What is the reason for not simply adding your view to the tab view in IB? 
Again, that's what I and probably most Cocoa programmers would do.

The problem you seem to have (not just here, but in most of the cries for help 
you post) is that you don't take the time or trouble to learn how things are 
typically done, but half-understand it and then write a screed of code based on 
that improperly understood concept. You also then ignore advice to go back and 
do it properly and persist in doing it your (incorrect) way. For example, using 
the NSBundle method above is rarely done. Instead, you conventionally use a 
higher level class such as NSVIewController or NSWindowController that loads 
the nib for you. I'm not saying it's wrong, but it is unusual, and it's 
certainly symptomatic of an approach that will lead to buggy, difficult to 
maintain code that others will have little chance of helping you with, because 
it's "out there" in uncharted territory.

There is a very strong streak of the bad workman blaming his tools here.


--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2012-04-24 Thread Erik Stainsby
The menu portion of a combo box is just that an NSMenu so you ought to be able 
to everything you can with  a regular menu item.

Erik


On 2012-04-23, at 5:53 PM, koko wrote:

> I have been spelunking all afternoon with mixed results.  Some say I can put 
> an image and text in an NSComboBoxCell.
> 
> Can this be done … put an image and text in an NSComboBoxCell?
> 
> I can find no examples and would appreciate one if possible.
> 
> -koko
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/erik.stainsby%40roaringsky.ca
> 
> This email sent to erik.stain...@roaringsky.ca


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Updating NSMenu while it's open

2012-04-24 Thread Kyle Sluder
On Apr 24, 2012, at 2:50 PM, Fritz Anderson  wrote:

> On 20 Apr 2012, at 1:32 PM, vinayak pai wrote:
> 
>> Is there a way to update the menu while it's open
>> without any mouse movement like System WiFi menu?
> 
> Others may have some magic for you (the list has only just come unstuck, and 
> hasn't gotten beyond Friday as I write this), but you should be prepared for 
> the possibility that like many Apple status items, what looks like a menu may 
> be a custom view that imitates a menu.

Except that due to the way the Menu Manager works, you can't use view-based 
menu items to perfectly imitate standard menus, so this is probably not an 
option for your app. You could reimplement the entire thing as a window, but 
that wouldn't play nice with accessibility.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2012-04-24 Thread koko
I changed to NSPopUpButton and use:

[self addItemWithTitle:@"Title"];
[[self lastItem] setImage:image];

Easy, works great.

Are you saying I could have made these calls on an instance of NSComboBox?

I do not see addItem, lastItem or setImage in NSComboBox.

How would I use 'the menu portion' of NSComboBox?


-koko


On Apr 24, 2012, at 7:35 PM, Erik Stainsby wrote:

> The menu portion of a combo box is just that an NSMenu so you ought to be 
> able to everything you can with  a regular menu item.
> 
> Erik
> 
> 
> On 2012-04-23, at 5:53 PM, koko wrote:
> 
>> I have been spelunking all afternoon with mixed results.  Some say I can put 
>> an image and text in an NSComboBoxCell.
>> 
>> Can this be done … put an image and text in an NSComboBoxCell?
>> 
>> I can find no examples and would appreciate one if possible.
>> 
>> -koko
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/erik.stainsby%40roaringsky.ca
>> 
>> This email sent to erik.stain...@roaringsky.ca
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net
> 
> This email sent to k...@highrolls.net

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com