Showing results for 
Search instead for 
Do you mean 
Reply

How to abort cancel_cb operation of block styler dialog

Hello, in cancel callback function cancel_cb I have to perform a check and if check is not successful the cancel operation should be aborted so that dialog is still shown, how to abort cancel operation?

4 REPLIES

Re: How to abort cancel_cb operation of block styler dialog

It is impossible to abort cancel using BlockStyler in NXOpen.

 

Generally, check should be made on ok/apply button.

 

Elias.

Re: How to abort cancel_cb operation of block styler dialog

Hi

 

i have a case where the certain features are created in the part and i do a SaveAs in apply_cb

Later i need to open the original part file for the user

i did this through Main() -works fine if the user clicks OK/Apply, but the problem is this re-opening happens even if CANCEL button is pressed (which is not required).

 

I cannot close the part and reopen in apply_cb as the GUI is open (so it gives and error if i try to open the close part).

 

Is there any way to check in Main() if cancel_cb was pressed from the dialog?

 

Thanks,

Vipin

 

Re: How to abort cancel_cb operation of block styler dialog

RE: How to pass exit status back to main():

 

I did this in C/C++

1) In dialog's .hpp file, change the definition of the "Show" function:

    // following changed, KGA
    Selection::Response Show();

 

2) In dialog's .cpp file, make similar changes:

    Selection::Response Your_Dialog_Class_Dlg::Show()
{
	Selection::Response kga_response;
    try
    {
        kga_response = theDialog->Show();
    }
    catch(exception& ex)
    {
        //---- Enter your exception handling code here -----
		Create_Mfg_Assy_Dlg::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
    }
    return kga_response;
}

(actually, in looking at the above code, I need to supply a default value, so the "catch" block returns a valid value)

 

3) in "main()":

		Selection::Response status = myDialog->Show();
		//ECHO_DEBUG("Dialog Return Status = %d\n", status);

		if (Selection::ResponseOk != status)
		{
			UF_print_syslog("\n\n===================  User cancelled dialog ==============\n", FALSE);
			UF_terminate();
			return;
		}

You may need to swap in something else for "UF_terminate()" depending on how you initialzed it.

 

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: How to abort cancel_cb operation of block styler dialog

Create a global Boolean variable, like CancelPressedFlag, with a default value of false.

In the cancel callback set this variable to true.

When you open the previous part do this only if the variable is true and reset it to false before you open the part.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community