본문 바로가기
Delphi Tip/+Tip

메세지 다이어그램(Message Dialog) 체크박스(CheckBox) 추가

by MonoSoft 2024. 6. 6.
728x90
반응형

메세지 다이어그램(Message Dialog) 체크박스(CheckBox) 추가

 

728x90

 

 

 

 

procedure TForm1.Button1Click(Sender: TObject);

var

AMsgDialog: TForm;

 

function GetCheckValue(ADialog: TForm; const AName: String): boolean;

var

i: integer;

begin

for i:=0 to ADialog.ControlCount-1 do

begin

if ( ADialog.Controls[i].Name = AName ) and ( ADialog.Controls[i] is TCheckBox ) then

begin

Result := (ADialog.Controls[i] as TCheckBox).Checked;

break;

end;

end;

end;

 

begin

AMsgDialog := CreateMessageDialog('Test Message!!', mtWarning, [mbYes, mbNo]) ;

 

with AMsgDialog do

try

Caption := 'Dialog Title' ;

AMsgDialog.Height := AMsgDialog.Height + 30;

 

with TCheckBox.Create(AMsgDialog) do

begin

Parent := AMsgDialog;

Name := 'chkShowAgain';

Caption := ' 다시 묻지않기';

Width := AMsgDialog.Width;

Top := AMsgDialog.Height - 70;

Left := 8;

end;

 

if (ShowModal = ID_YES) then

begin

if GetCheckValue(AMsgDialog, 'chkShowAgain') then

MessageDlg('Check', mtWarning, [mbOK], 0)

else

MessageDlg('not check', mtWarning, [mbOK], 0);

end;

finally

Free;

end;

end;

 

728x90
반응형

댓글