Recent

Author Topic: tvpCllock on a Frame - does not want to appear on its parent  (Read 706 times)

Nicole

  • Sr. Member
  • ****
  • Posts: 349
I use tvpcCock and made myself a nice watch.
It runs fine as small stand alone program.

Now I wanted it to add it the source to a different program onto a Tabscheet of a PageControl.
I took the source and renamed all "Form"s to "Frame"s.
The IDE showed me on F 12 what I wanted to see.

Now I wanted to add the Frame to my parent, - but there just does not happen anything.
What may be wrong?


Code: Pascal  [Select][+][-]
  1.    if Frame_Zeitgeber = nil then
  2.    begin
  3.       Frame_Zeitgeber := TFrame_Zeitgeber.Create(self);  // Kalender wird aus einem Frame geholt
  4.       Frame_Zeitgeber.Parent := TabSheet_Zeitgeber;  // Frame kommt ins PageControl
  5.       Frame_Zeitgeber.Align := alClient;
  6.       Frame_Zeitgeber.FormShow(self); // => I tried it with and without this line
  7.     end;

af0815

  • Hero Member
  • *****
  • Posts: 1022
Re: tvpCllock on a Frame - does not want to appear on its parent
« Reply #1 on: July 25, 2022, 05:32:09 pm »
Do you know what you are doing ?  Have you also renamed in the lfm correct?

Better is normal to take a new Frame and copy your layout with the designer. And a frame have never a FormShow. You can only show the parent.
« Last Edit: July 25, 2022, 05:33:46 pm by af0815 »
regards
Andreas

Nicole

  • Sr. Member
  • ****
  • Posts: 349
Re: tvpCllock on a Frame - does not want to appear on its parent
« Reply #2 on: July 25, 2022, 06:08:32 pm »
Yes, I renamed everything including the lfm.
The show line, I just tried, because it did not work.

To copy the design would destroy all my methods.
I have rather a bundle of them.

wp

  • Hero Member
  • *****
  • Posts: 10051
Re: tvpCllock on a Frame - does not want to appear on its parent
« Reply #3 on: July 25, 2022, 07:52:53 pm »
I don't understand...

You have a form with a VpClock, and you want to convert the form to a frame? Ideally, you should create a Frame as a TFrame by using the IDE template "File" > "New" > "Frame". But if you already have everything on a form, you are excused to "cheat".
  • Close the IDE
  • Open the lfm file of the form which you want to convert to a frame into an editor (Notepad++ is excellent); I assume that the form was a type TForm1.
  • In the first line after the color, change the "Form1:TForm1" to "Frame1:TFrame1".
  • Scroll down and inspect the form properties. Delete all properties which do not exist in a TFrame. Caption very certainly is one of them. Maybe there is also DesigntimePPI. Delete these lines. Save.
  • Now load the pas file belonging the lfm file that you modified
  • Replace the declaration "Form1:TForm1" by "Frame1:TFrame" (or whatever you named it). Delete the global var declaration (var Form1: TForm1). Save.
  • If the form was autocreated is has a line in the lpr file ("Application.CreateForm(Form1, TForm1)"), delete this line - there is no "Form1" any more (you had renamed it to "Frame1").
That's all (except for that what I forgot...).

Start Lazarus and insert the new frame into the form where it should be. In my test the frame did not appear at runtime, like in your case. I played around a bit, and suddenly it was working. Maybe because I had resized the frame in the frame unit a little bit.

Nicole

  • Sr. Member
  • ****
  • Posts: 349
Re: tvpCllock on a Frame - does not want to appear on its parent
« Reply #4 on: July 27, 2022, 07:48:04 am »
I tried it all, unfortunately it did not appear.

PS: I tried a lot, e.g. to intervene by a var, which was my old Delphi style. Nothing worked.

PPS:
Frustrated I copied the Frame's base panel to the PageControl's Tabsheet instead.
Worked, but all my methods are broken and want to be re-added by hand.
« Last Edit: July 27, 2022, 08:04:47 am by Nicole »

af0815

  • Hero Member
  • *****
  • Posts: 1022
Re: tvpCllock on a Frame - does not want to appear on its parent
« Reply #5 on: July 27, 2022, 08:05:27 am »
I tried it all, unfortunately it did not appear.
Then you must use the 'long and save way' . And copy and past of a lot of methods is not a complicated job. And maybe you have a problem in one of these methods, you can find it by copying one by one. Maybe you are doing something with a frame, wich is working on a Form, but not on a Frame.



regards
Andreas

wp

  • Hero Member
  • *****
  • Posts: 10051
Re: tvpCllock on a Frame - does not want to appear on its parent
« Reply #6 on: July 27, 2022, 12:30:42 pm »
I tried it all, unfortunately it did not appear.

PS: I tried a lot, e.g. to intervene by a var, which was my old Delphi style. Nothing worked.

PPS:
Frustrated I copied the Frame's base panel to the PageControl's Tabsheet instead.
Worked, but all my methods are broken and want to be re-added by hand.
Pack the form (pas + lfm files) into a zip and upload it here (via "Attachments and other options"), and I could try to convert it to a frame.

Nicole

  • Sr. Member
  • ****
  • Posts: 349
Re: tvpCllock on a Frame - does not want to appear on its parent
« Reply #7 on: July 27, 2022, 06:28:22 pm »
Thank you so much for the offer!
If it is too hard to copy the methods, I will do this.
I have not tried until now, just was so glad to see my panel on the tab.

Thank you for the watch and the demo of it!

wp

  • Hero Member
  • *****
  • Posts: 10051
Re: tvpCllock on a Frame - does not want to appear on its parent
« Reply #8 on: July 27, 2022, 06:55:05 pm »
Of course the form that I offered to convert to a frame should be self-contained, i.e. it must not should on other forms; ideally I should be able to create a Lazarus project from this form alone because I do not want to find the needle in the haystack of hundreds of forms of your full project.

 

TinyPortal © 2005-2018