Board index » delphi » MessageBox + checkbox

MessageBox + checkbox


2004-07-22 05:16:11 AM
delphi2
Would be something like a question, and a checkbox like "Donīt ask me
anymore".
Any components or ways of be doing this?
thanks in advance.
Marcelo
 
 

Re:MessageBox + checkbox

A form with a checkbox?
Or is that too simple? :-)
--
Finn Tolderlund
"mARCELO" <XXXX@XXXXX.COM>skrev i en meddelelse
Quote
Would be something like a question, and a checkbox like "Donīt ask me
anymore".
Any components or ways of be doing this?
 

Re:MessageBox + checkbox

Quote
Would be something like a question, and a checkbox like "Donīt ask me
anymore".

Any components or ways of be doing this?
TForm
-----
Martin
web: www.autag.com
blog: softwarenitpick.blogspot.com
 

Re:MessageBox + checkbox

Usually such questions asked at "delphi.thirdpartytools.general" NG, and
there is plently or components/libraries with such dialog box. For example,
one at the AppControls pack (www.appcontrols.com).
Regards,
Aleksey
Quote
Would be something like a question, and a checkbox like "Donīt ask me
anymore".
 

Re:MessageBox + checkbox

"mARCELO" <XXXX@XXXXX.COM>writes:
Quote
Would be something like a question, and a checkbox like "Donīt ask me
anymore".

Any components or ways of be doing this?

www.codeproject.com/dialog/xmessagebox.asp
C++ but can be wrapped and compiled with BCB.
/Pavel
 

Re:MessageBox + checkbox

how can i get the result of the userīs choice using acInfoBox
?
"Aleksey Kuznetsov" <XXXX@XXXXX.COM>escreveu na mensagem
Quote
Usually such questions asked at "delphi.thirdpartytools.general" NG, and
there is plently or components/libraries with such dialog box. For
example,
one at the AppControls pack (www.appcontrols.com).

Regards,
Aleksey

>Would be something like a question, and a checkbox like "Donīt ask
me
>anymore".


 

Re:MessageBox + checkbox

Elpack (www.ceberus.com/lmd/products/lmdelpack/) have such Dialog
(TElPromptDialog)
"mARCELO" <XXXX@XXXXX.COM>schrieb im Newsbeitrag
Quote
Would be something like a question, and a checkbox like "Donīt ask me
anymore".

Any components or ways of be doing this?


thanks in advance.


Marcelo


 

Re:MessageBox + checkbox

"mARCELO" <XXXX@XXXXX.COM>writes
Quote
Would be something like a question, and a checkbox like "Donīt ask me
anymore".

Any components or ways of be doing this?

mARCELO,
You probably don't need a component for this, though it would be real simple
to wrap into some kind of dialog component.
There's probably a better way to do this, but here is a quik and dirty way
to get this accomplished...
Hope this helps,
Steve-O
//Show Don't Ask Dialog...
procedure TForm1.Button1Click(Sender: TObject);
var
frmSampleDialog : TfrmSampleDialog;
begin
frmSampleDialog := TfrmSampleDialog.Create(nil);
try
if frmSampleDialog.Execute then
begin
if frmSampleDialog.DontAsk then
begin
ShowMessage('Dont Ask');
end
else
begin
ShowMessage('Ask');
end;
end;
finally
frmSampleDialog.Free;
end;
end;
//Don't Ask Dialog...
type
TfrmSampleDialog = class(TForm)
cbDontAsk: TCheckBox;
btnCancel: TButton;
btnOK: TButton;
private
function GetDontAsk: boolean;
{ Private declarations }
public
{ Public declarations }
function Execute : boolean;
property DontAsk : boolean read GetDontAsk;
end;
var
frmSampleDialog: TfrmSampleDialog;
implementation
{$R *.DFM}
{ TfrmSampleDialog }
function TfrmSampleDialog.Execute: boolean;
begin
result := (ShowModal = mrOK);
end;
function TfrmSampleDialog.GetDontAsk: boolean;
begin
result := cbDontAsk.Checked;
end;
 

Re:MessageBox + checkbox

It works!
i did not think about use that before
thank you very much
"steve-o" <XXXX@XXXXX.COM>escreveu na mensagem
Quote
"mARCELO" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>Would be something like a question, and a checkbox like "Donīt ask
me
>anymore".
>
>Any components or ways of be doing this?
>

mARCELO,

You probably don't need a component for this, though it would be real
simple
to wrap into some kind of dialog component.
There's probably a better way to do this, but here is a quik and dirty way
to get this accomplished...

Hope this helps,
Steve-O


//Show Don't Ask Dialog...
procedure TForm1.Button1Click(Sender: TObject);
var
frmSampleDialog : TfrmSampleDialog;
begin
frmSampleDialog := TfrmSampleDialog.Create(nil);
try
if frmSampleDialog.Execute then
begin
if frmSampleDialog.DontAsk then
begin
ShowMessage('Dont Ask');
end
else
begin
ShowMessage('Ask');
end;
end;
finally
frmSampleDialog.Free;
end;
end;


//Don't Ask Dialog...
type
TfrmSampleDialog = class(TForm)
cbDontAsk: TCheckBox;
btnCancel: TButton;
btnOK: TButton;
private
function GetDontAsk: boolean;
{ Private declarations }
public
{ Public declarations }
function Execute : boolean;
property DontAsk : boolean read GetDontAsk;
end;

var
frmSampleDialog: TfrmSampleDialog;

implementation

{$R *.DFM}

{ TfrmSampleDialog }

function TfrmSampleDialog.Execute: boolean;
begin
result := (ShowModal = mrOK);
end;

function TfrmSampleDialog.GetDontAsk: boolean;
begin
result := cbDontAsk.Checked;
end;


 

Re:MessageBox + checkbox

I think this doesn't work as expected.
The frmSampleDialog is created and "freed" in the same
button-click-event. The next time you click Button1, it is creating a new
frmSampleDialog which doesn't remember the selected state.
Create and free it in OnCreate / OnDestroy or let Delphi do it
in the *.dpr file. Application.CreateForm(TForm2, Form2);
And it would probably be enough to call it by:
if not frmSampleDialog.DontAsk then frmSampleDialog.Execute;