![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder 2 Preview » View Thread |
Messages 1 to 9 of 9 total |
![]() |
Thu, Jun 11 2015 6:23 PM | Permanent Link |
Doug B | Ok, this is rudimentary, but I'm finally getting back to things and in EWB 1 I could do the following to close the dialog when clicking on the 'Cancel' button, which would in turn call the form's OnClose() event:
procedure TfrmLogin.btnCancelClick(Sender: TObject); begin ModalResult := mrCancel; end; However, that doesn't seem to work in EWB 2. If I add a call to the 'Close' method right after setting the ModalResult above, I get the following error: Unable to get property 'tobjectlist_fcount' of undefined or null reference Line: 2397 (using EWB 2 build 12) Thanks, Doug |
Thu, Jun 11 2015 6:44 PM | Permanent Link |
Raul ![]() | On 6/11/2015 6:23 PM, Doug B wrote:
> Ok, this is rudimentary, but I'm finally getting back to things and in EWB 1 I could do the following to close the dialog when clicking on the 'Cancel' button, which would in turn call the form's OnClose() event: > > procedure TfrmLogin.btnCancelClick(Sender: TObject); > begin > ModalResult := mrCancel; > end; > > However, that doesn't seem to work in EWB 2. If I add a call to the 'Close' method right after setting the ModalResult above, I get the following error: It seems to be affected by the Visible property being true so temporarily you can one of the following : - set the Visible to false in design time or - set to to false before showing form myForm.Visible := false; myForm.ShowModal; and then the ModalResult does work (i.e. ModalResult := mrCancel or any other) Need Tim to take a look as to why exactly Raul |
Fri, Jun 12 2015 12:15 PM | Permanent Link |
Doug B | Assigning MyForm.Visible := False does work to close the form, however I still get the same error message when I free the form:
procedure TTestForm.OnLoginFormClosed(Sender: TObject); begin LoginForm.Free; <-------------------- Error Message Here end; procedure TTestForm.ShowLoginForm; begin LoginForm := TLoginForm.Create(nil); LoginForm.OnClose := OnLoginFormClosed; LoginForm.Visible := False; // bug fix - needed so assigning a value to ModalResult will close the form LoginForm.ShowModal; end; Doug Raul wrote: On 6/11/2015 6:23 PM, Doug B wrote: > Ok, this is rudimentary, but I'm finally getting back to things and in EWB 1 I could do the following to close the dialog when clicking on the 'Cancel' button, which would in turn call the form's OnClose() event: > > procedure TfrmLogin.btnCancelClick(Sender: TObject); > begin > ModalResult := mrCancel; > end; > > However, that doesn't seem to work in EWB 2. If I add a call to the 'Close' method right after setting the ModalResult above, I get the following error: It seems to be affected by the Visible property being true so temporarily you can one of the following : - set the Visible to false in design time or - set to to false before showing form myForm.Visible := false; myForm.ShowModal; and then the ModalResult does work (i.e. ModalResult := mrCancel or any other) Need Tim to take a look as to why exactly Raul |
Fri, Jun 12 2015 12:45 PM | Permanent Link |
Raul ![]() | On 6/12/2015 12:15 PM, Doug B wrote:
> Assigning MyForm.Visible := False does work to close the form, however I still get the same error message when I free the form: > > procedure TTestForm.OnLoginFormClosed(Sender: TObject); > begin > LoginForm.Free; <-------------------- Error Message Here > end; Not seeing it here so you there must be some other code involved also. here is my code : procedure TForm1.Button1Click(Sender: TObject); begin if not assigned(Form3) then Form3 := TForm3.Create(self); Form3.onclose := CloseHandler; Form3.Visible := false; Form3.ShowModal; end; procedure TForm1.CloseHandler(Sender: TObject); begin if assigned(Form3) then Form3.free; form3 := nil; end; and the popup form3 just does this when button on it is pressed: ModalResult := mrCancel; Raul |
Fri, Jun 12 2015 2:57 PM | Permanent Link |
Doug B | Still no luck.
Sample attached. Doug Raul wrote: here is my code : procedure TForm1.Button1Click(Sender: TObject); begin if not assigned(Form3) then Form3 := TForm3.Create(self); Form3.onclose := CloseHandler; Form3.Visible := false; Form3.ShowModal; end; procedure TForm1.CloseHandler(Sender: TObject); begin if assigned(Form3) then Form3.free; form3 := nil; end; and the popup form3 just does this when button on it is pressed: ModalResult := mrCancel; Raul Attachments: FormCloseBug.zip |
Fri, Jun 12 2015 4:12 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Doug,
<< However, that doesn't seem to work in EWB 2. If I add a call to the 'Close' method right after setting the ModalResult above, I get the following error: >> It's a bug in the component notification tear-down, and is caused by the FocusControl property setting for the login edit label. It's now fixed. Tim Young Elevate Software www.elevatesoft.com |
Fri, Jun 12 2015 4:15 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Raul,
<< Need Tim to take a look as to why exactly >> It was just the way it was coded. I've relaxed the rules now, and it only looks at whether the form is already modal or not, and if the form is already visible, it just brings it to the front. Tim Young Elevate Software www.elevatesoft.com |
Fri, Jun 12 2015 5:31 PM | Permanent Link |
Raul ![]() | On 6/12/2015 2:57 PM, Doug B wrote:
> Still no luck. > > Sample attached. I can duplicate it with your sample - i get the exception. First i thought that maybe the issue is that your main form is TDialog based while mine was TForm based. That is not it - i did a new test project with TDialog for main form and runs without any errors. So what it is that your Tlabel for username has tedit (edtUserName) as "FocusControl" - if you clear this property then error goes away. Tim has to look into this but my suspicion is that its something to do with order they get freed and reference becoming invalid. Raul |
Mon, Jun 15 2015 1:38 PM | Permanent Link |
Doug B | Thanks Tim. And thanks for the workaround, Raul.
Doug |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |