Changeset 419 for ConfirmationDialog
- Timestamp:
- Sep 12, 2012, 7:50:33 AM (12 years ago)
- Location:
- ConfirmationDialog
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ConfirmationDialog/UConfirmationForm.lfm
r403 r419 10 10 OnDestroy = FormDestroy 11 11 Position = poMainFormCenter 12 LCLVersion = ' 0.9.30'12 LCLVersion = '1.1' 13 13 object LabelDescription: TLabel 14 14 Left = 56 … … 25 25 Height = 17 26 26 Top = 88 27 Width = 1 4127 Width = 139 28 28 Anchors = [akLeft, akBottom] 29 29 Caption = 'Do same action next time' -
ConfirmationDialog/UConfirmationForm.pas
r403 r419 13 13 14 14 TConfirmMessage = class 15 Index: Integer;15 SysName: string; 16 16 Enabled: Boolean; 17 17 Title: string; … … 27 27 public 28 28 constructor Create; override; 29 function AddItem( Index: Integer; Title, Text: string; Buttons: TMsgDlgButtons;29 function AddItem(SysName: string; Title, Text: string; Buttons: TMsgDlgButtons; 30 30 DefaultAction: TModalResult = mrNone): TConfirmMessage; 31 31 procedure Register(Message: TConfirmMessage); … … 33 33 procedure LoadFromRegistry(Context: TRegistryContext); 34 34 procedure SaveToRegistry(Context: TRegistryContext); 35 function SearchBy Index(Index: Integer): TConfirmMessage;35 function SearchByName(Name: string): TConfirmMessage; 36 36 end; 37 37 … … 68 68 SCancel = 'Cancel'; 69 69 SOk = 'Ok'; 70 SAbort = 'Abort'; 71 SRetry = 'Retry'; 72 SIgnore = 'Ignore'; 73 SClose = 'Close'; 70 74 SConfirmMessageNotFound = 'Confirm message id %s not found'; 71 75 … … 85 89 var 86 90 RightPos: Integer; 87 I: Integer;88 91 const 89 92 Space = 10; … … 135 138 end; 136 139 137 function TConfirmMessageList.AddItem( Index: Integer; Title, Text: string;140 function TConfirmMessageList.AddItem(SysName: string; Title, Text: string; 138 141 Buttons: TMsgDlgButtons; DefaultAction: TModalResult = mrNone): TConfirmMessage; 139 142 var … … 141 144 begin 142 145 NewMessage := TConfirmMessage.Create; 143 NewMessage. Index := Index;146 NewMessage.SysName := SysName; 144 147 NewMessage.Title := Title; 145 148 NewMessage.Text := Text; … … 171 174 with TConfirmMessage(Items[I]) do 172 175 begin 173 OpenKey(Context.Key + '\' + IntToStr(Index), True);176 OpenKey(Context.Key + '\' + SysName, True); 174 177 Enabled := ReadBoolWithDefault('Enabled', Enabled); 175 178 DefaultAction := ReadIntegerWithDefault('DefaultAction', DefaultAction); … … 190 193 with TConfirmMessage(Items[I]) do 191 194 begin 192 OpenKey(Context.Key + '\' + IntToStr(Index), True);195 OpenKey(Context.Key + '\' + SysName, True); 193 196 WriteBool('Enabled', Enabled); 194 197 WriteInteger('DefaultAction', DefaultAction); … … 199 202 end; 200 203 201 function TConfirmMessageList.SearchBy Index(Index: Integer): TConfirmMessage;204 function TConfirmMessageList.SearchByName(Name: string): TConfirmMessage; 202 205 var 203 206 I: Integer; 204 207 begin 205 208 I := 0; 206 while (I < Count) and (TConfirmMessage(Items[I]). Index <> Index) do Inc(I);209 while (I < Count) and (TConfirmMessage(Items[I]).SysName <> Name) do Inc(I); 207 210 if I < Count then Result := TConfirmMessage(Items[I]) 208 211 else Result := nil; … … 217 220 else if DefaultAction = mrNo then Result := SNo 218 221 else if DefaultAction = mrCancel then Result := SCancel 219 else if DefaultAction = mrOK then Result := SOk; 222 else if DefaultAction = mrOK then Result := SOk 223 else if DefaultAction = mrAbort then Result := SAbort 224 else if DefaultAction = mrRetry then Result := SRetry 225 else if DefaultAction = mrIgnore then Result := SIgnore 226 else if DefaultAction = mrClose then Result := SClose; 220 227 end; 221 228
Note:
See TracChangeset
for help on using the changeset viewer.