1 #include "studiox_includes.h"
2 #include "trigger_edit_dlg.h"
3 
4 // trigger_edit_dlg dialog
5 
6 enum trigger_edit_dlg_test_commands{
7     TEST_SET_TRIGGER_TYPE = 1,
8     TEST_SET_EVENT_TYPE,
9     TEST_SAVE_TRIGGER_EDIT,
10     TEST_CANCEL_TRIGGER_EDIT
11 };
12 
13 // Define trigger types
14 STRING_VAL_PAIR TriggerTypes[] = {
15     { _T("system_event"), TRIGGER_TYPE_SYSTEM_EVENT },
16     { _T("child_signal"), TRIGGER_TYPE_CHILD_SIGNAL },
17     { _T("user_event"), TRIGGER_TYPE_USER_EVENT },
18     { _T(""), 0 }
19 };
20 
21 // Define common system events
22 STRING_VAL_PAIR SystemEventTypes[] = {
23     { _T("GX_EVENT_SHOW"), GX_EVENT_SHOW },
24     { _T("GX_EVENT_HIDE"), GX_EVENT_HIDE },
25     { _T("GX_EVENT_FOCUS_GAINED"), GX_EVENT_FOCUS_GAINED },
26     { _T("GX_EVENT_FOCUS_LOST"), GX_EVENT_FOCUS_LOST },
27     { _T("GX_EVENT_ANIMATION_COMPLETE"), GX_EVENT_ANIMATION_COMPLETE },
28     { _T("GX_EVENT_PEN_DOWN"), GX_EVENT_PEN_DOWN },
29     { _T("GX_EVENT_PEN_DRAG"), GX_EVENT_PEN_DRAG },
30     { _T("GX_EVENT_PEN_UP"), GX_EVENT_PEN_UP },
31     { _T("GX_EVENT_KEY_DOWN"), GX_EVENT_KEY_DOWN },
32     { _T("GX_EVENT_KEY_UP"), GX_EVENT_KEY_UP },
33     { _T("GX_EVENT_CLOSE_POPUP"), GX_EVENT_CLOSE_POPUP },
34     { _T("GX_EVENT_LIST_SELECT"), GX_EVENT_LIST_SELECT },
35     { _T("GX_EVENT_HORIZONTAL_FLICK"), GX_EVENT_HORIZONTAL_FLICK },
36     { _T("GX_EVENT_VERTICAL_FLICK"), GX_EVENT_VERTICAL_FLICK},
37     { _T(""), 0 }
38 };
39 
40 STRING_VAL_PAIR SignalEventTypes[] = {
41     { _T("GX_EVENT_FOCUS_GAINED"), GX_EVENT_FOCUS_GAINED },
42     { _T("GX_EVENT_FOCUS_LOST"), GX_EVENT_FOCUS_LOST },
43     { _T("GX_EVENT_CLICKED"), GX_EVENT_CLICKED },
44     { _T("GX_EVENT_RADIO_SELECT"), GX_EVENT_RADIO_SELECT },
45     { _T("GX_EVENT_RADIO_DESELECT"), GX_EVENT_RADIO_DESELECT },
46     { _T("GX_EVENT_TOGGLE_ON"), GX_EVENT_TOGGLE_ON },
47     { _T("GX_EVENT_TOGGLE_OFF"), GX_EVENT_TOGGLE_OFF },
48     { _T("GX_EVENT_SELECT"), GX_EVENT_TOGGLE_OFF },
49     { _T("GX_EVENT_DESELECT"), GX_EVENT_DESELECT },
50     { _T("GX_EVENT_SLIDER_VALUE"), GX_EVENT_SLIDER_VALUE },
51     { _T("GX_EVENT_LIST_SELECT"), GX_EVENT_LIST_SELECT },
52     { _T("GX_EVENT_ANIMATION_COMPLETE"), GX_EVENT_ANIMATION_COMPLETE },
53     { _T("GX_EVENT_TEXT_EDITED"), GX_EVENT_TEXT_EDITED },
54     { _T("GX_EVENT_SPRITE_COMPLETE"), GX_EVENT_SPRITE_COMPLETE },
55     { _T(""), 0 }
56 };
57 
IMPLEMENT_DYNAMIC(trigger_edit_dlg,express_dialog)58 IMPLEMENT_DYNAMIC(trigger_edit_dlg, express_dialog)
59 
60 BEGIN_MESSAGE_MAP(trigger_edit_dlg, express_dialog)
61     ON_CBN_SELCHANGE(IDC_SYSTEM_EVENTS_COMBO, &trigger_edit_dlg::OnChangeSystemEvent)
62     ON_MESSAGE(STUDIO_TEST, &trigger_edit_dlg::OnTestMessage)
63 END_MESSAGE_MAP()
64 
65 ///////////////////////////////////////////////////////////////////////////////
66 trigger_edit_dlg::trigger_edit_dlg(int display_index, flow_item *item, trigger_info *trigger, CWnd* pParent /*=NULL*/)
67     : express_dialog(trigger_edit_dlg::IDD, pParent)
68 {
69     CString title;
70 
71     //set dialog icon
72     IconId = IDB_MACRO_PLAYBACK_ICON;
73 
74     //set dialog title
75     if (trigger->event_type)
76     {
77         title.Format(_T("Edit Trigger for [%s]"), item->screen_name);
78     }
79     else
80     {
81         title.Format(_T("Add Trigger for [%s]"), item->screen_name);
82     }
83     SetTitleText(title);
84     studiox_project *project = GetOpenProject();
85     widget_info *info = NULL;
86     if (project)
87     {
88         info = project->FindWidgetInfo(project->mDisplays[display_index].GetFirstChildFolder(), item->screen_name, FALSE);
89     }
90 
91     mDisplayIndex = display_index;
92     mpFlowItem = item;
93     mpTrigger = trigger;
94     mpInfo = info;
95 
96     mOldTrigger = *trigger;
97 }
98 
99 ///////////////////////////////////////////////////////////////////////////////
~trigger_edit_dlg()100 trigger_edit_dlg::~trigger_edit_dlg()
101 {
102 }
103 
104 ///////////////////////////////////////////////////////////////////////////////
GetTriggerType(CString type_name)105 int trigger_edit_dlg::GetTriggerType(CString type_name)
106 {
107     return FindPairVal(TriggerTypes, type_name);
108 }
109 
110 ///////////////////////////////////////////////////////////////////////////////
GetTriggerTypeName(int type)111 CString trigger_edit_dlg::GetTriggerTypeName(int type)
112 {
113     return FindPairString(TriggerTypes, type);
114 }
115 
116 ///////////////////////////////////////////////////////////////////////////////
GetEventType(CString type_name)117 int trigger_edit_dlg::GetEventType(CString type_name)
118 {
119     int type = FindPairVal(SystemEventTypes, type_name);
120 
121     if (!type)
122     {
123         type = FindPairVal(SignalEventTypes, type_name);
124     }
125 
126     return type;
127 }
128 
129 ///////////////////////////////////////////////////////////////////////////////
GetEventTypeName(int type)130 CString trigger_edit_dlg::GetEventTypeName(int type)
131 {
132     CString name = FindPairString(SystemEventTypes, type);
133 
134     if (name.IsEmpty())
135     {
136         name = FindPairString(SignalEventTypes, type);
137     }
138 
139     return name;
140 }
141 
142 ///////////////////////////////////////////////////////////////////////////////
OnInitDialog()143 BOOL trigger_edit_dlg::OnInitDialog()
144 {
145     express_dialog::OnInitDialog();
146 
147     CRect rect;
148     CRect size;
149 
150     AddCancelButton();
151     AddSaveButton();
152 
153     //SetWindowText(title_text);
154 
155     LONG system_event = 0, child_signal = 0;
156     switch (mpTrigger->trigger_type)
157     {
158     case TRIGGER_TYPE_CHILD_SIGNAL:
159         ((CButton *)GetDlgItem(IDC_CHILD_SIGNAL_RADIO))->SetCheck(TRUE);
160         child_signal = mpTrigger->event_type;
161         break;
162 
163     case TRIGGER_TYPE_USER_EVENT:
164         ((CButton *)GetDlgItem(IDC_USER_EVENT_RADIO))->SetCheck(TRUE);
165         mUserEventName.SetWindowText(mpTrigger->user_event_id_name);
166         break;
167 
168     case TRIGGER_TYPE_SYSTEM_EVENT:
169     default:
170         ((CButton *)GetDlgItem(IDC_SYSTEM_EVENT_RADIO))->SetCheck(TRUE);
171         system_event = mpTrigger->event_type;
172         break;
173     }
174 
175     AddComboList(&mSystemEventsCombo, SystemEventTypes, system_event);
176     AddChildSignals(mpTrigger->signal_id_name, child_signal);
177     AddAnimationIds(mpTrigger->system_event_animat_id_name);
178     EnableDisableAnimationIdsCombo();
179 
180     SetControlAccessibleName(mSystemEventsCombo.GetSafeHwnd(), _T("system_event_select"));
181     SetControlAccessibleName(mChildSignalsCombo.GetSafeHwnd(), _T("child_signal_select"));
182     SetControlAccessibleName(mUserEventName.GetSafeHwnd(), _T("user_event_name"));
183 
184     return TRUE;
185 }
186 
187 ///////////////////////////////////////////////////////////////////////////////
DoDataExchange(CDataExchange * pDX)188 void trigger_edit_dlg::DoDataExchange(CDataExchange* pDX)
189 {
190     express_dialog::DoDataExchange(pDX);
191     DDX_Control(pDX, IDC_SYSTEM_EVENTS_COMBO, mSystemEventsCombo);
192     DDX_Control(pDX, IDC_CHILD_SIGNALS_COMBO, mChildSignalsCombo);
193     DDX_Control(pDX, IDC_ANIMATION_IDS_COMBO, mAnimationIdsCombo);
194     DDX_Control(pDX, IDC_ANIMATION_IDS_LABEL, mAnimationIdsLabel);
195     DDX_Control(pDX, IDC_USER_EVENT_NAME, mUserEventName);
196 }
197 
198 ///////////////////////////////////////////////////////////////////////////////
OnOK()199 void trigger_edit_dlg::OnOK()
200 {
201     if (!SaveTriggerInfo())
202     {
203         return;
204     }
205 
206     if (!screen_flow::CheckAddTrigger(mpFlowItem, mpTrigger, this))
207     {
208         return;
209     }
210     express_dialog::OnOK();
211 }
212 
213 ///////////////////////////////////////////////////////////////////////////////
OnCancel()214 void trigger_edit_dlg::OnCancel()
215 {
216     mpTrigger->trigger_name = mOldTrigger.trigger_name;
217     mpTrigger->trigger_type = mOldTrigger.trigger_type;
218     mpTrigger->system_event_animat_id_name = mOldTrigger.system_event_animat_id_name;
219     mpTrigger->signal_id_name = mOldTrigger.signal_id_name;
220     mpTrigger->user_event_id_name = mOldTrigger.user_event_id_name;
221     mpTrigger->event_type = mOldTrigger.event_type;
222 
223     express_dialog::OnCancel();
224 }
225 
226 ///////////////////////////////////////////////////////////////////////////////
OnChangeSystemEvent()227 void trigger_edit_dlg::OnChangeSystemEvent()
228 {
229     EnableDisableAnimationIdsCombo();
230 }
231 
232 ///////////////////////////////////////////////////////////////////////////////
AddComboList(CComboBox * pBox,STRING_VAL_PAIR * list,LONG current_val)233 void trigger_edit_dlg::AddComboList(CComboBox *pBox, STRING_VAL_PAIR *list, LONG current_val)
234 {
235     STRING_VAL_PAIR *current = list;
236     int index;
237 
238     while (current->name.GetLength())
239     {
240         index = pBox->AddString(current->name);
241         pBox->SetItemData(index, current->val);
242         current++;
243     }
244 
245     pBox->InsertString(0, _T("None"));
246     SelectComboListItem(pBox, current_val);
247 }
248 
SelectComboListItem(CComboBox * box,LONG val)249 void trigger_edit_dlg::SelectComboListItem(CComboBox *box, LONG val)
250 {
251     int sel_index = 0;
252 
253     for (int box_index = 0; box_index < box->GetCount(); box_index++)
254     {
255         if (box->GetItemData(box_index) == val)
256         {
257             sel_index = box_index;
258             break;
259         }
260     }
261 
262     box->SetCurSel(sel_index);
263 }
264 
265 ///////////////////////////////////////////////////////////////////////////////
SelectComboListItem(CComboBox * box,CString string)266 void trigger_edit_dlg::SelectComboListItem(CComboBox *box, CString string)
267 {
268     CString get_string;
269     int sel_index = 0;
270 
271     for (int box_index = 0; box_index < box->GetCount(); box_index++)
272     {
273         box->GetLBText(box_index, get_string);
274         if(get_string == string)
275         {
276             sel_index = box_index;
277             break;
278         }
279     }
280 
281     box->SetCurSel(sel_index);
282 }
283 
284 ///////////////////////////////////////////////////////////////////////////////
AddChildSignals(CComboBox * pBox,CArray<CString> * pNameList,widget_info * child,CString signal_id_name,LONG current_val)285 void trigger_edit_dlg::AddChildSignals(CComboBox *pBox, CArray<CString> *pNameList, widget_info *child, CString signal_id_name, LONG current_val)
286 {
287 CArray<INT> event_list;
288 CString signal_string;
289 CString selected_string;
290 int event_type;
291 int pos;
292 
293     while (child)
294     {
295         if ((!child->id_name.IsEmpty()))
296         {
297             GetWidgetEventList(child, &event_list);
298 
299             if (!event_list.IsEmpty() && !IsItemInArray<CString>(*pNameList, child->id_name))
300             {
301                 for (int index = 0; index < event_list.GetCount(); index++)
302                 {
303                     event_type = event_list.GetAt(index);
304                     signal_string.Format(_T("(%s, %s)"), child->id_name, GetEventTypeName(event_type));
305                     pos = pBox->AddString(signal_string);
306                     pBox->SetItemData(pos, event_type);
307 
308                     if (child->id_name == signal_id_name &&
309                         event_type == current_val)
310                     {
311                         selected_string = signal_string;
312                     }
313                 }
314                 pNameList->Add(child->id_name);
315             }
316         }
317 
318         if (child->GetChildWidgetInfo())
319         {
320             AddChildSignals(pBox, pNameList, child->GetChildWidgetInfo(), signal_id_name, current_val);
321         }
322 
323         child = child->GetNextWidgetInfo();
324     }
325 
326     if (!selected_string.IsEmpty())
327     {
328         pBox->SelectString(0, selected_string);
329     }
330 }
331 
332 ///////////////////////////////////////////////////////////////////////////////
AddChildSignals(CString signal_id_name,LONG current_val)333 void trigger_edit_dlg::AddChildSignals(CString signal_id_name, LONG current_val)
334 {
335     mNameList.RemoveAll();
336     AddChildSignals(&mChildSignalsCombo, &mNameList, mpInfo->GetChildWidgetInfo(), signal_id_name, current_val);
337 
338     widget_info *base = mpInfo;
339     while (base && base->basetype == GX_TYPE_TEMPLATE)
340     {
341         base = template_service_provider::GetBaseInfo(base);
342         if (base)
343         {
344             AddChildSignals(&mChildSignalsCombo, &mNameList, base->GetChildWidgetInfo(), signal_id_name, current_val);
345         }
346     }
347 
348     mChildSignalsCombo.InsertString(0, _T("None"));
349 
350     int cursel = mChildSignalsCombo.GetCurSel();
351 
352     if (cursel < 0)
353     {
354         mChildSignalsCombo.SetCurSel(0);
355     }
356 }
357 
358 ///////////////////////////////////////////////////////////////////////////////
AddAnimationIds(CString selected_name)359 void trigger_edit_dlg::AddAnimationIds(CString selected_name)
360 {
361     studiox_project *project = GetOpenProject();
362     CString id_name;
363     INT id_index = 1;
364     INT index;
365 
366     while (1)
367     {
368         id_name = project->GetIdName(mDisplayIndex, ID_TYPE_ANIMATION, id_index++);
369         if (id_name.IsEmpty())
370         {
371             break;
372         }
373         else
374         {
375             index = mAnimationIdsCombo.AddString(id_name);
376             mAnimationIdsCombo.SetItemData(index, id_index);
377         }
378     }
379 
380     mAnimationIdsCombo.InsertString(0, _T("None"));
381     if (selected_name.IsEmpty())
382     {
383         mAnimationIdsCombo.SetCurSel(0);
384     }
385     else
386     {
387         mAnimationIdsCombo.SelectString(0, selected_name);
388     }
389 }
390 
391 ///////////////////////////////////////////////////////////////////////////////
EnableDisableAnimationIdsCombo()392 void trigger_edit_dlg::EnableDisableAnimationIdsCombo()
393 {
394     int cur_sel = mSystemEventsCombo.GetCurSel();
395     int event_type = mSystemEventsCombo.GetItemData(cur_sel);
396     BOOL enable;
397 
398     if (event_type == GX_EVENT_ANIMATION_COMPLETE)
399     {
400         enable = TRUE;
401     }
402     else
403     {
404         enable = FALSE;
405     }
406 
407     mAnimationIdsCombo.EnableWindow(enable);
408     mAnimationIdsLabel.EnableWindow(enable);
409 }
410 
411 ///////////////////////////////////////////////////////////////////////////////
GetWidgetEventList(widget_info * info,CArray<INT> * list)412 void trigger_edit_dlg::GetWidgetEventList(widget_info *info, CArray<INT> *list)
413 {
414     list->RemoveAll();
415 
416     if (!(info->style & GX_STYLE_ENABLED))
417     {
418         return;
419     }
420 
421     list->Add(GX_EVENT_FOCUS_GAINED);
422     list->Add(GX_EVENT_FOCUS_LOST);
423 
424     switch (info->basetype)
425     {
426     case GX_TYPE_BUTTON:
427     case GX_TYPE_TEXT_BUTTON:
428     case GX_TYPE_MULTI_LINE_TEXT_BUTTON:
429     case GX_TYPE_PIXELMAP_BUTTON:
430     case GX_TYPE_ICON_BUTTON:
431         if (info->style & GX_STYLE_BUTTON_TOGGLE)
432         {
433             list->Add(GX_EVENT_TOGGLE_ON);
434             list->Add(GX_EVENT_TOGGLE_OFF);
435         }
436         else
437         {
438             list->Add(GX_EVENT_CLICKED);
439         }
440         break;
441 
442     case GX_TYPE_RADIO_BUTTON:
443         list->Add(GX_EVENT_RADIO_SELECT);
444         list->Add(GX_EVENT_RADIO_DESELECT);
445         break;
446 
447     case GX_TYPE_CHECKBOX:
448         list->Add(GX_EVENT_TOGGLE_ON);
449         list->Add(GX_EVENT_TOGGLE_OFF);
450         break;
451 
452     case GX_TYPE_SLIDER:
453     case GX_TYPE_PIXELMAP_SLIDER:
454         list->Add(GX_EVENT_SLIDER_VALUE);
455         break;
456 
457     case GX_TYPE_DROP_LIST:
458     case GX_TYPE_VERTICAL_LIST:
459     case GX_TYPE_HORIZONTAL_LIST:
460         list->Add(GX_EVENT_LIST_SELECT);
461         break;
462 
463     case GX_TYPE_CIRCULAR_GAUGE:
464         list->Add(GX_EVENT_ANIMATION_COMPLETE);
465         break;
466 
467     case GX_TYPE_MULTI_LINE_TEXT_INPUT:
468     case GX_TYPE_SINGLE_LINE_TEXT_INPUT:
469         list->Add(GX_EVENT_TEXT_EDITED);
470         break;
471 
472     case GX_TYPE_SPRITE:
473         list->Add(GX_EVENT_SPRITE_COMPLETE);
474         break;
475 
476     default:
477         list->Add(GX_EVENT_CLICKED);
478         break;
479     }
480 }
481 
SaveEventType()482 BOOL trigger_edit_dlg::SaveEventType()
483 {
484     CButton *radio = ((CButton *)GetDlgItem(IDC_SYSTEM_EVENT_RADIO));
485 
486     if (radio->GetCheck() == TRUE)
487     {
488         mpTrigger->trigger_type = TRIGGER_TYPE_SYSTEM_EVENT;
489     }
490     else
491     {
492         radio = ((CButton *)GetDlgItem(IDC_CHILD_SIGNAL_RADIO));
493 
494         if (radio->GetCheck() == TRUE)
495         {
496             mpTrigger->trigger_type = TRIGGER_TYPE_CHILD_SIGNAL;
497         }
498         else
499         {
500             mpTrigger->trigger_type = TRIGGER_TYPE_USER_EVENT;
501         }
502     }
503 
504     int index;
505     CString string;
506 
507     switch (mpTrigger->trigger_type)
508     {
509     case TRIGGER_TYPE_SYSTEM_EVENT:
510         index = mSystemEventsCombo.GetCurSel();
511         mpTrigger->event_type = mSystemEventsCombo.GetItemData(index);
512         if (!mpTrigger->event_type)
513         {
514             ErrorMsg("Please set event type!", this);
515             return FALSE;
516         }
517 
518         mSystemEventsCombo.GetLBText(index, string);
519         mpTrigger->trigger_name.Format(_T("ON_%s"), string);
520 
521         if (mpTrigger->event_type == GX_EVENT_ANIMATION_COMPLETE)
522         {
523             index = mAnimationIdsCombo.GetCurSel();
524             if (index)
525             {
526                 mAnimationIdsCombo.GetWindowText(mpTrigger->system_event_animat_id_name);
527                 mpTrigger->trigger_name.Format(_T("ON_%s(%s)"), string, mpTrigger->system_event_animat_id_name);
528             }
529         }
530         break;
531 
532     case TRIGGER_TYPE_CHILD_SIGNAL:
533         index = mChildSignalsCombo.GetCurSel();
534         mpTrigger->event_type = mChildSignalsCombo.GetItemData(index);
535         if (!mpTrigger->event_type)
536         {
537             ErrorMsg("Please set event type!", this);
538             return FALSE;
539         }
540 
541         mChildSignalsCombo.GetLBText(index, string);
542         mpTrigger->trigger_name.Format(_T("ON_GX_SIGNAL%s"), string);
543 
544         //Get signal id name
545         index = string.Find('(');
546         string = string.Mid(index+1);
547         index = string.Find(',');
548         string = string.Left(index);
549         mpTrigger->signal_id_name = string;
550         break;
551 
552     case TRIGGER_TYPE_USER_EVENT:
553         string = mpTrigger->user_event_id_name;
554         if (TestInputName(&mUserEventName, "User Event", mpTrigger->user_event_id_name, this))
555         {
556             mpTrigger->event_type = GX_FIRST_USER_EVENT;
557             mpTrigger->trigger_name.Format(_T("ON_%s"), mpTrigger->user_event_id_name);
558         }
559         else
560         {
561             return FALSE;
562         }
563 
564         break;
565     }
566 
567     mpTrigger->trigger_name.MakeLower();
568     return TRUE;
569 }
570 
SaveTriggerInfo()571 BOOL trigger_edit_dlg::SaveTriggerInfo()
572 {
573     if (!SaveEventType())
574     {
575         return FALSE;
576     }
577 
578     return TRUE;
579 }
580 
581 ///////////////////////////////////////////////////////////////////////////////
OnTestMessage(WPARAM wParam,LPARAM lParam)582 LRESULT trigger_edit_dlg::OnTestMessage(WPARAM wParam, LPARAM lParam)
583 {
584     int ctrl_id;
585     CWnd *pWnd;
586     CString str;
587     CStringArray param_list;
588 
589     switch(wParam)
590     {
591     case TEST_SET_TRIGGER_TYPE:
592         switch (lParam)
593         {
594         case TRIGGER_TYPE_SYSTEM_EVENT:
595             ctrl_id = IDC_SYSTEM_EVENT_RADIO;
596             break;
597 
598         case TRIGGER_TYPE_CHILD_SIGNAL:
599             ctrl_id = IDC_CHILD_SIGNAL_RADIO;
600             break;
601 
602         case TRIGGER_TYPE_USER_EVENT:
603             ctrl_id = IDC_USER_EVENT_RADIO;
604             break;
605         }
606         CheckRadioButton(IDC_SYSTEM_EVENT_RADIO, IDC_USER_EVENT_RADIO, ctrl_id);
607         break;
608 
609     case TEST_SET_EVENT_TYPE:
610         pWnd = (GetDlgItem(IDC_SYSTEM_EVENT_RADIO));
611         str = GetTestingParam(0);
612         if (((CButton *)pWnd)->GetCheck() == TRUE)
613         {
614             mSystemEventsCombo.SelectString(0, str);
615             SendMessage(WM_COMMAND, MAKEWPARAM(IDC_SYSTEM_EVENTS_COMBO, CBN_SELCHANGE), (LPARAM)mSystemEventsCombo.m_hWnd);
616         }
617         else
618         {
619             pWnd = GetDlgItem(IDC_CHILD_SIGNAL_RADIO);
620 
621             if (((CButton *)pWnd)->GetCheck() == TRUE)
622             {
623                 mChildSignalsCombo.SelectString(0, str);
624                 SendMessage(WM_COMMAND, MAKEWPARAM(IDC_CHILD_SIGNALS_COMBO, CBN_SELCHANGE), (LPARAM)mChildSignalsCombo.m_hWnd);
625             }
626             else
627             {
628                 mUserEventName.SetWindowText(str);
629                 SendMessage(WM_COMMAND, MAKEWPARAM(IDC_USER_EVENT_NAME, EN_KILLFOCUS), (LPARAM)mUserEventName.m_hWnd);
630             }
631         }
632         break;
633 
634     case TEST_SAVE_TRIGGER_EDIT:
635         OnOK();
636         break;
637 
638     case TEST_CANCEL_TRIGGER_EDIT:
639         OnCancel();
640         break;
641     }
642 
643     return 0;
644 }