• 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: My own listbox
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: My own listbox


  • Subject: Re: My own listbox
  • From: Matthew Schinckel <email@hidden>
  • Date: Sat, 2 Aug 2008 18:18:20 +0930

You should be able to get close by using a different type of object for the Cells.

That's a much nicer way of doing it.

On 02/08/2008, at 6:10 PM, Vitaly Ovchinnikov wrote:

The problem is that my control will work like listbox, but don't
exactly. Actually I need to draw every row myself. And these rows will
have some padding and many graphics stuff inside. And they will have
adjustable height... And so on.
I don't think that it is possible to do this with standard controls. Am I wrong?


On Sat, Aug 2, 2008 at 1:33 PM, Boris Remizov <email@hidden> wrote:
Hello,
You shouldn't do this over work by implementing your own Control. You may
use
NSTableView or NSOutlineView instead. These visual classes allow to
implement
ListBox's look-and-feel and behavior in much much easier manner.


On Aug 2, 2008, at 12:21 PM, Vitaly Ovchinnikov wrote:

Hello,
In windows there is a control called "Listbox". It looks like grid
with single column without header. Several rows and maybe a scrollbar.
Example is here:
http://www.java2s.com/Tutorial/VBImages/ListBoxSelectionEventAddValue.PNG


I need to create control that works similar way. It will not be
actually a listbox, but it will work the same way: few objects - rows
and an optional scrollbar. As a "good" cocoa programmer I derived
NSControl and implemented -drawRect to draw my own rows. Then I put
this control to the window in Interface Builder and embed it into
NSScrollView. Here the problem starts. How can I tell NSScrollView
what size does my control have? I tried to implement -bounds and
-frame methods, but scroller became crazy. I tried this code:


- (NSRect) frame
{
 NSRect rc = [super frame];
 rc.size.height = number_of_rows * height_of_row;
 return rc;
}

- (NSRect) bounds {.. the same..}

NSScrollView shows scrollbar with correct proportions, but then I drag
it - it scrolls my control to the wrong direction. I tried to play
with -isFlipped - no success.


So I need some similar source to take a look for what I missed. Does
anybody have one?
Thank you.

_______________________________________________

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

-- Matthew Schinckel <email@hidden>

The Feynman Problem-Solving Algorithm:
 (1) write down the problem;
 (2) think very hard;
 (3) write down the answer.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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: 
 >My own listbox (From: "Vitaly Ovchinnikov" <email@hidden>)
 >Re: My own listbox (From: Boris Remizov <email@hidden>)
 >Re: My own listbox (From: "Vitaly Ovchinnikov" <email@hidden>)

  • Prev by Date: Re: My own listbox
  • Next by Date: Re: My own listbox
  • Previous by thread: Re: My own listbox
  • Next by thread: Re: My own listbox
  • Index(es):
    • Date
    • Thread