Using acedGetxxx() functions from a MFC modal dialog box in ObjectARX

By Balaji Ramamoorthy

When showing a modal dialog box, your plug-in may require the use of acedGetxxx() functions to accept user input.

Here are the steps to get user input from the button click of a modal dialog :

1) Derive your MFC dialog from one of the inbuilt ObjectARX MFC dialog classes such as CAcUiBaseDialog

2) Use the “BeginEditorCommand” and “CompleteEditorCommand” methods of the CAcUiBaseDialog class. As an example, when a button in the modal dialog is clicked, you may accept the point input as shown in the following code snippet from the button clicked handler :

void MyInputDlg::OnPickPointButtonClicked()

{

    // call the CAdUiBaseDialog derived method…

    BeginEditorCommand();

 

    // Accept input…

    ads_point pt ;

 

    acedGetPoint

    (

        NULL,

        ACRX_T("\nPick a point: "),

        pt

    );

 

    acutPrintf

    (

        ACRX_T("\nYou picked (%.2lf, %.2lf, %.2lf,)\n"),

        pt [X],

        pt [Y],

        pt [Z]

    ) ;

 

    // Restore the dialog

    CompleteEditorCommand();

}


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading