1 #include "frmContactEditor.h"
3 bool frmContactEditor::ProcessEvent(wxEvent& event)
6 // This section has been taken from the wxWidgets sample code of richtext.cpp
7 // so that simple Cut/Copy/Paste code can be made.
9 // As this code comes from the samples of the wxWidgets library, this is licenced
10 // under the wxWindows Library Licence and is compatable with the LGPL and is
11 // compatable with Xestia Address Book's licence.
13 if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxChildFocusEvent)))
15 // Problem: we can get infinite recursion because the events
16 // climb back up to this frame, and repeat.
17 // Assume that command events don't cause another command event
18 // to be called, so we can rely on inCommand not being overwritten
20 static int s_eventType = 0;
21 static wxWindowID s_id = 0;
23 if (s_id != event.GetId() && s_eventType != event.GetEventType())
25 s_eventType = event.GetEventType();
28 wxWindow* focusWin = wxFindFocusDescendant(this);
29 if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event))
45 return wxFrame::ProcessEvent(event);
48 void frmContactEditor::UpdateDisplayAs( wxCommandEvent &event ){
50 // Generate a drop down list of common names to use for the display as drop down box.
52 wxString SetValue = cmbDisplayAs->GetValue();
54 cmbDisplayAs->Clear();
55 cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
56 if (!txtOtherNames->GetValue().IsEmpty()){
58 cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue() + wxT(" ") + txtForename->GetValue());
61 cmbDisplayAs->Append(txtSurname->GetValue() + wxT(", ") + txtForename->GetValue());
62 if (!txtOtherNames->GetValue().IsEmpty()){
64 cmbDisplayAs->Append(txtForename->GetValue() + wxT(", ") + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue());
67 if (!txtTitle->GetValue().IsEmpty()){
68 cmbDisplayAs->Append(txtTitle->GetValue() + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
71 cmbDisplayAs->SetValue(SetValue);
73 this->SetTitle(cmbDisplayAs->GetValue());
77 void frmContactEditor::UpdateName( wxCommandEvent &event ){
79 this->SetTitle(cmbDisplayAs->GetValue());
81 WindowData *WData = new WindowData;
84 WData->WindowPointer = this;
85 WData->WindowID = ContactEditorUID;
87 wxCommandEvent editevent(WINDOW_EDIT);
88 editevent.SetClientData(WData);
89 wxPostEvent(GetParent(), editevent);