• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Custom Control Questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom Control Questions


  • Subject: Re: Custom Control Questions
  • From: "Alex Bumbu" <email@hidden>
  • Date: Thu, 16 Aug 2007 13:58:45 +0200

Hello! Based on the Apple's Clock Control source code I've made a custom
control able to display an image. To this control I've added a button and
I've created an outlet to this button in the control class. I've instantiate
the class and I've connected the outlet with the button. Now I'm trying to
declare the outlet in the header of the class in the part which subclasses
NSControl (like the Apple's example I have 2 parts: one for NSActionCell and
one for NSControl) but the code doesn't compile. It returns me this error:
Command/ Developer/ Private/ jam failed with exit code 1. Please, if anyone
knows how to attach a button, a text field or anything else which requires
an outlet, can send me an example or give me some ideas how to do this.
Thanx a lot.

PS: As soon as I'll do this Custom Control I'll send the code for others
people which might have the same problem like me.

On 8/15/07, Alex Bumbu <email@hidden> wrote:
>
> Hello! I'm trying to create a custom control which contains an Custom View
> and a Button. Until now I've never needed to use the Custom Controls. I've
> found how to create Custom Controls and how to use them in the project from
> the Clock Control application provided by Apple, but the problem is that I
> couldn't find a way to load an image (TIFF) in the Custom View. I've put in
> the palette the Custom View and the button, and I've made the Custom View of
> the class I needed. The problem is that even if I tried to load the image
> with the code found in the Apple's example (the image is called
> ClockFace.tiff and I've put it in the resources):
>
>  - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
>     NSImage *clockFaceImage = [NSImage imageNamed: @"ClockFace"];
>     float clockRadius = MIN(NSHeight(cellFrame), NSWidth(cellFrame));
>
>     // Draw the clock face (draw it flipped if we are in a flipped view,
> like NSMatrix).
>     [clockFaceImage setFlipped:[controlView isFlipped]];
>     [clockFaceImage drawInRect:NSMakeRect(NSMinX(cellFrame),
> NSMinY(cellFrame),clockRadius,clockRadius)
> fromRect:NSMakeRect(0,0,[clockFaceImage size].width, [clockFaceImage
> size].height) operation:NSCompositeSourceOver fraction: 1.0];
> }
>
> or this code:
>
>     [[NSImageCell alloc] initImageCell:[NSImage imageNamed:@"ClockFace"]];
>
>
> in the init method, the image wasn't displayed.
>
> The other question I have, and maybe you can help me, is: Can I use a
> button in a Custom Control? Should I create a Controller for the actions of
> the button (like in the usual applications) and call those methods from the
> controller in the Control main class (the one that subclasses NSControl)? Or
> is there any other way. Please help me if you can. Thank you very much.
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Custom Control Questions (From: "Alex Bumbu" <email@hidden>)

  • Prev by Date: Re: NSConnection timeouts
  • Next by Date: Re: Printing contents of the active Desktop window
  • Previous by thread: Custom Control Questions
  • Next by thread: Re: Custom Control Questions
  • Index(es):
    • Date
    • Thread