Ignore:
Timestamp:
04/04/03 08:23:08 (22 years ago)
Author:
Nicholas Riley
Message:

NJRHotKeyField.m: Fixed status-available-forever problem. Rearranged
some stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/NJRHotKeyField.m

    r131 r132  
    6969#pragma mark interface updating
    7070
    71 // XXX still problems with command-A the first time
     71- (void)showStatus:(NSString *)error;
     72{
     73    [self setAttributedStringValue:
     74        [[NSAttributedString alloc] initWithString: [NSString stringWithFormat: @"(%@)", error]
     75                                        attributes: statusAttributes]];
     76    [NSObject cancelPreviousPerformRequestsWithTarget: self selector: @selector(clearStatus) object: nil];
     77    [self performSelector: @selector(clearStatus) withObject: nil afterDelay: 0.5];
     78    [[self currentEditor] setSelectedRange: zeroRange];
     79}
    7280
    7381- (void)previewKeyEquivalentAttributedString:(NSAttributedString *)equivString;
     
    7886    [[self currentEditor] setSelectedRange: zeroRange];
    7987    [previewString release];
    80 }
    81 
    82 - (void)showStatus:(NSString *)error;
    83 {
    84     [self setAttributedStringValue:
    85         [[NSAttributedString alloc] initWithString: [NSString stringWithFormat: @"(%@)", error]
    86                                         attributes: statusAttributes]];
    87     [[self currentEditor] setSelectedRange: zeroRange];
    8888}
    8989
     
    101101    [[self currentEditor] setSelectedRange: zeroRange];
    102102    [equivString release];
     103}
     104
     105- (void)clearStatus;
     106{
     107    if ([[[self attributedStringValue] attributesAtIndex: 0 effectiveRange: NULL] isEqualToDictionary: statusAttributes]) {
     108        [self showKeyEquivalentAttributedStringFinalized: ([[NSApp currentEvent] modifierFlags] & capturedModifierMask) == 0];
     109    }
    103110}
    104111
Note: See TracChangeset for help on using the changeset viewer.