Recent

Author Topic: Does it cause any problem to put self-created frames in published section?  (Read 1504 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1296
Hi,
In following example subFrame1 is not created by putting frame on the form during design time. Instead it is created manually during the TForm1.Create.

But does this cause any problem? Sometimes I get error message when I close the form, related with Windows call back function something. The program stops at a line within an .inc file at the closure.

Once I move the definition of subFrame1 to private or public section, there are no such problem. I'm not sure whether the error is because of this --- if not this, I have to scrutinize the freeing section of my application.


Code: Pascal  [Select][+][-]
  1. type
  2.      TForm1 = class (TForm)
  3.         subFrame1 : TsubFrame;
  4.  
  5.     private
  6.         ...
  7.     public
  8.        ...
  9.     end;
  10.  
  11. // implementation
  12.  
  13. constructor TForm1.Create(Owner: TComponent);
  14. begin
  15.     subFrame1:= TSubFrame1.Create(self);
  16.     ...
  17. end;
  18.  


lucamar

  • Hero Member
  • *****
  • Posts: 4219
It shouldn't cause serious problems but it might confuse the streaming and/or control management mechanism. Better put it in the public section.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

devEric69

  • Hero Member
  • *****
  • Posts: 648
I code my interfaces with frames in forms: I think like Lucamar 100% ==> declare a field in public.

Besides, other tools like the object manager, object inspector and its integrated properties editors, ..., may not understand everything (publishing a TForm descendant into a TForm). To sum up: bad idea in published section!
« Last Edit: July 19, 2021, 12:00:44 pm by devEric69 »
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

 

TinyPortal © 2005-2018