cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

OTK C++ - Creation of Dialog fails the second time

SOLVED
Newbie

OTK C++ - Creation of Dialog fails the second time

I try to create a simple dialog, which will be closed by pressing the Cancel-Button.

The first time the dialog is started, everything works correct.

uifcCreateDialog, uifcActivateDialog, uifcExitDialog and uifcDestroyDialog return 0 and

no exception is thrown.

But starting the dialog the second time fails. Calling uifcCreateDialog returns -1 and the

dialog is not created. For some hints I would be grateful.

Thanks in advance.

 

Versions:

Creo Parametric 3.0 - 64 bit

Windows 7 64 Bit

C++ Object Toolkit

1 ACCEPTED SOLUTION

Accepted Solutions

Re: OTK C++ - Creation of Dialog fails the second time

The second parameter of uifcCreateDialog is the resource. I tried to use a relative or absolute path to this file, which results in this strange behaviour. Copying the file to the right place and using only the name without extension solved the problem for me.

3 REPLIES 3

Re: OTK C++ - Creation of Dialog fails the second time

The second parameter of uifcCreateDialog is the resource. I tried to use a relative or absolute path to this file, which results in this strange behaviour. Copying the file to the right place and using only the name without extension solved the problem for me.

Re: OTK C++ - Creation of Dialog fails the second time

Does this mean that it did not work with a subdirectory? I'm experiencing a similar issue now, and have my resource file located in a subdirectory from the "text/resource" folder.

President & Founder
CadActive Technologies - www.cadactive.com
Highlighted

Re: OTK C++ - Creation of Dialog fails the second time

The following works (for me, and should work with all Creo versions at least up to 5.0):

Dialog resource file (name and location relevant!):

<protk.dat text_dir>\resource\my_dialog.res

In the my_dialog.res, the dialog name must match the file name without extension:

! Resource file for my_dialog
(Dialog my_dialog
    (Components
...
    )
...
)

The Pro/TOOLKIT C/C++ code creating and destroying the dialog:

#define  MY_DIALOG_NAME "my_dialog"
int iDlgExitStatus = -1;
pErr = ProUIDialogCreate(MY_DIALOG_NAME, MY_DIALOG_NAME);
// Setup the dialog and callbacks, activating the dialog, etc. ...
pErr = ProUIDialogCloseActionSet(MY_DIALOG_NAME, MyDlg_Act_Cancel, NULL);
pErr = ProUIDialogActivate(MY_DIALOG_NAME, &iDlgExitStatus);
pErr = ProUIDialogDestroy(MY_DIALOG_NAME);

// Callback function for simple closing action
static void MyDlg_Act_Cancel(char* cDialog, char* cComponent, ProAppData pAppData){
ProError            pErr = PRO_TK_NO_ERROR;        //    Creo return value
    pErr = ProUIDialogExit(cDialog, PRO_TK_USER_ABORT);
        if ( pErr != PRO_TK_NO_ERROR ) {
            //    Error handling...
        }
    return;
}

(Even if this answer may be too late for the OP, others could benefit from it.)