Search code examples
cocoanswindownsbutton

How do I make a NSWindow popup when a button is pressed


I have a small itty bitty help button in my cocoa program. I was wondering how to make it, when pressed, to make a small nswindow panel popup, with lots of text on it. How can I do this? The button is called help and the window can be called helpwin


Solution

  • I figured it out. All I had to do is create the @property for my panel. Then in my button IBAction, I wrote

    - (IBAction)help:(id)sender {
        if (![self.helpWin isVisible]) {
            [self.helpWin makeKeyAndOrderFront:sender];
        }
    }
    

    And it works!