• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: How do I debug a pref pane?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: How do I debug a pref pane?


  • Subject: RE: How do I debug a pref pane?
  • From: "Yves Peneveyre" <email@hidden>
  • Date: Wed, 14 Nov 2001 09:48:41 +0100

Hi,

Below, you'll find the code for testing a PrefPane.
It works fine.

The biggest part of the code is from :
http://developer.apple.com/techpubs/macosx/AdditionalTechnologies/Preference
Panes/Tasks/OtherApps.html

But, in general, the tutorial and the doc at the following URL are pretty
good :
http://developer.apple.com/techpubs/macosx/AdditionalTechnologies/Preference
Panes/index.html

What you can do is to add a target in your project for a
Cocoa application. Then, you add the files .h and .m for this target
only. If you set a breakpoint in one of your PrefPane method and if
you start your test app in debug mode the execution will stop in your
PrefPane method.

I hope it will help you, and sorry for my poor english.

Yves

----------------------------------------------------------------
Yves Peneveyre direct line : ++41 21 802 5754
Software Engineer fax : ++41 21 802 5751
LooKware development Ltd phone : ++41 21 802 5750
6B, ch du Trisi email: email@hidden
CH - 1028 Priverenges web: http://www.lookware.ch
----------------------------------------------------------------

// In Tests.h
#import <PreferencePanes/PreferencePanes.h>
#import <Cocoa/Cocoa.h>


@interface Tests : NSObject {

IBOutlet NSWindow *theWindow;

}

- (void) awakeFromNib;

@end

//////////////////////////////////
// In Tests.m
#import "Tests.h"
@implementation Tests

- (void) awakeFromNib
{
NSRect aRect;
NSString *pathToPrefPaneBundle;
NSBundle *prefBundle;
Class prefPaneClass;
NSPreferencePane *prefPaneObject;
NSView *prefView;

pathToPrefPaneBundle = [NSString stringWithString:
@"/blablabla/NameOf.prefPane"];

prefBundle = [NSBundle bundleWithPath: pathToPrefPaneBundle];

prefPaneClass = [prefBundle principalClass];
prefPaneObject = [[prefPaneClass alloc] initWithBundle: prefBundle];

if([prefPaneObject loadMainView] )
{
[prefPaneObject willSelect];
prefView = [prefPaneObject mainView];
/* Add view to window */
aRect = [prefView frame];

// Okay, I know this is not so goood...
aRect.size.height = aRect.size.height + 22;
[theWindow setFrame: aRect display: YES];
[[theWindow contentView] addSubview: prefView];
[prefPaneObject didSelect];
}
else
{
/* loadMainView failed -- handle error */
NSLog(@"Error !!!");
}
}
@end



-----Original Message-----

References: 
 >How do I debug a pref pane? (From: "Kevin Bohan" <email@hidden>)

  • Prev by Date: Re: NSWindowController that closes itself
  • Next by Date: Help "duplicating\spawning" a name window
  • Previous by thread: How do I debug a pref pane?
  • Next by thread: Re: How do I debug a pref pane?
  • Index(es):
    • Date
    • Thread