Recent

Author Topic: Form move event?  (Read 12087 times)

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Form move event?
« Reply #15 on: November 27, 2014, 04:05:35 pm »
to ensure if this is working with qt
test it with empty forms
code from other events might  produce this error


Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

panoss

  • Full Member
  • ***
  • Posts: 162
  • You only live twice
Re: Form move event?
« Reply #16 on: November 27, 2014, 04:43:47 pm »
Yes the forms are empty.
Windows 10 64bit, Lazarus Version 2.2.0    FPC 3.2.2.

panoss

  • Full Member
  • ***
  • Posts: 162
  • You only live twice
Re: Form move event?
« Reply #17 on: November 27, 2014, 06:22:47 pm »
Well, I 'm again closer to non MDI, modal forms. Doesn't need Qt.
Works quite well...exept if:
Menu Customers -> Open form Customers.
Button 'Add' -> Open CustomersAddNewEdit.
Close CustomersAddNewEdit.
Close Customers.
Menu Customers ->...ERROR!!! :'(
Check out the attachment.

Windows 10 64bit, Lazarus Version 2.2.0    FPC 3.2.2.

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Form move event?
« Reply #18 on: November 27, 2014, 06:32:57 pm »
Change this
Code: [Select]
procedure TfrmMain.mnuCustomersClick(Sender: TObject);
begin
  frmCustomers:= TfrmCustomers.Create(Application);
  frmCustomers.FormStyle:=fsStayOnTop;
  frmCustomers.ShowModal;
  frmCustomers.Release;
end;
to this and it will be fine
Code: [Select]
procedure TfrmMain.mnuCustomersClick(Sender: TObject);
begin
  frmCustomers:= TfrmCustomers.Create(Application);
  frmCustomers.FormStyle:=fsStayOnTop;
  frmCustomers.Show;
  //frmCustomers.ShowModal;
 // frmCustomers.Release;
end;

SIGSEGV propably was from the frmCustomers.ShowModal;
when ShowModal used and you force the focus outside of the modal form you get these errors
thats y  suggested from the begining to avoid ShowModal is realy hard to manage with multiple forms
« Last Edit: November 27, 2014, 06:38:09 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

panoss

  • Full Member
  • ***
  • Posts: 162
  • You only live twice
Re: Form move event?
« Reply #19 on: November 27, 2014, 06:46:37 pm »
No it still gives an error when I close a form:
'Project project1 raised exception class 'External: SIGSEGV'.

 In file './include/customform.inc' at line 949'.

Edit: I removed the code from the frmCustomers.FormClose event, and closes without error!
Thank you very much!

Edit: No, unfortunately it doesn't work well!! The frmAddNewEdit doesn't stay on top if frmCustomers is clicked!
It' s a nightmare...
« Last Edit: November 27, 2014, 06:59:24 pm by panoss »
Windows 10 64bit, Lazarus Version 2.2.0    FPC 3.2.2.

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Form move event?
« Reply #20 on: November 27, 2014, 07:05:13 pm »
i see
add this line in
each FormClose event
and comment out any other code you have on FormClose or FormCloseQuery
Quote
CloseAction:= caFree;

Edit***:
Quote
to ensure if this is working with qt
test it with empty forms
code from other events might  produce this error
your SIGSEGV errors are comming from TfrmMain.CenterForms();   because you are trying to move closed forms
i think this is closed
« Last Edit: November 27, 2014, 07:15:43 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

panoss

  • Full Member
  • ***
  • Posts: 162
  • You only live twice
Re: Form move event?
« Reply #21 on: November 27, 2014, 07:13:05 pm »
No, it doesn't work. When I close the frmAddNewEdit an error happens.
Windows 10 64bit, Lazarus Version 2.2.0    FPC 3.2.2.

panoss

  • Full Member
  • ***
  • Posts: 162
  • You only live twice
Re: Form move event?
« Reply #22 on: November 27, 2014, 07:25:22 pm »
your SIGSEGV errors are comming from TfrmMain.CenterForms();   because you are trying to move closed forms
i think this is closed
I think you 're right on this.
I put an 'exit;' at the beginning of the routine 'CenterForms' and no error was raised!!! (on forms' close).
How shall I check if a form is closed? I tried: 'if not (frmCustomers=nil)' but it doesn't do the trick.
Edit: I tried with 'frmCustomers.Visible=true' and works, but I don't know if that's the best solution.
« Last Edit: November 27, 2014, 07:28:51 pm by panoss »
Windows 10 64bit, Lazarus Version 2.2.0    FPC 3.2.2.

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Form move event?
« Reply #23 on: November 27, 2014, 11:18:14 pm »
i don't think is bad since it must be visible to have a meaning the posistion
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Form move event?
« Reply #24 on: November 27, 2014, 11:59:31 pm »
the question is will it work in all cases or not, from the quick look around I think that visible should raise an exception if the form is not created and if the form the is created but not visible it should be able to move with out problems even when its invisible.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

 

TinyPortal © 2005-2018