Вот что из этого получилось:
ShowCustomMessageDialog(var AItemIndex: Byte; const ACaption: string = ''; const AMsg: string = ''; DlgType: TMsgDlgType = mtCustom): Boolean;
var
Af: TForm;
ALeft, ATop, AWidth, AHeight: Integer;
begin
Af := CreateMessageDialog(AMsg, ADlgType, [mbOK, mbCancel]);
try
ALeft := Af.Left;
ATop := Af.Top;
AWidth := Af.Width + 130;
AHeight := Af.Height + 20;
with TRadioGroup.Create(Af) do
begin
Name := 'RadioGroup';
Parent := Af;
Caption := '';
Left := 5;
Top := 5;
Height := 60;
Width := 270;
Items.Add('Первый элемент');
Items.Add('Второй элемент');
ItemIndex := AItemIndex;
end;
if (TButton(Af.FindChildControl('OK'))) <> nil then
with TButton(Af.FindChildControl('OK')) do
begin
Left := 80;
Top := 70;
end;
if (TButton(Af.FindChildControl('Cancel'))) <> nil then
with TButton(Af.FindChildControl('Cancel')) do
begin
Left := 160;
Top := 70;
end;
Af.Caption := ACaption;
Af.SetBounds(ALeft, ATop, AWidth, AHeight);
Result := Af.ShowModal = mrOk;
if Result then
begin
if (TRadioGroup(Af.FindChildControl('RadioGroup')) <> nil) then
AItemIndex := TRadioGroup(Af.FindChildControl('RadioGroup')).ItemIndex
else
Result := False;
end;
finally
Af.Free;
end;
end;
Комментариев нет:
Отправить комментарий