EtsT_Pj_Scenarios_Manage_Event_Callback

Note: Requires OPNET Development Kit

Abstract

Callback: Called when the OK or Cancel button is clicked in the specified Manage Scenarios dialog box.

Syntax

<scenarios_manage_event_callback_name> (handle, event_type, client_data, event_data)
Argument Type Description
handle EtsT_Pj_Scenarios_Manage_Handle The Manage Scenarios dialog box of interest.
event_type EtsT_Pj_Scenarios_Manage_Event Type of event the callback was invoked to handle; one of the constants in Table 36 (see event_type).
client_data void * User-specified state information registered with the callback.
event_data void * Event-specific data (see event_data)

Return Type

EtsT_Pj_Scenarios_Manage_Event_Result

Result of the callback processing (see Details).

ets_api_pj.h

Example

EtsT_Pj_Scenarios_Manage_Event_Result
manage_event_proc (EtsT_Pj_Scenarios_Manage_Handle manage_hndl,
	EtsT_Pj_Scenarios_Manage_Event event_type,
	void *client_data, void *event_data)
	{
	EtsT_Pj_Scenarios_Manage_Event_Result										  result =
		EtsC_Pj_Scenarios_Manage_Event_Result_Continue;
	PrgT_List									*table_info_lptr;
	EtsT_Pj_Scenarios_Manage_Table_Info									*table_info_ptr;
	int  inx, table_row_num;
	FIN (manage_event_proc);

	switch (event_type)
		{
		case EtsC_Pj_Scenarios_Manage_Event_Ok_Begin:
			printf ("OK Begin event...\n");
			table_info_lptr = Ets_Pj_Scenarios_Manage_Table_Info_Get (manage_hndl);
			table_row_num = prg_list_size (table_info_lptr);
			for (inx = 0; inx < table_row_num; inx++)
				{
				table_info_ptr = prg_list_access (table_info_lptr, inx);

				printf ("Table row %i, scenario <%s> ...\n", inx,
					table_info_ptr->name);

				if (table_info_ptr->flags & ETSC_PJ_SCENARIOS_MANAGE_INFO_NEW)
					printf ("This is a new scenario.\n");
				if (table_info_ptr->flags & ETSC_PJ_SCENARIOS_MANAGE_INFO_DELETE)
					printf ("This scenario will be deleted.\n");
				if (table_info_ptr->flags & ETSC_PJ_SCENARIOS_MANAGE_INFO_RENAME)
					printf ("This scenario was renamed from <%s>\n",
					table_info_ptr->orig_name);
				if (table_info_ptr->duplicate)
					printf ("This scenario will be a duplicate of <%s>\n",
					table_info_ptr->duplicate);

				Ets_Pj_Scenarios_Manage_Table_Info_Destroy (table_info_ptr);
				}
			prg_list_destroy (table_info_lptr, PRGC_FALSE);
			break;
		case EtsC_Pj_Scenarios_Manage_Event_Ok_End:
			printf ("OK End event...\n");
			break;
		case EtsC_Pj_Scenarios_Manage_Event_Cancel:
			printf ("Cancel event...\n");
			break;
		case EtsC_Pj_Scenarios_Manage_Event_Collect:
			printf ("Collect event...\n");
			break;
		case EtsC_Pj_Scenarios_Manage_Event_Discard:
			printf ("Discard event...\n");
			break;
		default:
			printf ("*** Unknown manage event ***\n");
		}

	FRET (result);
	}

Details

This callback should handle the OK and Cancel buttons, as well as any custom or system buttons specified for the Manage Scenarios dialog box.

event_type

The various values for event_type have the following meanings:

  • EtsC_Pj_Scenarios_Manage_Event_Cancel—the user clicked the Cancel button
  • EtsC_Pj_Scenarios_Manage_Event_Ok_Begin—the user clicked the OK button and the Core has not yet performed any actions When handling this event type, the callback can retrieve information about what actions will be taken for each scenario by calling Ets_Pj_Scenarios_Manage_Table_Info_Get() on handle.
  • EtsC_Pj_Scenarios_Manage_Event_Ok_End—the user clicked the OK button and the Core has completed all required actions
  • EtsC_Pj_Scenarios_Manage_Event_Collect—the user has chosen to collect simulation results for one or more scenarios
  • EtsC_Pj_Scenarios_Manage_Event_Discard—the user has chosen to discard simulation results for one or more scenarios

event_data

The value of event_data depends the following:

  • OK_Begin, OK_End, and Cancel events—OPC_NIL
  • Collect and Discard events—name of the scenario (data type is char *)

This callback should return one of the following values:

  • EtsC_Pj_Scenarios_Manage_Event_Result_Handled—the callback has done any necessary processing for the event and the Core should take no actions for this event
  • EtsC_Pj_Scenarios_Manage_Event_Result_Continue—the callback has completed its processing and the Core should continue with any necessary processing for this event

The callback is registered by Ets_Pj_Scenarios_Manage() and Ets_Pj_Scenarios_Manage_Event_Callback_Register().

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com