Help with Macintosh programming

macintosh programming, mac programming, mac os programming, mac os x programming, mac programming language, mac programing

applicationWillTerminate are not called

Hi,

I’m new to mac programming, so please sorry for my dumb question :)
I added two deligate methods to my code: windowWillClose called well
(I see it in the debugger window), but applicationWillTerminate was
never called. Any ideas? You can see my current code below:

- (void)windowWillClose:(NSNotification *)notification {
// [[NSApplication sharedApplication] terminate:self];
// [wMain setDelegate:nil];
[self release]; // executed well

}

- (void)applicationWillTerminate:(NSNotification *)notification {
[self saveSettings];  // never executed

}

Thanks.

* posted via http://mymac.ws

.
Comments (2)

[Cocoa] Where can I find the NSScrollView in Interface Builder?

I would like to be able to scroll a large image. I was also hoping to scroll
a group of controls. There a few places that mention dropping an image, or a
bunch of controls, into an NSScrollView in Interface Builder. But I can not
find it. Is NSScrollView something that must be instantiated in code, or
have I just overlooked it in Interface Builder?

Comment (1)

OS X – link for release notes? xcode support 10.0?

Currently I am doing some porting from linux to OS X 10.3 (.6).
However, my application is also need to support 10.2, 10.1 10.0 and OS
X Server 10.3.  And now I need to do an estimation for my future task.
 So I would like to ask,

   1)  Is there any website which show the difference between 10.0,
10.1, 10.2, 10.3 and Server 10.3 ?   It will be great if they also
provide a list of major changes on different modules, e.g. java, etc.
   2)  Other than 10.0, 10.1, 10.2, 10.3 and Server 10.3 is there any
other major release?  e.g. any Server 10.2
   3)  What is the latest minor release for each major version.  e.g.
10.3 is 10.3.6.
   4)  I saw on the webpage, that xcode SDK support 10.1+.  How about
10.0?

Comments (5)

[carbon] GetControlByID return an unknow control code from my custom ditl

Hi,

i’m trying to understand why GetControlByID return -30584 while i’m find a
progress bar item in a ressourse based DITL.

i’m find to get the item number and set it to a new value.

the item number is rigth, is set to 1, but for the famous signature , hmmmm, i’m not

the ditl have 10 elments

the CountDITL(theDialog); return is ok

const ControlID         kLargeCheck                     = { ‘PROG’, 1 };

  theDialog = GetNewDialog(1000,NULL, (WindowPtr)-1);

cout << "\n count : " <<

SetRect(&contentBounds, 10, 50, 400, 400);

        if(!theDialog)
        return 0;

int err = GetControlByID( GetDialogWindow(theDialog), &kLargeCheck, &control );
cout<< "\n err : "<<err;
if(control){
SetControlValue( control, GetControlValue( control ) +GetControlValue( control ) );

}else{

SysBeep(50);

}

thanks to all
sebastien

Comment (1)

Old school (?) drawing philosophy

I finally have a serviceable 2d image drawing engine working under
System 1.0 through OS 9.2. I can draw arbitrary sized multi-frames
sprites, with (pre-generated) white masks, if needed, and with
auto-cleaning (saves background in temp bitmap and draws it back when
moving) during the blit process. (All in C)

However, even with smallish 16×16 pixels^2 bitmaps, I notice a faint
flicker, even if I’m looking at it. My strategy is to impose a delay in
the drawing with an IF condition on the value of TickCount() (do
drawing at every 4 ticks, for example), to blit the sprite, and deal
with movement and boundary/collisions conditions afterwards.

I’ve read in the THINK C reference that while I could install a VBL
task in the queue, the tasks that have to be done there must not move
memory – my sprite blitting functions use several calls of CopyBits at
their core, and that moves memory. The reference also mentions that
Ticks can be tracked and followed by a "quick" drawing to ensure smooth
animation. I’m wondering – is this done inside a VBL task, or is a
simple tracking of TickCount’s return value enough? I’m doing the
latter, to little success.

My main question would be: how do you test the speed of a blitting
function in a more systematic way than to fiddle with it until you
cease to see flickering?

Right now, I reckon that my blit function does several things and may
take more than a tick to resolve (in my target machines – 68k macs):
1) IF to check if the sprite cleans after itself. If yes, A) CopyBits
the old buffer into the old location. B) Change the buffer location to
the new one. C) CopyBits the new location into the buffer. No actual
sprite is drawn yet.
2) IF to check if the sprite uses a mask – if yes, draws the white mask
(a straightforward copybits with srcBic as its transfer mode).
3) CopyBits the sprite proper into its position (srcOr = transfer
mode).
4) If there’s no mask (2nd IF failed), copybits the sprite with
srcCopy.

At the worst (mask + cleaning), there are 2 IFs statement to evaluate,
3 copybits going on, one Rect assigning and 2 pairs of HLock HUnlock
that are needed around the new buffer CopyBits call.

I’m trying to figure out if this can be solved with VBL tasks, or if I
plain and simple need to optimize my BlitSprite function.

Comments (12)

applicationWillTerminate are not called

Hi,

I’m new to mac programming, so please sorry for my dumb question :)
I added two deligate methods to my code: windowWillClose called well
(I see it in the debugger window), but applicationWillTerminate was
never called. Any ideas? You can see my current code below:

- (void)windowWillClose:(NSNotification *)notification {
// [[NSApplication sharedApplication] terminate:self];
// [wMain setDelegate:nil];
[self release]; // executed well

}

- (void)applicationWillTerminate:(NSNotification *)notification {
[self saveSettings];  // never executed

}

Thanks.

* posted via http://mymac.ws

Comments (2)

[Cocoa] Where can I find the NSScrollView in Interface Builder?

I would like to be able to scroll a large image. I was also hoping to scroll
a group of controls. There a few places that mention dropping an image, or a
bunch of controls, into an NSScrollView in Interface Builder. But I can not
find it. Is NSScrollView something that must be instantiated in code, or
have I just overlooked it in Interface Builder?

Comment (1)

OS X – link for release notes? xcode support 10.0?

Currently I am doing some porting from linux to OS X 10.3 (.6).
However, my application is also need to support 10.2, 10.1 10.0 and OS
X Server 10.3.  And now I need to do an estimation for my future task.
 So I would like to ask,

   1)  Is there any website which show the difference between 10.0,
10.1, 10.2, 10.3 and Server 10.3 ?   It will be great if they also
provide a list of major changes on different modules, e.g. java, etc.
   2)  Other than 10.0, 10.1, 10.2, 10.3 and Server 10.3 is there any
other major release?  e.g. any Server 10.2
   3)  What is the latest minor release for each major version.  e.g.
10.3 is 10.3.6.
   4)  I saw on the webpage, that xcode SDK support 10.1+.  How about
10.0?

Comments (5)

[carbon] GetControlByID return an unknow control code from my custom ditl

Hi,

i’m trying to understand why GetControlByID return -30584 while i’m find a
progress bar item in a ressourse based DITL.

i’m find to get the item number and set it to a new value.

the item number is rigth, is set to 1, but for the famous signature , hmmmm, i’m not

the ditl have 10 elments

the CountDITL(theDialog); return is ok

const ControlID         kLargeCheck                     = { ‘PROG’, 1 };

  theDialog = GetNewDialog(1000,NULL, (WindowPtr)-1);

cout << "\n count : " <<

SetRect(&contentBounds, 10, 50, 400, 400);

        if(!theDialog)
        return 0;

int err = GetControlByID( GetDialogWindow(theDialog), &kLargeCheck, &control );
cout<< "\n err : "<<err;
if(control){
SetControlValue( control, GetControlValue( control ) +GetControlValue( control ) );

}else{

SysBeep(50);

}

thanks to all
sebastien

Comment (1)

[Cocoa] how to display actual size of image in NSImageView?

I drag an image of size 700 x 900 pixels to the "images" tab of my .nib file
in Interface Builder, to add it to the project. Then I drag the added image
to an NSImageView. It looks a lot smaller, maybe about 300 x 400 pixels.
Even though the size of the NSImageView is set to the exact dimensions of
the image, and scaling is set to none. How do I make it show the image in
its actual size?

Comments (4)