Two different fonts for the two lines which are displayed in the same row and column

  • Hi,

    I have a nstableview and i have a column in the table which displays 2 lines
    in the same row.
    This scenario is something similar to the one present in i-chat where we
    have 2 lines in the same row corressponding to a particular column.
    The first line shows the name of the person and the second line shows the
    status of the person but the font size of two lines are different.
    I want to create something similar to this.
    Can someone please suggest how do i get two different fonts for the 2 lines?
    Also, i wanted to know if i can put 2 lines in a single row by any other
    method. (now i am using something like @"abc\rdef".)

    Thanks in advance,
    Vibhatha.
  • > Also, i wanted to know if i can put 2 lines in a single row by any other
    > method. (now i am using something like @"abc\rdef".)

    1) Create your own subclass of NSTextFieldCell, override the
    drawInteriorWithFrame:inView: and cellSizeForBounds: methods. This way you
    can anything you want since you're taking control of the drawing: different
    fonts for different lines, different background colors, draw some icons,
    whatever you want to do...

    2) Before your table is displayed, set the prototype cell for the column in
    question:
    [[[mytable tableColumns]  objectAtIndex: 0]
        setDataCell: [[[mycellclass alloc] init] autorelease]];

    --
    Scott Ribe
    <scott_ribe...>
    http://www.killerbytes.com/
    (303) 722-0567 voice
  • Another option is to return an attributed string with two different
    fonts for the two lines.

    Cheers, Patrick

    On 13-Oct-06, at 1:51 AM, vibhatha v wrote:

    > Hi,
    >
    > I have a nstableview and i have a column in the table which
    > displays 2 lines
    > in the same row.
    > This scenario is something similar to the one present in i-chat
    > where we
    > have 2 lines in the same row corressponding to a particular column.
    > The first line shows the name of the person and the second line
    > shows the
    > status of the person but the font size of two lines are different.
    > I want to create something similar to this.
    > Can someone please suggest how do i get two different fonts for the
    > 2 lines?
    > Also, i wanted to know if i can put 2 lines in a single row by any
    > other
    > method. (now i am using something like @"abc\rdef".)
    >
    > Thanks in advance,
    > Vibhatha.
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/meirmans%
    > 40sympatico.ca
    >
    > This email sent to <meirmans...>
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today