RE: How can I "highlight" user interface objects?
RE: How can I "highlight" user interface objects?
- Subject: RE: How can I "highlight" user interface objects?
- From: Jerry LeVan <email@hidden>
- Date: Sun, 17 Nov 2002 09:45:03 -0500
Ha,
I guess I was getting warm, after about 12 hours of experimentation I found
that the following seems to do the job.
- (IBAction)colorAction:(id)sender
{
NSLog(@"Clicked Button");
[box lockFocus];
NSRect theFrame = [box bounds];
[[NSColor redColor] set];
[NSBezierPath strokeRect:theFrame];
[box unlockFocus];
}
- (IBAction)unColorAction:(id)sender
{
[box setNeedsDisplay:YES];
}
Ie a red outline is placed around the ui element pointed to by box. I tested
a textfield, tableview, and textview. For the latter two you need to be
careful and choose the enclosing scrollview. The highlighting persists until
the ui needs to be redrawn.
Now I have to figure out how to fatten the pen...
Is this technique supposed to be obvious?
--Jerry
>
>
Message: 13
>
Date: Sat, 16 Nov 2002 11:46:26 -0500
>
Subject: How can I "highlight" user interface objects?
>
From: Jerry LeVan <email@hidden>
>
To: <email@hidden>
>
>
Hi,
>
>
I am trying to add some "spit and polish" to my *first* Cocoa
>
application, a
>
CSV file editor.
>
>
I want to drag a file using the Finder onto my open application and use
>
the
>
supplied file to view in the application. ( It is a single window
>
application).
>
>
Any way, before I attempt to implement the dragging destinations stuff I
>
thought I would try to determine how to draw a green/blue/whatever
>
rectangle
>
around a user interface object.
>
>
I built a small app with a text scrollview ,a colorit button and an
>
uncolorit button.
>
>
I had hoped to press the colorit button and have the frame of the
>
scrollview
>
rendered as a red rectangle, the uncolorit button is supposed to undo
>
the
>
damage.
>
>
I thought something like this might help:
>
- (IBAction)colorAction:(id)sender
>
{
>
NSRect bounds = [scrollViewWindow frame];
>
>
[[NSColor redColor] set];
>
[NSBezierPath strokeRect:bounds];
>
>
}
>
>
Of course nothing(visible) happens when the button action is invoked...
>
>
Any suggestions?
>
>
Thanks,
>
>
Jerry
>
>
--__--__--
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.