11 Replies Latest reply on Sep 13, 2014 2:11 AM by KemChan

    CS6 - Does CS6 SDK provide a dialog box whose icon can be adjusted?

    KemChan

      I am porting a CS5 plug in to CS6.

      My plugin contains 1 main form and some alert dialogs which are independent to the main

      (e.g. a "Help" dialog box shows when users click at AI > Help > [My Plug-in Help] button).

       

      The main form which uses Flash UI is done.

      But the "Help" dialog has a problem.

      I want to use CS6 SDK to show a dialog with my specified icon, not the warning icon as default.

       

      # I tried the alerts in AIUserSuite but none of them is appropriated.

       

      Does CS6 SDK provide a dialog box whose icon can be adjusted?

        • 1. Re: CS6 - Does CS6 SDK provide a dialog box whose icon can be adjusted?
          LeoTaro Level 4

          No you can't set your own icon in any of the built in dialog windows. Why don't you just create a simple dialog using Flash?

          • 2. Re: CS6 - Does CS6 SDK provide a dialog box whose icon can be adjusted?
            KemChan Level 1

            Thank you, LeoTaro!

            In that case, how to show a simple flash dialog (e.g. 300x200) without showing the main screen (1078x680) of the extension?      

            • 3. Re: CS6 - Does CS6 SDK provide a dialog box whose icon can be adjusted?
              LeoTaro Level 4

              I assume your "main screen" is shown and hidden using a menu item.

               

              Create an mxml file for the About dialog in the same way as you did for your main panel. In your manifest.xml file add an Extension entry for the dialog in the ExtensionList and in the DispatchInfoList. In the Extension entry in the DispatchInfoList set AutoVisible to false and don't include a Menu setting.

               

              You can then use the PlugPlugLoadExtension and PlugPlugUnloadExtension functions in the PlugPlug shared library to show and hide the dialog from your plugin.

              • 4. Re: CS6 - Does CS6 SDK provide a dialog box whose icon can be adjusted?
                KemChan Level 1

                Thank you LeoTaro.

                 

                But my implementation made AI crashed after PlugPlugLoadExtension is called.

                Please tell me the wrong points of my practice. Thank you!

                 

                --------

                LeoTaro wrote:

                 

                1. Create an mxml file for the About dialog in the same way as you did for your main panel.

                MainScreen.mxml

                <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

                                xmlns:s="library://ns.adobe.com/flex/spark"

                                width="865" height="545"

                                horizontalScrollPolicy="off" verticalScrollPolicy="off"

                                layout="absolute"

                                creationComplete="init()" >

                ...

                --> Create new HelpScreen.mxml

                <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

                                xmlns:s="library://ns.adobe.com/flex/spark"

                                width="865" height="545"

                                horizontalScrollPolicy="off" verticalScrollPolicy="off"

                                layout="absolute"

                                creationComplete="init()" >

                ...

                 

                2. In your manifest.xml file add an Extension entry for the dialog in the ExtensionList and in the DispatchInfoList.

                3. In the Extension entry in the DispatchInfoList set AutoVisible to false

                I cannot edit manifest.xml by Flash Builder (it just does not allow me to type there)

                so I used Notepad++ to add HelpScreen extension as you mentioned.

                and don't include a Menu setting.

                I don't how to do this so I skipped it for temporary.

                Then, I rebuilt the project by Flash Builder.

                4. You can then use the PlugPlugLoadExtension and PlugPlugUnloadExtension functions in the PlugPlug shared library to show and hide the dialog from your plugin.

                Finally, since some conducted steps are incorrect, the AI is crashed after PlugPlugLoadExtension is called.

                • 5. Re: CS6 - Does CS6 SDK provide a dialog box whose icon can be adjusted?
                  LeoTaro Level 4

                  I don't use Flash Builder, I do everything from the command line, so I don't know how you add extra windows in Flash Builder, maybe somemone else can help? You probably also want to change the UI type of the help dialog in the manifest.xml file from Panel to ModalDialog (I don't think this will fix the crash though).

                   

                  I assume you are calling PlugPlugLoadExtension from inside your menu message handler. Can you show the code you use?

                  • 6. Re: CS6 - Does CS6 SDK provide a dialog box whose icon can be adjusted?
                    KemChan Level 1

                    My code is as belows:

                     

                    #define HELP_DIALOG_ID     "HelpScreen"

                     

                    DllExport SPAPI SPErr PluginMain( char *caller, char *selector, void *message ){

                    {  

                        AIErr error = kNoErr;

                        sSPBasic = ( ( SPMessageData* )message)->basic;

                         if ( sSPBasic->IsEqual( caller, kSPAccessCaller ) ){

                             if ( sSPBasic->IsEqual( selector, kSPAccessUnloadSelector ) )        error = UnloadPlugin( (SPAccessMessage*) message );

                            else if ( sSPBasic->IsEqual( selector, kSPAccessReloadSelector ) )    error = ReloadPlugin( (SPAccessMessage*) message );

                        }else{

                            error = acquireSuites( ((SPInterfaceMessage*)message)->d.basic );

                            if ( error )    goto errorTag;                          

                     

                            if ( sSPBasic->IsEqual( caller, kSPInterfaceCaller ) ) {

                                if ( sSPBasic->IsEqual( selector, kSPInterfaceStartupSelector ) )        error = StartupPlugin( (SPInterfaceMessage*) message );

                                else if ( sSPBasic->IsEqual( selector, kSPInterfaceAboutSelector ) )    error = AboutPlugin( (SPInterfaceMessage*) message );

                                else if ( sSPBasic->IsEqual( selector, kSPInterfaceShutdownSelector ) )    error = ShutdownPlugin( (SPInterfaceMessage*) message );

                            }else{    //Dispatch Other Message by handlePluginCaller

                                error = handlePluginCaller( caller, selector, message );

                            }

                    errorTag:

                            if ( (error) && (error != kSPSuiteNotFoundError) )    report_error( (SPInterfaceMessage*) message, error );

                        }

                        return error;

                    }

                     

                    AIErr AboutPlugin( SPInterfaceMessage *message ){

                        AIErr error = kNoErr;

                        // Pop an about box for this plug-in

                         PlugPlugErrorCode err = PlugPlugLoadExtensionFn(HELP_DIALOG_ID);

                    }

                    • 7. Re: CS6 - Does CS6 SDK provide a dialog box whose icon can be adjusted?
                      LeoTaro Level 4

                      If you are using the SDKPlugPlug class from the sample code, you need to use the LoadExtension and UnloadExtension functions. PlugPlugLoadExtensionFn is the typedef for the load function. The actual function in the shared library is called PlugPlugLoadExtension, but this is wrapped by LoadExtension in the SDKPlugPlug class.

                      • 8. Re: CS6 - Does CS6 SDK provide a dialog box whose icon can be adjusted?
                        KemChan Level 1

                        You are right. It's wrapped in LoadExtension in SDKPlugPlug class.

                        I'm sorry for the dummy code.

                        Since my code is quite long, so I wrote it shorten.

                        My full code is as below:

                         

                        FlashUIDialog.h

                        class FlashUIDialog
                        {
                        public:
                            FlashUIDialog(const char* extensionId);
                            virtual ~FlashUIDialog(void);
                            virtual PlugPlugErrorCode LoadExtension();
                            virtual PlugPlugErrorCode UnloadExtension();
                            virtual csxs::event::EventErrorCode RegisterCSXSEventListeners() = 0;
                            virtual csxs::event::EventErrorCode RemoveEventListeners() = 0;
                        protected:
                            SDKPlugPlug fPPLib;
                        private:
                            const char* fExtensionId;
                        };
                        
                        

                        -----

                        HelpDialog.h

                        class HelpDialog: public FlashUIDialog
                        {
                        public:
                            HelpDialog(void);
                            HelpDialog(const char* extensionid);
                            csxs::event::EventErrorCode RegisterCSXSEventListeners();
                            csxs::event::EventErrorCode RemoveEventListeners();
                            ASErr SendText();
                            ASErr SendImageName();
                        private:
                            HelpDialog& operator=(const HelpDialog&rhs);
                            HelpDialog(const HelpDialog&rhs);
                        };
                        
                        

                        -----

                        shell(common).cpp

                        extern "C"
                        {
                                  HelpDialog *aboutDialog;
                        }
                        AIErr StartPlugIn( SPInterfaceMessage *message ){
                             if (aboutDialog == NULL)
                              {
                                 aboutDialog = new HelpDialog(HELP_DIALOG_ID);
                              }
                        }
                        
                        

                        ----

                        MySDKPlugInHelper.cpp

                        extern "C"
                        {
                                  HelpDialog *aboutDialog;
                        }
                        AIErr AboutPlugin( SPInterfaceMessage *message ){
                            AIErr error = kNoErr;
                        
                            // Pop an about box for this plug-in
                             if (aboutDialog)
                             {
                                 error = aboutDialog->RemoveEventListeners();
                                 error = aboutDialog->UnloadExtension();
                                 error = aboutDialog->RegisterCSXSEventListeners();    
                                 error = aboutDialog->LoadExtension();  
                             }
                        }
                        
                        
                        • 9. Re: CS6 - Does CS6 SDK provide a dialog box whose icon can be adjusted?
                          KemChan Level 1

                          Is there a SDK dialog that has:

                          1. No icon ?

                          OR

                          2. Other icon rather than an orange triangle with "!"  which illustrates an issue?

                           

                          I want to show a very simple dialog with the information only (e.g. Help or About information).

                          So any icon (or no icon) which does not mean "warning" is OK.

                          • 10. Re: CS6 - Does CS6 SDK provide a dialog box whose icon can be adjusted?
                            LeoTaro Level 4

                            So does you code work now?

                             

                            The SDK example code uses AIUser MessageAlert. On Mac this shows a warning icon. I think on Windows it shows a different icon or no icon. I think the warning icon on Mac is a bug in the SDK.

                            • 11. Re: CS6 - Does CS6 SDK provide a dialog box whose icon can be adjusted?
                              KemChan Level 1

                              No, unfortunately, the previous code made the AI crashed at:

                              error = aboutDialog->LoadExtension();  

                               

                              I downloaded some example code from internet.

                              It can show a beautiful form at Help > [BUTTON].

                              But I don't know how they made it.

                               

                              For my purpose, I gave up using SDK or FlashUI.

                              Just use a MessageBox() of Windows is OK.