mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-06 11:40:35 +01:00
Move ModalResult string representation array from PropEdit to Controls to be used by other code
git-svn-id: trunk@39426 -
This commit is contained in:
parent
cdf3ea5a11
commit
614327b055
@ -231,17 +231,17 @@ begin
|
||||
Editor := TStringGrid(Sender).EditorByStyle(cbsPickList);
|
||||
TPickListCellEditor(Editor).Style := csDropDownList;
|
||||
TPickListCellEditor(Editor).Clear;
|
||||
TPickListCellEditor(Editor).Items.Add('mrNone');
|
||||
TPickListCellEditor(Editor).Items.Add('mrOK');
|
||||
TPickListCellEditor(Editor).Items.Add('mrCancel');
|
||||
TPickListCellEditor(Editor).Items.Add('mrAbort');
|
||||
TPickListCellEditor(Editor).Items.Add('mrRetry');
|
||||
TPickListCellEditor(Editor).Items.Add('mrIgnore');
|
||||
TPickListCellEditor(Editor).Items.Add('mrYes');
|
||||
TPickListCellEditor(Editor).Items.Add('mrNo');
|
||||
TPickListCellEditor(Editor).Items.Add('mrAll');
|
||||
TPickListCellEditor(Editor).Items.Add('mrNoToAll');
|
||||
TPickListCellEditor(Editor).Items.Add('mrYesToAll');
|
||||
TPickListCellEditor(Editor).Items.Add(ModalResultStr[mrNone]);
|
||||
TPickListCellEditor(Editor).Items.Add(ModalResultStr[mrOK]);
|
||||
TPickListCellEditor(Editor).Items.Add(ModalResultStr[mrCancel]);
|
||||
TPickListCellEditor(Editor).Items.Add(ModalResultStr[mrAbort]);
|
||||
TPickListCellEditor(Editor).Items.Add(ModalResultStr[mrRetry]);
|
||||
TPickListCellEditor(Editor).Items.Add(ModalResultStr[mrIgnore]);
|
||||
TPickListCellEditor(Editor).Items.Add(ModalResultStr[mrYes]);
|
||||
TPickListCellEditor(Editor).Items.Add(ModalResultStr[mrNo]);
|
||||
TPickListCellEditor(Editor).Items.Add(ModalResultStr[mrAll]);
|
||||
TPickListCellEditor(Editor).Items.Add(ModalResultStr[mrNoToAll]);
|
||||
TPickListCellEditor(Editor).Items.Add(ModalResultStr[mrYesToAll]);
|
||||
end;
|
||||
8: begin
|
||||
Editor := TStringGrid(Sender).EditorByStyle(cbsAuto);
|
||||
@ -666,28 +666,28 @@ begin
|
||||
for indx := 0 to ButtonsCheckGroup.Items.Count-1 do
|
||||
if ButtonsCheckGroup.Checked[indx] then begin
|
||||
if ButtonsCheckGroup.Items[indx] = 'mbOK' then
|
||||
ListResult.Add('mrOK');
|
||||
ListResult.Add(ModalResultStr[mrOK]);
|
||||
if ButtonsCheckGroup.Items[indx] = 'mbCancel' then
|
||||
ListResult.Add('mrCancel');
|
||||
ListResult.Add(ModalResultStr[mrCancel]);
|
||||
if ButtonsCheckGroup.Items[indx] = 'mbYes' then
|
||||
ListResult.Add('mrYes');
|
||||
ListResult.Add(ModalResultStr[mrYes]);
|
||||
if ButtonsCheckGroup.Items[indx] = 'mbNo' then
|
||||
ListResult.Add('mrNo');
|
||||
ListResult.Add(ModalResultStr[mrNo]);
|
||||
if ButtonsCheckGroup.Items[indx] = 'mbAbort' then
|
||||
ListResult.Add('mrAbort');
|
||||
ListResult.Add(ModalResultStr[mrAbort]);
|
||||
if ButtonsCheckGroup.Items[indx] = 'mbRetry' then
|
||||
ListResult.Add('mrRetry');
|
||||
ListResult.Add(ModalResultStr[mrRetry]);
|
||||
if ButtonsCheckGroup.Items[indx] = 'mbIgnore' then
|
||||
ListResult.Add('mrIgnore');
|
||||
ListResult.Add(ModalResultStr[mrIgnore]);
|
||||
if ButtonsCheckGroup.Items[indx] = 'mbAll' then
|
||||
ListResult.Add('mrAll');
|
||||
ListResult.Add(ModalResultStr[mrAll]);
|
||||
if ButtonsCheckGroup.Items[indx] = 'mbNoToAll' then
|
||||
ListResult.Add('mrNoToAll');
|
||||
ListResult.Add(ModalResultStr[mrNoToAll]);
|
||||
if ButtonsCheckGroup.Items[indx] = 'mbYesToAll' then
|
||||
ListResult.Add('mrYesToAll');
|
||||
ListResult.Add(ModalResultStr[mrYesToAll]);
|
||||
if (ButtonsCheckGroup.Items[indx] = 'mbClose')and
|
||||
(ListResult.IndexOf('mrCancel') = -1) then
|
||||
ListResult.Add('mrCancel');
|
||||
(ListResult.IndexOf(ModalResultStr[mrCancel]) = -1) then
|
||||
ListResult.Add(ModalResultStr[mrCancel]);
|
||||
end;
|
||||
if ListResult.Text<>IfResultComboBox.Items.Text then begin
|
||||
IfResultComboBox.Items := ListResult;
|
||||
|
||||
@ -4458,21 +4458,6 @@ end;
|
||||
|
||||
{ TModalResultPropertyEditor }
|
||||
|
||||
const
|
||||
ModalResults: array[mrNone..mrLast] of shortstring = (
|
||||
'mrNone',
|
||||
'mrOk',
|
||||
'mrCancel',
|
||||
'mrAbort',
|
||||
'mrRetry',
|
||||
'mrIgnore',
|
||||
'mrYes',
|
||||
'mrNo',
|
||||
'mrAll',
|
||||
'mrNoToAll',
|
||||
'mrYesToAll',
|
||||
'mrClose');
|
||||
|
||||
function TModalResultPropertyEditor.GetAttributes: TPropertyAttributes;
|
||||
begin
|
||||
Result := [paMultiSelect, paValueList, paRevertable];
|
||||
@ -4487,8 +4472,8 @@ var
|
||||
begin
|
||||
CurValue := OrdValue;
|
||||
case CurValue of
|
||||
Low(ModalResults)..High(ModalResults):
|
||||
Result := ModalResults[CurValue];
|
||||
Low(ModalResultStr)..High(ModalResultStr):
|
||||
Result := ModalResultStr[CurValue];
|
||||
else
|
||||
Result := IntToStr(CurValue);
|
||||
end;
|
||||
@ -4498,7 +4483,7 @@ procedure TModalResultPropertyEditor.GetValues(Proc: TGetStrProc);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
for I := Low(ModalResults) to High(ModalResults) do Proc(ModalResults[I]);
|
||||
for I := Low(ModalResultStr) to High(ModalResultStr) do Proc(ModalResultStr[I]);
|
||||
end;
|
||||
|
||||
procedure TModalResultPropertyEditor.SetValue(const NewValue: ansistring);
|
||||
@ -4509,8 +4494,8 @@ begin
|
||||
SetOrdValue(0);
|
||||
Exit;
|
||||
end;
|
||||
for I := Low(ModalResults) to High(ModalResults) do
|
||||
if CompareText(ModalResults[I], NewValue) = 0 then
|
||||
for I := Low(ModalResultStr) to High(ModalResultStr) do
|
||||
if CompareText(ModalResultStr[I], NewValue) = 0 then
|
||||
begin
|
||||
SetOrdValue(I);
|
||||
Exit;
|
||||
|
||||
@ -47,6 +47,7 @@ uses
|
||||
|
||||
|
||||
const
|
||||
// Used for ModalResult
|
||||
mrNone = 0;
|
||||
mrOK = mrNone + 1;
|
||||
mrCancel = mrNone + 2;
|
||||
@ -61,6 +62,21 @@ const
|
||||
mrClose = mrNone + 11;
|
||||
mrLast = mrClose;
|
||||
|
||||
// String representation of ModalResult values
|
||||
ModalResultStr: array[mrNone..mrLast] of shortstring = (
|
||||
'mrNone',
|
||||
'mrOk',
|
||||
'mrCancel',
|
||||
'mrAbort',
|
||||
'mrRetry',
|
||||
'mrIgnore',
|
||||
'mrYes',
|
||||
'mrNo',
|
||||
'mrAll',
|
||||
'mrNoToAll',
|
||||
'mrYesToAll',
|
||||
'mrClose');
|
||||
|
||||
// define aliases for Delphi compatibility
|
||||
fsSurface = GraphType.fsSurface;
|
||||
fsBorder = GraphType.fsBorder;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user