Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-03

Setting ModalResult

13 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Richard Mace

Hi All,
I have my main form, performing the following code:

if frmLogIn.ShowModal = mrOk then
begin
  ShowMessage('OK was clicked');
end

Now, if at design time on my frmLogIn I have a btnOK.ModalReult := mrOk, when btnOK is clicked, the form closes and the above result is true. However, if at design time, on my frmLogIn I have btnOK.ModalResult := mrNone, and then on the btnOK.OnclickEvent I set the ModalResult := True, the frmLogIn does not close, but it does set the ModalResult to mrOK, however, I have to click the btnOK button for a second time for the form to close. The same code is Delphi 7 set's the ModalResult to OK AND closes the form.

Is this a bug, or am I missing something?

Thanks in advance

Richard

Lazarus 0.9.30 fpc 2.4 Windows XP
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120312/a9e2a7d0/attachment.html>

Reply by email

Mattias Gaertner
to Richard Mace
Show quoted text 16 lines
Hi All, I have my main form, performing the following code: if frmLogIn.ShowModal = mrOk then begin ShowMessage('OK was clicked'); end Now, if at design time on my frmLogIn I have a btnOK.ModalReult := mrOk, when btnOK is clicked, the form closes and the above result is true. However, if at design time, on my frmLogIn I have btnOK.ModalResult := mrNone, and then on the btnOK.OnclickEvent I set the ModalResult := True, the frmLogIn does not close, but it does set the ModalResult to mrOK, however, I have to click the btnOK button for a second time for the form to close. The same code is Delphi 7 set's the ModalResult to OK AND closes the form.

It works here.

Show quoted text 7 lines
Is this a bug, or am I missing something? Thanks in advance Richard Lazarus 0.9.30 fpc 2.4 Windows XP

2.4?
Please check these versions. They look pretty old.

Mattias

Reply by email

Richard Mace
to Mattias Gaertner
Mattias Gaertner wrote 37 lines
On Mon, 12 Mar 2012 23:40:31 +0000 Richard Mace wrote: > Hi All, > I have my main form, performing the following code: > > if frmLogIn.ShowModal = mrOk then > begin > ShowMessage('OK was clicked'); > end > > Now, if at design time on my frmLogIn I have a btnOK.ModalReult := mrOk, > when btnOK is clicked, the form closes and the above result is true. > However, if at design time, on my frmLogIn I have btnOK.ModalResult := > mrNone, and then on the btnOK.OnclickEvent I set the ModalResult := True, > the frmLogIn does not close, but it does set the ModalResult to mrOK, > however, I have to click the btnOK button for a second time for the form to > close. The same code is Delphi 7 set's the ModalResult to OK AND closes the > form. It works here. > Is this a bug, or am I missing something? > > Thanks in advance > > Richard > > Lazarus 0.9.30 fpc 2.4 Windows XP 2.4? Please check these versions. They look pretty old.

Thanks Mattias.
Yes, I had just installed the latest "released" binaries for both Lazarus and FPC.
I'm now attempting to install from SVN trunk.

Thanks again

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120313/618fdd9c/attachment.html>

Reply by email

Reinier Olislagers
to Richard Mace
Richard Mace wrote 11 lines
On 12 March 2012 23:51, Mattias Gaertner < > Lazarus 0.9.30 fpc 2.4 Windows XP 2.4? Please check these versions. They look pretty old. Thanks Mattias. Yes, I had just installed the latest "released" binaries for both Lazarus and FPC. I'm now attempting to install from SVN trunk.

FYI, 2.6 is the latest released version for FPC...

Regards,
Reinier

Reply by email

Richard Mace
to Reinier Olislagers

Installed the latest RC4 binaries and still the same problem

"Reinier Olislagers" wrote 24 lines
On 13-3-2012 7:50, Richard Mace wrote: > On 12 March 2012 23:51, Mattias Gaertner < > > Lazarus 0.9.30 fpc 2.4 Windows XP > > 2.4? > Please check these versions. They look pretty old. > > > Thanks Mattias. > Yes, I had just installed the latest "released" binaries for both > Lazarus and FPC. > I'm now attempting to install from SVN trunk. FYI, 2.6 is the latest released version for FPC... Regards, Reinier -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120313/db2cb5fa/attachment.html>

Reply by email

Flávio Etrusco
to Richard Mace

Do you set the ModalResult in the button or in the form? If the former, is there any specific reason for it?

Best regards,
Fl?vio

2012/3/13 Richard Mace :

Show quoted text 36 lines
Installed the latest RC4 binaries and still the same problem On 13 Mar 2012 07:07, "Reinier Olislagers" wrote: > > On 13-3-2012 7:50, Richard Mace wrote: > > On 12 March 2012 23:51, Mattias Gaertner < > > ? ? > Lazarus 0.9.30 fpc 2.4 Windows XP > > > > ? ? 2.4? > > ? ? Please check these versions. They look pretty old. > > > > > > Thanks Mattias. > > Yes, I had just installed the latest "released" binaries for both > > Lazarus and FPC. > > I'm now attempting to install from SVN trunk. > > FYI, 2.6 is the latest released version for FPC... > > Regards, > Reinier > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Ajeandro Gonzalo
to Flávio Etrusco

With the LazReport component distributed w/RC4, The Report has no bands and no Add Bands button - only the current row shows in the Report. What happened?

I'm running Windows 7, 64 bit, and using the Tdbf database component.

Clueless in Seattle

Reply by email

Richard Mace
to Flávio Etrusco: Do you set the ModalResult in the button or in the form? If the former, is there any…

2012/3/13 Fl?vio Etrusco

Do you set the ModalResult in the button or in the form? If the former, is there any specific reason for it?

It's on the form.
Just to clarify, it does actually set the ModalResult up correctly, it just doesn't close the form, until you click the OK button the second time.

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120314/7ca45ab9/attachment.html>

Reply by email

Mattias Gaertner
to Richard Mace
Show quoted text 9 lines
2012/3/13 Fl?vio Etrusco > Do you set the ModalResult in the button or in the form? If the > former, is there any specific reason for it? > > It's on the form. Just to clarify, it does actually set the ModalResult up correctly, it just doesn't close the form, until you click the OK button the second time.

Please create bug report with an example.

Mattias

Reply by email

Salvatore Coppola
to Flávio Etrusco: Do you set the ModalResult in the button or in the form? If the former, is there any…

Set in the Object Inspector Borderstyle to bsDialog and the form behavior should be what you need
Regards,
Salvatore

2012/3/13 Fl?vio Etrusco :

Show quoted text 49 lines
Do you set the ModalResult in the button or in the form? If the former, is there any specific reason for it? Best regards, Fl?vio 2012/3/13 Richard Mace : > Installed the latest RC4 binaries and still the same problem > > On 13 Mar 2012 07:07, "Reinier Olislagers" > wrote: >> >> On 13-3-2012 7:50, Richard Mace wrote: >> > On 12 March 2012 23:51, Mattias Gaertner < >> > ? ? > Lazarus 0.9.30 fpc 2.4 Windows XP >> > >> > ? ? 2.4? >> > ? ? Please check these versions. They look pretty old. >> > >> > >> > Thanks Mattias. >> > Yes, I had just installed the latest "released" binaries for both >> > Lazarus and FPC. >> > I'm now attempting to install from SVN trunk. >> >> FYI, 2.6 is the latest released version for FPC... >> >> Regards, >> Reinier >> >> -- >> _______________________________________________ >> Lazarus mailing list >> >> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mattias Gaertner
to Salvatore Coppola

Salvatore Coppola hat am 14. M?rz 2012 um 11:57
geschrieben:

Set in the Object Inspector Borderstyle to bsDialog and the form behavior should be what you need

BorderStyle has nothing to do with ModalResult.

This is enough to close a modal dialog:

procedure TForm1.Button1Click(Sender: TObject);
begin
  ModalResult:=mrOk;
end;
Note:
When a button's Modalresult is set, it will do the above when clicked.
Setting the Button1.ModalResult alone will not close the form.

Mattias

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120314/f97023ac/attachment.html>

Reply by email

Richard Mace
to Mattias Gaertner

2012/3/14 Mattias Gaertner

Show quoted text 37 lines
** Salvatore Coppola hat am 14. M?rz 2012 um 11:57 geschrieben: > Set in the Object Inspector Borderstyle to bsDialog and the form > behavior should be what you need BorderStyle has nothing to do with ModalResult. This is enough to close a modal dialog: procedure TForm1.Button1Click(Sender: TObject); begin ModalResult:=mrOk; end; Note: When a button's Modalresult is set, it will do the above when clicked. Setting the Button1.ModalResult alone will not close the form.

Curiously, it looks, at the moment, as if upgrading from 0.9.30 to 0.9.30.4RC3 might actually have fixed the issue I was having. I'll do some more tests, and let you know the results.

Richard

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120314/6ed7369f/attachment.html>

Reply by email

Salvatore Coppola
to Mattias Gaertner: Salvatore Coppola hat am 14. M?rz 2012 um 11:57 geschrieben: BorderStyle has nothing to…

2012/3/14 Mattias Gaertner :

Show quoted text 8 lines
Salvatore Coppola hat am 14. M?rz 2012 um 11:57 geschrieben: > Set in the Object Inspector Borderstyle to bsDialog and the form > behavior should be what you need

My apologie for misleading!

Show quoted text 27 lines
BorderStyle has nothing to do with ModalResult. This is enough to close a modal dialog: procedure TForm1.Button1Click(Sender: TObject); begin ? ModalResult:=mrOk; end; Note: When a button's Modalresult is set, it will do the above when clicked. Setting the Button1.ModalResult alone will not close the form.

Clear, thx

Show quoted text 14 lines
Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email