(no subject)

  • Hi! I know this is a newbie question but I've tried to prevent the
    resizing of a NSWindow from Interface Builder selecting the "Lock"
    option in to Size tab, but nothing happens. Does anybody know how can
    I achieve this?

    Thanks
  • At 7:43 PM +0200 10/1/07, Dani wrote:

    > Hi! I know this is a newbie question but I've tried to prevent the
    > resizing of a NSWindow from Interface Builder selecting the "Lock"
    > option in to Size tab, but nothing happens. Does anybody know how
    > can I achieve this?

    How 'bout unchecking the "Zoom (and resize)" checkbox in the NSWindow
    Attributes "Title Bar Controls" pane?

    --
    randy
  • Hi!

    How can I create simple program that draws rectangle in every x
    second. My actual app redraws NSView every x second. How can I just
    add new points instead of redrawing all of them with for statement?

    #import "AnimationView.h"

    @implementation AnimationView

    - (id)initWithFrame:(NSRect)frame {

        self = [super initWithFrame:frame];
        if (self) {
            iterator = 1;

    [NSTimer scheduledTimerWithTimeInterval:0.1
            target:self
            selector:@selector(stepAnimation:)
            userInfo:nil
            repeats:YES];
        }

        return self;
    }

    - (void)drawRect:(NSRect)rect {
    iterator++;
    NSRect shape;
        NSBezierPath *bp;

        [[NSColor redColor] set];

    for(i=0; i < iterator; i++) {
      shape = NSMakeRect(5, 5, 1, 1+i);

      bp = [[NSBezierPath bezierPathWithRect:shape] retain];
      [bp fill];
    }
    }

    - (void)stepAnimation:(NSTimer *)timer
    {
        [self setNeedsDisplay:YES];
    }
    @end
    Thanks.
  • Folks;

    I am trying to allow the user to manage which table columns are visible.
    I have everything working very nicely within a given application launch.

    I was under the impression that the tableView in the nib is archived
    and not altered by any of the addTableColumn/removeTableColumn activity.
    However, during a later application launch, when I read the [tv
    tableColumns] in the tableView's -awakeFromNib what I find  is that
    only the columns which were visible when the application was last
    terminated are there.

    So when the user attempts to add back a column in this later run of
    the application it fails because I no longer have anything which
    points to the invisible columns....???

    This is a non-document based app.
    The table columns have bindings for value, fontName, fontSize, and
    textColor.

    Subclassed TableView
    - (void) awakeFromNib {
    NSArray * t = [self tableColumns];
    NSMutableDictionary*workDict = [NSMutableDictionary
    dictionaryWithCapacity:[t count]];
    NSEnumerator * thisEnum = [t objectEnumerator];
    NSTableColumn *tc;
    while ((tc=[thisEnum nextObject])!=nil) {
      [workDict setObject:tc forKey:(NSString *)[tc identifier]];
    }
    [self setMyTableColumns:workDict];  //this is an KVC compliant
    dictionary instance var
    }

    WindowController
    - (void) windowDidLoad {
    ...
    NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
    if ([ud boolForKey:@"hideFistName"] == YES) [listTableView
    removeTableColumn:[[listTableView myTableColumns]
    objectForKey:@"firstName"]];
    if ([ud boolForKey:@"hideLastName"]  == YES) [listTableView
    removeTableColumn:[[listTableView myTableColumns]
    objectForKey:@"lastName"]];
    ...etc..
    }

    - (IBAction) toggleColumnVisibility:(id)sender {
    NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
    NSTableColumn *TC;
    switch ([sender tag]) {
      case 0:
      TC = [[listTableView myTableColumns] objectForKey:@"firstName"];
      if ([ud boolForKey:@"listDockHideFirstName"] == YES)
    [listTableView removeTableColumn:TC];
      else [listTableView addTableColumn:TC];
      break;
      case 1:
      TC = [[listTableView myTableColumns] objectForKey:@"lastName"];
      if ([ud boolForKey:@"listDockHideLastName"] == YES) [listTableView
    removeTableColumn:TC];
      else [listTableView addTableColumn:TC];
      break;
    ...etc..
    }

    What am I doing wrong?
    It all works great within one launch!

    Thanks for any thoughts!
    Steve
  • Is it possible to filter in real time the data entry of a numerical
    value in an input field by limiting the data entry between a min and
    a max value ?
    In Interface Builder, I can define a formatter by fixing a minimum
    and a maximum value but the checking is made only after the
    validation of the data entry (by carriage return for example).
    I don't want this but I want a filtering in real time during the data
    entry.
    How can I do that ?
    Thank you

    *-*-*-*-*
    Eric PETITE-mail :
        <epetit91...>
        <turboloto...>

    Site TURBOLOTO™ :
        http://turboloto.free.fr
    *-*-*-*-*
  • On Oct 20, 2007, at 6:38 AM, Eric PETIT wrote:

    > Is it possible to filter in real time the data entry of a numerical
    > value in an input field by limiting the data entry between a min
    > and a max value ?
    > In Interface Builder, I can define a formatter by fixing a minimum
    > and a maximum value but the checking is made only after the
    > validation of the data entry (by carriage return for example).
    > I don't want this but I want a filtering in real time during the
    > data entry.
    > How can I do that ?
    > Thank you

    In general, if you could, it would result in a hideous UI.

    If your min was 10 and a max of 100, with a current value of 50, how
    would they change this to 90?  The most logical way would be to
    select the value and start typing - the problem is that they type a 9
    and suddenly the value is 9, which is less than the minimum, so
    either an error appears or it somehow prevents this.  Instead, the
    only way would be to select the "5" only and then type a "9", which
    isn't the most pleasant experience.

    Now what if they wanted 92?  They had to first select the "5", type a
    "9", select the "0", type a "2".  They now wanted 93 - the most
    logical thing would be to backspace over the 2 and type a 3, but they
    can't do this because it changes it to 9 which is less than the min.

    Worse, consider a range of 5 to 15, with a current value of 8.  There
    is no easy way for them to type 10 - they can't add the 1 in front of
    the thing (since 18 is too large) and they can't select the 8 and
    replace it with a 1 (since that is too small).  They would have to
    select the 8, type a 5, move the cursor left, add a 1 in front of it,
    and then go and change the 5 to 0.  And if the range were 5..14,
    there is no way at all...

    If you need the user to enter a value between two (relatively close)
    values, perhaps a slider would be a better approach?

    Glenn Andreas                      <gandreas...>
      <http://www.gandreas.com/> wicked fun!
    quadrium2 | build, mutate, evolve, animate  | images, textures,
    fractals, art
  • > In general, if you could, it would result in a hideous UI.

    Everything you say is true if the feedback mechanism is modal. But if it is
    some kind of status indicator, all those problems go away. For instance, for
    date & time entry I have a static text area below the entry area that shows
    the parsed and cleaned-up version of what the user has typed so far, or
    nothing at all if their entry is not (yet) a valid date & time. Or, in
    another case, where a note must be limited to 80 characters because of
    constraints imposed by an external system, a static area below the entry are
    which tells the user how much more can be typed, or if the user goes over
    how much too much has been typed (in red at that point).

    Anyway, there's no built-in filtering mechanism, but you can certainly look
    at the methods of NSRespondertext input, and use them to respond to data
    entry (remember, not just keystrokes, but also paste, for example) and parse
    at each incremental change.

    --
    Scott Ribe
    <scott_ribe...>
    http://www.killerbytes.com/
    (303) 722-0567 voice
  • On Oct 22, 2007, at 11:27 AM, Scott Ribe wrote:

    >> In general, if you could, it would result in a hideous UI.
    >
    > Everything you say is true if the feedback mechanism is modal. But
    > if it is
    > some kind of status indicator, all those problems go away.

    Excellent point - I was working from the "built in" max/min support
    you get for free via settings in IB...

    >
    >
    > Anyway, there's no built-in filtering mechanism, but you can
    > certainly look
    > at the methods of NSRespondertext input, and use them to respond to
    > data
    > entry (remember, not just keystrokes, but also paste, for example)
    > and parse
    > at each incremental change.

    Or you can use the control's delegate method - namely
    "controlTextDidChange:" notification, which is sent every time the
    control changes (which covers all the various input/keystroke/paste/
    drag & drop/psychic gestures/whatever combinations)

    Glenn Andreas                      <gandreas...>
      <http://www.gandreas.com/> wicked fun!
    quadrium2 | build, mutate, evolve, animate  | images, textures,
    fractals, art
  • > Or you can use the control's delegate method - namely
    > "controlTextDidChange:" notification

    Oh yeah. If only I'd taken a moment to look at my own code, I would have
    been reminded of that.

    --
    Scott Ribe
    <scott_ribe...>
    http://www.killerbytes.com/
    (303) 722-0567 voice
previous month october 2007 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