Re: Editing the HUD window text edit question
Re: Editing the HUD window text edit question
- Subject: Re: Editing the HUD window text edit question
- From: CoLo0LoGo <email@hidden>
- Date: Sun, 23 Jul 2006 16:41:10 -0400
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@hidden> 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@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden