|
|
Sample Programs from NeXSTEP 3.3
#import "KAYEditableFormatter.h"
#import "LedgerController.h"
@implementation KAYEditableFormatter
- textDidEnd:textObject endChar:(unsigned short)whyEnd
{
if ((whyEnd == 16)||((whyEnd == 17) && (_theColumn == _lastColumn))) {
if (NXRunAlertPanel("Confirm?",
"Do you want to commit this transaction?",
"Yes", "No", NULL) == NX_ALERTDEFAULT) {
[super textDidEnd:textObject endChar:0];
[_theCtlr commit:self];
[_theCtlr perform:@selector(ping:) with :self afterDelay:1 cancelPrevious:NO];
} else
[super textDidEnd:textObject endChar:0];
} else {
[super textDidEnd:textObject endChar:whyEnd];
}
return self;
}
- setController:anObject
{
_theCtlr = anObject;
return self;
}
- setColumnLimit:(unsigned int)column
{
_lastColumn = column;
return self;
}
- (BOOL)editFieldAt:(unsigned int)row :(unsigned int)column inside:(NXRect *)frame inView:view
withAttributes:(id <DBTableVectors >)rowAttributes
:(id <DBTableVectors >)columnAttributes
usePositions:(BOOL)rp :(BOOL)rc
onEvent:(NXEvent *)theEvent
{
_theColumn = column;
return[super editFieldAt:row :column inside:frame inView:view
withAttributes:rowAttributes
:columnAttributes
usePositions:rp :rc
onEvent:theEvent];
}
- drawFieldAt:(unsigned int) row :(unsigned int) column
inside:(NXRect *) frame inView:view
withAttributes:(id <DBTableVectors>) ra
:(id <DBTableVectors>) ca
usePositions:(BOOL) rp :(BOOL) rc;
{
/* this is a hack to set every other row to the slightly different gray. */
#ifdef NEVEREVER
if ((row % 2) == 0) {
[drawCell setBackgroundGray:0.5];
}
#endif
return[super drawFieldAt:row :column
inside:frame inView:view
withAttributes:ra
:ca
usePositions:rp :rc];
}
@end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.