Skip navigation.
 
mlRe: Editing the HUD window text edit question
FROM : CoLo0LoGo
DATE : Sun Jul 23 22:41:10 2006

Hmmm seems I need to re-read the book again,, drat..

On that same note, is anyone writing an updated version of the Cocoa
Programming for Mac OS X book ? this one is dated 2004, and tiger
xcode is way more advanced since then..


On 7/23/06, Drarok Ithaqua <<email_removed>> wrote:
> I think the problem here is that the HUDwindow subclass has this code
> in:
> - (BOOL)canBecomeKeyWindow
> {
>      return NO;
> }
>
> Therefore, the window cannot become Key, so you can't type in it. :)
> BTW, This is also what makes the controls appear grey, so if you want
> to to stay that way,
> you'll have to find another method.
>
> On 22 Jul 2006, at 7:31 pm, CoLo0LoGo wrote:
>
> > So I am poking in the HUD window from
> > http://mattgemmell.com/2006/03/12/hudwindow
> >
> > And I get as far as getting it to let me select text and rightclick to
> > copy and paste text to change it's contents but I can not get it to
> > just let me select the text like a normal text editing program and
> > type in normal content.
> >
> > Note how do I use the options that do not have (void)'s and have the
> > BOOL on the left of the method like so
> >      //[textField YES:allowsEditingTextAttributes];
> > Since
> > – setSelectable:
> > – isSelectable
> > look the same but only setSelectable works
> >
> > My code block
> >
> > // Create a HUDWindow.
> >    // Note: the styleMask is ignored; NSBorderlessWindowMask is
> > always used.
> >    window = [[HUDWindow alloc] initWithContentRect:windowFrame
> >
> > styleMask:NSBorderlessWindowMask
> >
> > backing:NSBackingStoreBuffered
> >                                              defer:NO];
> >
> >    // Add some text to the window.
> >    float textHeight = 300.0;
> >    NSTextField *textField = [[NSTextField alloc]
> > initWithFrame:NSMakeRect(0.0, (windowSize.height / 2.0) - (textHeight
> > / 2.0),
> >
> > windowSize.width, textHeight)];
> >    [[window contentView] addSubview:textField];
> >      [textField setAllowsEditingTextAttributes:YES];
> >      //[textField YES:allowsEditingTextAttributes];
> >      //[textField YES:isSelectable];
> >      //[textField YES:isEditable];
> >    [textField setEditable:YES];
> >      [textField setSelectable:YES];
> >    [textField setTextColor:[NSColor whiteColor]];
> >    [textField setDrawsBackground:NO];
> >    [textField setBordered:NO];
> >    [textField setAlignment:NSCenterTextAlignment];
> >    [textField setStringValue:@" icfsf Some sample text"];
> >    [textField release];
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Cocoa-dev mailing list      (<email_removed>)
> > Help/Unsubscribe/Update your Subscription:
> > http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
> >
> > This email sent to <email_removed>
>
>

Related mailsAuthorDate
mlEditing the HUD window text edit question CoLo0LoGo Jul 22, 20:31
mlRe: Editing the HUD window text edit question Uli Kusterer Jul 23, 11:18
mlRe: Editing the HUD window text edit question CoLo0LoGo Jul 23, 22:41