Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9145127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:26:12+00:00 2026-06-17T10:26:12+00:00

I’ve been searching all over for the answer to this question, and while I

  • 0

I’ve been searching all over for the answer to this question, and while I realize it’s likely very trivial, somehow the answer eludes me.

I need to show a second window (launched from clicking a menu item, if that matters). I know perfectly well how to do this with winforms, but I’m not sure what the monomac/NSWindow equivalent is. I need to do this:

MyWindowClass myWindow = new MyWindowClass();
myWindow.Show();

The best info I can find on the subject says that the following should work:

MyWindowClass myWindow = new MyWindowClass();
myWindow.MakeKeyAndOrderFront(this);

But when I try that, it tells me that MyWindowClass() needs an overload, so I look at the constructor and see that it’s asking for an IntPtr. Not knowing any better, I try this:

MyWindowClass myWindow = new MyWindowClass(new IntPtr());
myWindow.MakeKeyAndOrderFront(this);

This code will run without error, yet nothing happens when I try to launch the window.

I’m sure I’m just making a silly mistake, but I just haven’t been able to find anything on the subject. Any help would be greatly appreciated.

Edit: For reference, here’s the relevant portion of the constructor:

public MyWindowClass (IntPtr handle) : base (handle)
    {
        Initialize ();
    }

Additional info: I’m trying to run the code above from within AppDelegate.cs in the following method:

partial void showWindow (MonoMac.Foundation.NSObject sender){
        MyWindowClass myWindow = new MyWindowClass(new IntPtr());
        myWindow.MakeKeyAndOrderFront(this);
    }

EVEN MORE CODE AHOY:

public partial class ViewPaths : MonoMac.AppKit.NSWindow
{
    #region Constructors
    public ViewPaths ()
    {
        Initialize();
    }

    // Called when created from unmanaged code
    public ViewPaths (IntPtr handle) : base (handle)
    {
        Initialize ();
    }

    // Called when created directly from a XIB file
    [Export ("initWithCoder:")]
    public ViewPaths (NSCoder coder) : base (coder)
    {
        Initialize ();
    }

    // Shared initialization code
    void Initialize ()
    {
    }

    #endregion
}

And then the actual instantiation:

public partial class AppDelegate : NSApplicationDelegate
{
    MainWindowController mainWindowController;
    ViewPaths display;
    public AppDelegate ()
    {
    }

    public override void FinishedLaunching (NSObject notification)
    {
        mainWindowController = new MainWindowController ();
        mainWindowController.Window.MakeKeyAndOrderFront (this);
    }


    partial void viewPaths (MonoMac.Foundation.NSObject sender){
        display = new ViewPaths();
        display.MakeKeyAndOrderFront(this);
    }

}

}

This shows a window with no UI elements of any kind.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:26:13+00:00Added an answer on June 17, 2026 at 10:26 am

    Just add a default constructor without the handle parameter. Make sure MyWindowClass subclasses NSWindow and it should work.

    Also, you may need to keep a reference to your myWindow around – so that it does not get garbage collected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.