Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Qt or Cocoa GUI for a plugin: A short tutorial requested.

Explorer ,
Sep 20, 2011 Sep 20, 2011

Would anyone be so kind to write a short tutorial on how to create a simple dialog in an Illustrator plugin using either Qt or Cocoa.

As of now, I have experience in plugin development using ADM.

I have some experience in Cocoa programming.

I have no experience in Qt.

CONCERNING COCOA:

I have managed to write som code and bring up a simple Cocoa window from my plugin.  But the window is set to be visible at launch and it appears once the plugin is is loaded.

Action methoda in the controller class also correctly get called upon buton presses and such like.

I've written wrapper function according to the Carbon-Cocoa Integration Guide.  But, I'm unable to hide/show the window programatically.

CONCERNING Qt:

I simply don't know where to start...

A simple tutorial for either case would be lovely...

Agnar

TOPICS
SDK
2.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 20, 2011 Sep 20, 2011

For Cocoa I do this:

- (id)init {

    if (self = [super initWithWindowNibName:@"windowNIBName"]) {

       //Do any init here

          }

    return self;

}

To bring up the window;

          NSWindow* w = [self window];

          [NSApp runModalForWindow:w];

Then when I want to close it:

[[self window] performClose:self];

Hope that helps some.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 05, 2011 Oct 05, 2011

I Pressume "self" is referring to (an instance) of NSWindowsController (sub-)class?

Is any of the stuff in this Cocoa-Carbon integration guide relevant to Illustrator plugins (Illustrator is Carbon, isn't it?)

Agnar

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 05, 2011 Oct 05, 2011

And how do you create an instance of your Windows Controller class?

Do you create one global windows controller instance  at the startup of the Plugin or do you create one every time you want to open the window?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 06, 2011 Oct 06, 2011
LATEST

It seems that I made things working now.

I have more or less ignored the Cocoa-Carbon integration stuff(particularly concerning the autorelease pool).

Each time I need to open a dialog, I create an instance of my NSWindowController subclass.  I relase it when I close the window, Hence:

/* Standard C-wrapper function to open a dialog */

short

ShowDialog( void)

{

    MyWindowController* dlgController = [[MyWindowController alloc] init];

    [dlgController showWindow];

    return noErr;

}

/* MyWindowController methods */

- (void) showWindow

{

    NSWindow* w = [self window];

    /* The function RunAppModalLoopForWindow will automatically establish and drain an

       NSAutoReleasePool. That probably implies that we don't need to bother creating

       such a pool in our wrapper function */

    [NSApp runModalForWindow: w];

}

- (IBAction) closeDialog: (id) sender

{

    [[self window] performClose: self];

    [self release];

    [NSApp stopModal];

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines