Procedure

TfrmDefaultEvent.btnOKClick

Module

fDefaultEvent

Last Modified

7/15/2014 3:26:36 PM

Visibility

Public/Published

Owner

TfrmDefaultEvent

Declaration

procedure btnOKClick(Sender: TObject);

Calls Hierarchy


TfrmDefaultEvent.btnOKClick
 └SetDefaultEvent

Calls

Name Declaration Comments
SetDefaultEvent function SetDefaultEvent(var AErrMsg: string; EvtID: string): Boolean; -


Source

86    procedure TfrmDefaultEvent.btnOKClick(Sender: TObject);
87    const
88      TXT_1 = 'Would you like to change the default event from "';
89      TXT_2 = '" to "';
90      TXT_3 = 'Would you like set your default event to "';
91    var
92      errMsg: string;
93    begin
94      if cboEvents.ItemIndex < 0 then
95      begin
96        ShowMsg('You have to select an event first!');
97        Exit;
98      end;
99      if (Piece(cboEvents.Items[cboEvents.ItemIndex],'^',1) <> FPreDefaultEvtID) and ( Length(FPreDefaultEvtID)>0 )then
100     begin
101       if InfoBox(TXT_1 + FPreDefaultEvtName + TXT_2 + cboEvents.Text + '"?','Warning', MB_OKCANCEL or MB_ICONWARNING) = IDOK then
102       begin
103         errMsg := '';
104         SetDefaultEvent(errMsg, Piece(cboEvents.Items[cboEvents.ItemIndex],'^',1));
105         if length(errMsg)>0 then
106           ShowMsg(errMsg)
107         else
108           ShowMsg('The default release event "' + cboEvents.Text + '" has been set successfully!');
109         FDefaultEvtName := cboEvents.Text;
110         OKPressed := True;
111         Close;
112       end;
113     end
114     else if (Piece(cboEvents.Items[cboEvents.ItemIndex],'^',1) <> FPreDefaultEvtID) and ( Length(FPreDefaultEvtID)=0 )then
115     begin
116       if InfoBox(TXT_3 + cboEvents.Text + '"?','Warning', MB_OKCANCEL or MB_ICONWARNING) = IDOK then
117       begin
118         errMsg := '';
119         SetDefaultEvent(errMsg, Piece(cboEvents.Items[cboEvents.ItemIndex],'^',1));
120         if length(errMsg)>0 then
121           ShowMsg(errMsg)
122         else
123           ShowMsg('The default release event "' + cboEvents.Text + '" has been set successfully!');
124        FDefaultEvtName := cboEvents.Text;
125        OKPressed := True;
126        Close;
127       end;
128     end;
129   end;