multiple-page print support in NSView

2010-04-06 Thread Rua Haszard Morris
I am trying to write an NSView subclass to render a multi-page printout. What I would like is to use the page/paper size in calculating the dimensions of each page; for example, if the printout is made up of N rows of items, each item rendering as 60-point-tall row. So, assuming 10 rows of item

Re: multiple-page print support in NSView

2010-04-07 Thread Rua Haszard Morris
>> I am trying to write an NSView subclass to render a multi-page printout. >> What I would like is to use the page/paper size in calculating the >> dimensions of each page; for example, if the printout is made up of N rows >> of items, each item rendering as 60-point-tall row. >> >> So, assumi

get the selection in an NSOutlineView

2010-06-08 Thread Rua Haszard Morris
s are expanded, so that won't do. I could attempt to keep track of the selection via delegate method outlineView:shouldSelectItem: but this seems a bad idea. Am I missing something? Surely it is possible to ask an NSOutlineView which items are selected? thanks Rua Hasz

Re: get the selection in an NSOutlineView

2010-06-09 Thread Rua Haszard Morris
Thanks all, itemForRow was the missing piece of the puzzle. Now this thing makes sense.. >> At the time you call -selectedRowIndexes, you should then extract the items >> corresponding to those indexes from your data model (e.g. using [NSArray >> objectsAtIndexes:]) before the user has a chance

how do I get tracking, selection etc working with custom views in NSMenuItems?

2010-08-29 Thread Rua Haszard Morris
Hi Cocoa-dev, I'm experimenting with using NSViews in menus, and was expecting that such items could continue to use Cocoa-provided implementations of mouse tracking, selecting an item and dismissing the menu, etc. After a lot of experimentation, doc reading and googling I've managed to hook u

how to add a custom view (a pair of controls) to an NSToolbar in Interface Builder

2010-11-21 Thread Rua Haszard Morris
I would like to add an item to my window's toolbar that is a custom view containing other standard views. For example a popup button and a static text field. If possible I would like to do this in interface builder, without implementing NSToolbarDelegate. So to clarify.. I have a window with a

Re: how to add a custom view (a pair of controls) to an NSToolbar in Interface Builder

2010-11-22 Thread Rua Haszard Morris
18/11/2010, at 12:44 PM, Rua Haszard Morris wrote: > I would like to add an item to my window's toolbar that is a custom view > containing other standard views. For example a popup button and a static text > field. If possible I would like to do this in interface builder, without

Re: how to add a custom view (a pair of controls) to an NSToolbar in Interface Builder

2010-11-22 Thread Rua Haszard Morris
/2010, at 1:55 PM, Graham Cox wrote: > > On 23/11/2010, at 10:02 AM, Rua Haszard Morris wrote: > >> Is this not possible? > > > Yes, it's possible. But your question is too open-ended. What have you tried, > what doesn'

Re: how to add a custom view (a pair of controls) to an NSToolbar in Interface Builder

2010-11-29 Thread Rua Haszard Morris
no, >> the buttons disappear >> - simulate the interface - oh no, still no buttons! >> >> Perhaps my first email was not concise enough... >> >> thanks for the help >> Rua HM. >> >> On 23/11/2010, at 1:55 PM, Graham Cox wrote: >&g

setting target and action for a NSSlider programmatically in a class that is not "file's owner" - how?

2008-05-15 Thread Rua Haszard Morris
I'm trying to set the action for an NSSlider in a little helper class that is not the "file's owner" class associated with the window in the nib. At runtime, I get these console messages: *** +[SliderHelper myAction:]: unrecognized selector sent to class 0xeb74380 HIToolbox: ignoring except

Re: setting target and action for a NSSlider programmatically in a class that is not "file's owner" - how?

2008-05-15 Thread Rua Haszard Morris
2008, at 2:38 PM, Sherm Pendley wrote: On Thu, May 15, 2008 at 10:12 PM, Rua Haszard Morris <[EMAIL PROTECTED] > wrote: I'm trying to set the action for an NSSlider in a little helper class that is not the "file's owner" class associated with the window in the nib. At r

Re: Cocoa et al as HCI usability problem

2008-05-19 Thread Rua Haszard Morris
With you 100% on all this below. Been having trouble coming up with something useful to add to all these discussions about Cocoa & Apple Developer Documentation .. what you said below sums a lot of it up. These points really resonate for me: ++ "explaining why _their_ API and paradigm is s

Re: Cocoa et al as HCI usability problem

2008-05-21 Thread Rua Haszard Morris
I don't believe Peter Duniho's barking up the wrong tree - he sees room for improvement, and wants to discuss what to do to make it happen. I.e. he appears to care about making the platform better (probably something we all share)... These are the main valid issues from my point of view: 1

Re: Cocoa et al as HCI usability problem

2008-05-21 Thread Rua Haszard Morris
2 Cocoa requires you when learning to implement things by clicking and dragging, which makes learning harder for some people (this is a real annoyance to me, why can we not see/edit these connections in a text file? why is there so much other crap in the nib xml? etc). The fact that you hav

how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?

2008-07-20 Thread Rua Haszard Morris
I am using NSSuperscriptAttributeName to make part of a string displayed in an NSTextView label display as superscript (to show "to the power of 2"). I may also use a smaller font attribute to make the "2" char smaller. My problem is that thebaseline of the text drawn in the NSTextView is

NSBaselineOffsetAttributeName support in NSTextField - bug? Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?

2008-07-21 Thread Rua Haszard Morris
ne shed any light on why this is happening? thanks Rua HM. On Jul 21, 2008, at 4:27 PM, Rua Haszard Morris wrote: I am using NSSuperscriptAttributeName to make part of a string displayed in an NSTextView label display as superscript (to show "to the power of 2"). I may also use a

Re: how to prevent baseline shift when using NSSuperscriptAttributeName on a NSTextView's NSAttributedString ?

2008-07-22 Thread Rua Haszard Morris
I need to support arbitrary superscript, not just squared... I should be clear: - I initially only set superscript attribute for the characters that are superscript, i.e. part of a larger string. - When this attributed string was given to an NSTextField (static non editable), the textfield

how to correctly set knob/thumb proportion and scroller orientation in NSScroller

2008-07-23 Thread Rua Haszard Morris
I'm implementing a scrollable pane and have come across to slightly weird issues with NSScroller, leading to me wondering whether I'm going about this the wrong way... 1. The thumb proportion can only be set by setFloatValue:knobProportion: method which is deprecated in 10.5. Is there an

Re: how to correctly set knob/thumb proportion and scroller orientation in NSScroller

2008-07-24 Thread Rua Haszard Morris
NSScrollView? It's much easier than trying to fiddle about with scrollbars yourself. Graham On 24 Jul 2008, at 2:15 pm, Rua Haszard Morris wrote: I'm implementing a scrollable pane and have come across to slightly weird issues with NSScroller, leading to me wondering whether

guidelines/tutorial for implementing custom controls

2008-08-04 Thread Rua Haszard Morris
Can anybody point me to some good tutorials/guides for implementing custom controls? I've been reading the Cocoa Event Handling Guide, The reference and accompanying conceptual guides for NSControl, NSCell, NSActionCell and NSView, but I'm more confused than when I started. If anyone coul

Re: guidelines/tutorial for implementing custom controls

2008-08-04 Thread Rua Haszard Morris
Can anybody point me to some good tutorials/guides for implementing custom controls? Do you have some objection to the examples at developer.apple.com ? http://developer.apple.com/samplecode/Clock_Control/index.html http://developer.apple.com/samplecode/TrackBall/ http://developer.apple.com/samp

how to have a pop up menu from an ordinary button?

2008-08-07 Thread Rua Haszard Morris
I am trying to implement a mini-size, square bevel button that pops up a menu, i.e. a popup button with a square appearance and mini size, but have not found a way to achieve this. NSPopupButton does not support square button appearance, and doesn't support setControlSize: (though it can of

Re: how to have a pop up menu from an ordinary button?

2008-08-07 Thread Rua Haszard Morris
On Aug 7, 2008, at 2:53 PM, Rua Haszard Morris wrote: I am trying to implement a mini-size, square bevel button that pops up a menu, i.e. a popup button with a square appearance and mini size, but have not found a way to achieve this. NSPopupButton does not support square button appearance

handling errors from NSNumberFormatter - how to determine exact nature of the error?

2008-08-10 Thread Rua Haszard Morris
I'm using a NSNumberFormatters in a modal dialog to validate text fields. I want to give the user a specific and appropriate error message if they try to OK the dialog with an invalid number in a field. For example I want different error messages for "no string entered", "non numeric string

compile error when protocol not implemented?

2008-08-13 Thread Rua Haszard Morris
I'd like to get an error, not just a warning, when I pass an instance of a class to a method that takes a parameter conforming to some protocol, and the passed object does not implement the protocol. Is this possible? Is there a good way to set things up so an error is generated.. or is the

Re: compile error when protocol not implemented?

2008-08-13 Thread Rua Haszard Morris
On Wed, Aug 13, 2008 at 8:39 PM, Rua Haszard Morris <[EMAIL PROTECTED]> wrote: I'd like to get an error, not just a warning, when I pass an instance of a class to a method that takes a parameter conforming to some protocol, and the passed object does not implement the protocol. Is t

how to wrap an NSAlert so the caller can call one function and get the NSAlert return value (i.e. modal)

2008-05-12 Thread Rua Haszard Morris
Is there a way to wrap up an NSAlert, the beginSheetModalForWindow call, and the alertDidEnd implementation, such that a caller can just call one function which blocks until the alert is dismissed? i.e. something like if ([SynchronousAlert showAlertWithMessageText:@"Do you want to delete et

Re: how to wrap an NSAlert so the caller can call one function and get the NSAlert return value (i.e. modal)

2008-05-12 Thread Rua Haszard Morris
On 12 May '08, at 5:18 PM, Rua Haszard Morris wrote: Is there a way to wrap up an NSAlert, the beginSheetModalForWindow call, and the alertDidEnd implementation, such that a caller can just call one function which blocks until the alert is dismissed? No, because the application cont

NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-17 Thread Rua Haszard Morris
I have found that NSSuperscriptAttributeName, NSUnderlineStyleAttributeName, and NSObliquenessAttributeName (those are the attributes that I have tested) render differently when Cocoa Text is used to draw the string. The attributes appear to be intrepreted inverted, in that 1 for superscri

Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-18 Thread Rua Haszard Morris
On Nov 18, 2008, at 1:00 pm, 11(November)/18/08, Douglas Davidson wrote: On Nov 17, 2008, at 3:50 PM, Rua Haszard Morris wrote: I have found that NSSuperscriptAttributeName, NSUnderlineStyleAttributeName, and NSObliquenessAttributeName (those are the attributes that I have tested) render

SOLVED Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-18 Thread Rua Haszard Morris
n Nov 19, 2008, at 9:09 am, 11(November)/19/08, Douglas Davidson wrote: On Nov 18, 2008, at 11:53 AM, Rua Haszard Morris wrote: I was ensuring that I am _not_ drawing in a flipped context... (!) now, as you suggest I tried flipping the custom view (override isFlipped) that the attributed s

Re: SOLVED Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-18 Thread Rua Haszard Morris
Thanks for the link, you are right, I had not seen that document! On Nov 19, 2008, at 9:33 am, 11(November)/19/08, Douglas Davidson wrote: On Nov 18, 2008, at 12:18 PM, Rua Haszard Morris wrote: To follow up.. below I have pasted the code that draws the text (for my test app, as opposed to

Re: SOLVED Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-18 Thread Rua Haszard Morris
ed an NSView rather than draw the attributed string manually. thanks Rua HM. On Nov 19, 2008, at 9:40 am, 11(November)/19/08, Rua Haszard Morris wrote: Thanks for the link, you are right, I had not seen that document! On Nov 19, 2008, at 9:33 am, 11(November)/19/08, Douglas Davidson

Re: SOLVED Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-19 Thread Rua Haszard Morris
Even better... thanks for the tip. A much simpler approach... On Nov 19, 2008, at 12:53 pm, 11(November)/19/08, Douglas Davidson wrote: On Nov 18, 2008, at 1:57 PM, Rua Haszard Morris wrote: What are the different options for flipping the coordinates of the destination view? I've

Re: SOLVED Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-19 Thread Rua Haszard Morris
. thanks for all the informative suggestions, Rua HM. Aki On 2008/11/19, at 14:22, Ken Ferry wrote: On Tue, Nov 18, 2008 at 1:57 PM, Rua Haszard Morris <[EMAIL PROTECTED]> wrote: What are the different options for flipping the coordinates of the destination view? I've tried doing it

how to set up nextKeyView, full keyboard access etc, for custom subviews set up in code (rather than nib)

2008-11-26 Thread Rua Haszard Morris
I have a dialog that has a few controls as well as a complex custom view that itself contains other controls as subviews. The custom view (for various good reasons) is instantiated and added as a subview in code. A template view and NSView's replaceSubview:with is used so the positioning et

NSPopUpButton pullsDown:YES and dummy first item - normal?

2009-04-01 Thread Rua Haszard Morris
I am using a pull-down NSPopUpButton for a little button which displays a little menu. The menu has some commands in it, i.e. it's not a selection menu, the title of the button just displays an icon, no title, no indication of a current item from the menu. I am calling (ahem, sending) setUs

Re: NSPopUpButton pullsDown:YES and dummy first item - normal?

2009-04-02 Thread Rua Haszard Morris
ignored. I'll fill in the docs feedback form.. thanks, Rua HM. On 3/04/2009, at 9:56 AM, Michael Ash wrote: On Thu, Apr 2, 2009 at 7:58 AM, Graham Cox wrote: On 02/04/2009, at 12:55 PM, Rua Haszard Morris wrote: This seems like a weird hack, and makes me think I'm going about this

how to load an NSMenu out of a nib?

2009-04-08 Thread Rua Haszard Morris
I'm baffled, this seems fundamental, I can't see how it's done! I have a Menu in a nib file, which I need to use in a few places in code. So I want to do something like NSMenu* myMenu = [NSMenu menuFromNib:@"MyNibFile" name:@"MyUsefulMenu"]; Is this possible - how can this be done? I have l

Re: how to load an NSMenu out of a nib?

2009-04-08 Thread Rua Haszard Morris
Making a class with an outlet, and passing an instance of that class as the nib's owner, is one way. You can also use the NSNibTopLevelObjects key as described at the bottom of http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSNib_Class/Reference/Reference.html