ObjectARX, AutoCAD. Среда программирования библиотеки C++


         

This function must never reference


//

ads_hdlg mdlg;

int dcl_id, what_next;

static void CALLB

hide_handler(ads_callback_packet *cpkt)

{

ads_done_dialog(cpkt->dialog, 3);

}

static void CALLB

subdlg_handler(ads_callback_packet *cpkt)

{

// REMEMBER: This function must never reference anything in

// the cpkt packet because none of its fields are valid when

// it is called explicitly in the main dialog function.

//

ads_hdlg sdlg;

ads_new_dialog("subdlg", dcl_id, NULLCB, &sdlg);

ads_action_tile(sdlg, "hide_all", hide_handler);

ads_start_dialog(sdlg, &what_next1);

if (what_next1 == 3) // Nested hide is in progress. */

ads_done_dialog(mdlg, DLGSTATUS); // Hide main dialog box.

}

void

maindlg_handler()

{

int what_next;

ads_callback_packet dummy_pkt;

// dummy_pkt is used when this section of code explicitly calls the

// subdlg_handler() function. The subdlg_handler() function expects

// a single parameter that is a pointer to an ads_callback_packet.

// Normally a callback function is called by AutoCAD, and AutoCAD

// provides a filled-in packet, but in this code we need to call

// the callback function explicitly in order to redisplay the

// subdialog after a hide. In order to do this we need a dummy

// ads_callback_packet. It doesn’t have to be filled in because

// none of its fields is ever used.

//

ads_load_dialog("maindlg.dcl", &dcl_id);

what_next = what_next1 = 5; // could be set to anything > 1.

while (what_next >= DLGSTATUS) { //DLGSTATUS == 2.

ads_new_dialog("maindlg", dcl_id, NULLCB, &mdlg);

ads_action_tile(mdlg, "x", subdlg_handler);

if (what_next1 == 3) {

// This is only true on returning from a nested hide.

// Since we are returning from a nested hide,restart the

// subdialog.

// Note that the main dialog has NOT been started yet.

// It is just a bit map painted on screen (it needs an

// ads_start_dialog() for interactivity).

//

subdlg_handler(&dummy_pkt);

if (what_next1 != 3) {

// OK or CANCEL pressed to exit the subdialog

// so it is time to activate the main dialog that

// was painted but not started.

//

ads_start_dialog(mdlg, &what_next);

}

} else {

// this is executed only once upon startup of this whole

// dialog code.

//

ads_start_dialog(mdlg, &what_next);

}

if (what_next == DLGSTATUS) { /* DLGSTATUS == 2 */

// This if condition is true when a nested hide is

// in progress and both dialogs are hidden.

//

ads_getpoint(NULL, "\nPick a point: ", pick_pt);

}

}

ads_unload_dialog(dcl_id);

}


Содержание  Назад  Вперед