Dynamically alterting objects in a view

  • You'll need to ask it to draw in the next render using [myTable
    setNeedsDisplay:YES];.

    Bob

    On 4 Oct 2006, at 19:15, Aychamo Aychamo wrote:

    > Hello,
    >
    > I have an NSTableView in a window, and I'm trying to change it's
    > location and it's width & height (the same way you would in Interface
    > Builder, where you pick the x,y coordinates, and the height and
    > width.)  I'm have extraordinary difficulty in doing so.
    >
    > I've read the View Programming Guide, and I've tried a number of
    > things, including setting the Table's frame and bounds.  I have the
    > table's outlet set to myTable, and I try:
    >
    > [myTable setFrame: NSMakeRect (0,0,500,500)];
    > or
    > [myTable setBounds: etc..];
    >
    > And it won't actually change the x loc/y loc/width/height of the
    > NSTableView on the window.
    >
    > Does anyone have any advice?
    >
    > Thank you
    > AA
    > _______________________________________________
    > 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/<tom.davie...>
    >
    > This email sent to <tom.davie...>
  • Hello,

    I have an NSTableView in a window, and I'm trying to change it's
    location and it's width & height (the same way you would in Interface
    Builder, where you pick the x,y coordinates, and the height and
    width.)  I'm have extraordinary difficulty in doing so.

    I've read the View Programming Guide, and I've tried a number of
    things, including setting the Table's frame and bounds.  I have the
    table's outlet set to myTable, and I try:

    [myTable setFrame: NSMakeRect (0,0,500,500)];
    or
    [myTable setBounds: etc..];

    And it won't actually change the x loc/y loc/width/height of the
    NSTableView on the window.

    Does anyone have any advice?

    Thank you
    AA
  • Well, I've done that more directly I suppose, using [myTable
    display];, without success.

    On 10/4/06, Thomas Davie <tom.davie...> wrote:
    > You'll need to ask it to draw in the next render using [myTable
    > setNeedsDisplay:YES];.
    >
    > Bob
    >
    > On 4 Oct 2006, at 19:15, Aychamo Aychamo wrote:
    >
    >> Hello,
    >>
    >> I have an NSTableView in a window, and I'm trying to change it's
    >> location and it's width & height (the same way you would in Interface
    >> Builder, where you pick the x,y coordinates, and the height and
    >> width.)  I'm have extraordinary difficulty in doing so.
    >>
    >> I've read the View Programming Guide, and I've tried a number of
    >> things, including setting the Table's frame and bounds.  I have the
    >> table's outlet set to myTable, and I try:
    >>
    >> [myTable setFrame: NSMakeRect (0,0,500,500)];
    >> or
    >> [myTable setBounds: etc..];
    >>
    >> And it won't actually change the x loc/y loc/width/height of the
    >> NSTableView on the window.
    >>
    >> Does anyone have any advice?
    >>
    >> Thank you
    >> AA
    >> _______________________________________________
    >> 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/<tom.davie...>
    >>
    >> This email sent to <tom.davie...>
    >
    >
  • From the -setFrame: documentation:

    This method, in setting the frame rectangle, repositions and resizes
    the receiver within the coordinate system of its superview. It
    neither redisplays the receiver nor marks it as needing display. You
    must do this yourself with display or setNeedsDisplay:.

    Same for setBounds. Did you call [myTable setNeedsDisplay:YES]?

    Hank Heijink
    www.hankheijink.com
    <hankh...>

    On Oct 4, 2006, at 2:15 PM, Aychamo Aychamo wrote:

    > Hello,
    >
    > I have an NSTableView in a window, and I'm trying to change it's
    > location and it's width & height (the same way you would in Interface
    > Builder, where you pick the x,y coordinates, and the height and
    > width.)  I'm have extraordinary difficulty in doing so.
    >
    > I've read the View Programming Guide, and I've tried a number of
    > things, including setting the Table's frame and bounds.  I have the
    > table's outlet set to myTable, and I try:
    >
    > [myTable setFrame: NSMakeRect (0,0,500,500)];
    > or
    > [myTable setBounds: etc..];
    >
    > And it won't actually change the x loc/y loc/width/height of the
    > NSTableView on the window.
    >
    > Does anyone have any advice?
    >
    > Thank you
    > AA
    > _______________________________________________
    > 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/<hankh...>
    >
    > This email sent to <hankh...>
    >
  • Out of curiosity, if instantiated the NSTableView myself, instead of
    through the nib, would it be something like this?:

    NSScrollView *myScrollView = [[NSScrollView alloc] init];
    NSTableView *myTableView = [[NSTableView alloc] init];

    [myTableView .... set all the options];
    [myScrollView addSubview: myTableView];

    or something like that?

    Thank you
  • Nearly.  You actually want the setDocumentView: method in this case.

    With regards to the original problem, are sure you're not simply
    moving the table view around inside the scroll view?  It's the scroll
    view that you need to call setFrame: on really I believe.

    Mike.

    On 4 Oct 2006, at 20:08, Aychamo Aychamo wrote:

    > Out of curiosity, if instantiated the NSTableView myself, instead of
    > through the nib, would it be something like this?:
    >
    > NSScrollView *myScrollView = [[NSScrollView alloc] init];
    > NSTableView *myTableView = [[NSTableView alloc] init];
    >
    > [myTableView .... set all the options];
    > [myScrollView addSubview: myTableView];
    >
    > or something like that?
    >
    > Thank you
    > _______________________________________________
    > 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/mike.abdullah%
    > 40gmail.com
    >
    > This email sent to <mike.abdullah...>
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