Re: "weak link" framework refs for 10.1 compatibility?
Re: "weak link" framework refs for 10.1 compatibility?
- Subject: Re: "weak link" framework refs for 10.1 compatibility?
- From: Marco Scheurer <email@hidden>
- Date: Sat, 9 Nov 2002 16:40:37 +0100
On Friday, November 8, 2002, at 11:17 AM, Bill Cheeseman wrote:
The bottom line, as I understand it, is that an application using C
constants that are new in 10.2 will not launch in 10.1.x or earlier.
Checking the system version to branch around them will not work,
because the
loader tries to load them all at once, up front.
Is that true? The following code, in a category of NSTextField,
compiled on 10.2 does not break on 10.1.x (text field is not rounded).
- (void) beRounded
{
if (IsJaguarOrLater()) {
[self setBezeled:YES];
[self setBezelStyle:NSTextFieldRoundedBezel];
}
}
Not only the NSTextFieldRoundedBezel constant, but also the
setBezelStyle method are new to 10.2. These are defined in
NSTextFieldCell and NSTextField like this:
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
typedef enum {
NSTextFieldSquareBezel = 0,
NSTextFieldRoundedBezel = 1
} NSTextFieldBezelStyle;
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2
- (void)setBezelStyle:(NSTextFieldBezelStyle)style;
- (NSTextFieldBezelStyle)bezelStyle;
#endif
And IsJaguarOrLater uses Gestalt to get the OS version:
BOOL IsJaguarOrLater()
{
unsigned long os_version = 0;
Gestalt (gestaltSystemVersion, &os_version);
return (os_version >= 0x1020);
}
Marco Scheurer
Sen:te, Lausanne, Switzerland
http://www.sente.ch
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.