• 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
help for NSMatrix -> action cell
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help for NSMatrix -> action cell


  • Subject: help for NSMatrix -> action cell
  • From: shengjun_guan (管聲俊) <email@hidden>
  • Date: Tue, 13 Nov 2007 14:02:13 +0800
  • Thread-topic: help for NSMatrix -> action cell

Hi all,

I create one image browser application use NSMatrix .
I show the file's image and file's name inside the Cell. Of course i make the Class: myCell which base from NSCell .And overwrite the NSCell's method: drawWithFrame: inView:  to show the image in up content ,and text in down content .

---FOLLOW IS THE CODE of drawWithFrame: inView: IN MY CELL CLASS-----
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
	if ((title != nil) || (image != nil))
	{
		NSRect	imageFrame,textFrame, tempFrame;
		NSDivideRect(cellFrame, &imageFrame, &textFrame, cellFrame.size.height - 15, NSMinYEdge);

		[image setFlipped:YES];
		[image drawInRect:imageFrame fromRect:NSMakeRect(0,0,[image size].width,[image size].height) operation:NSCompositeSourceOver fraction:1.0];

		if ((cellFrame.size.width - [[title string] length] * 4) / 2 >= 0)
		{
			textFrame.origin.x += (cellFrame.size.width - [title length] * 4) / 2;
		}
		textFrame.origin.y += 25;
		[title drawInRect:textFrame];
	}

	[super drawWithFrame:cellFrame inView:controlView];
}

And , i have realizied that open the image file with Preview when double click the Cell.
Now, i want to realizied to rename. When click the down content of the Cell, like the TextFied, user can input the
new Text. How can i do.  need I use NSView to replace NSMatrix ?

any reply is welcome . thanks a lot.

--Tom
_______________________________________________

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

  • Follow-Ups:
    • Re: help for NSMatrix -> action cell
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: Re: Custom attachment in a text view
  • Next by Date: Re: Creating balloon type of window in Cocoa
  • Previous by thread: Re: CIFilter Problems Under Leopard
  • Next by thread: Re: help for NSMatrix -> action cell
  • Index(es):
    • Date
    • Thread