Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

scott455

macrumors member
Original poster
Jun 5, 2022
40
0
hi,
using objc and cocoa, I need to display a alert message box that pops up when some background routine, backgrnd_rtn(), is executing. After background routine done, auto close the alert box.
 

ssmed

macrumors 6502a
Sep 28, 2009
885
423
UK
Not quite what you want, but you could just invoke a notification at the end of the routine.
 

scott455

macrumors member
Original poster
Jun 5, 2022
40
0
my app is connecting to library. library notifies something started and ending. I need app
to handle these before complete its launching. Like some alert pop up that auto closes when end is detected.
What is best way to handle this?.
used runModalForWindow and got this error:
'pigSegment' cannot be found error.
 
Last edited:

Nygaard

macrumors member
Dec 7, 2022
47
20
Houston
If you just programmatically create an NSWindow, you can use the -makeKeyAndOrderFront: and -close methods. However, since these are UI things, they must be done on the main thread. You can still use your background routine, but when it comes time to manipulate the UI, those calls need to be dispatched onto the main thread in some way (eg dispatch_async).
 

scott455

macrumors member
Original poster
Jun 5, 2022
40
0
i sub classed a NSWindowController. Did this:
Code:
mycontroller             * Mc;  //in header
handling a message in .m file:
if (! Mc) {
Mc = [[mycontroller alloc] initWithWindowNibName:"aWindow"];  //alert window
}
[Mc showWindow:self];
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; //make sure window is up
got this error still:
'pigSegment' cannot be found error.
use dispatch_async?? what the above code could change to?.
 
Last edited:

Nygaard

macrumors member
Dec 7, 2022
47
20
Houston
I don't know what a 'PieSegment' is – that may have something to do with the library you are using.

Try making a blank project and playing around with creating windows. Once you get it working in a simple project, then you can try moving it over to your other project.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.