Recent

Author Topic: [SOLVED] Replacing TPageControl with TcyPageControl - easiest way to do ?  (Read 722 times)

FrankBKK

  • New Member
  • *
  • Posts: 31
I have an app that uses TPageControl elements with dozens of sub-components in them
which I'd like to replace with TcyPageControl
but I really don't want to spend hours on copy/pasting those components by hand
from one PageControl element to the other.

What is the best way to go ?

I thought about dropping a TcyPageControl on the form and then manually editing the *.frm file,
replacing  object pcPageName: TPageControl  with  object pcPageName: TcyPageControl

Is that feasible ?
 
« Last Edit: March 06, 2024, 02:19:02 am by FrankBKK »

Joanna

  • Hero Member
  • *****
  • Posts: 774
Re: Replacing TPageControl with TcyPageControl - easiest way to do ?
« Reply #1 on: March 05, 2024, 10:37:26 am »
it would be an interesting experiment. I would like to know if its possible.

In the future you might want to consider creating controls at runtime, its much easier to change that way.
« Last Edit: March 05, 2024, 10:39:00 am by Joanna »
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: Replacing TPageControl with TcyPageControl - easiest way to do ?
« Reply #2 on: March 05, 2024, 10:39:16 am »
Right-click on the PageControl in the form designer, select "Change Class...". In the right box ("New Class") select the "TcyPageControl" > "OK". If if there are incompatible properties you will be asked before deletion. Not 100% sure, but I think this action ("Change class") operates on a per-unit base, i.e. you will have to repeat it for all forms.

FrankBKK

  • New Member
  • *
  • Posts: 31
Re: Replacing TPageControl with TcyPageControl - easiest way to do ?
« Reply #3 on: March 05, 2024, 03:39:53 pm »
Right-click on the PageControl in the form designer, select "Change Class...".

perfect, just what I had in mind - thank you !

FrankBKK

  • New Member
  • *
  • Posts: 31
Re: Replacing TPageControl with TcyPageControl - easiest way to do ?
« Reply #4 on: March 05, 2024, 03:43:18 pm »
it would be an interesting experiment. I would like to know if its possible.

Seems not to work - made some changes with a text editor, then started Lazarus again - reported errors on loading - at very different areas from where I made the changes ... 

JWBokx

  • Newbie
  • Posts: 3
Re: Replacing TPageControl with TcyPageControl - easiest way to do ?
« Reply #5 on: March 05, 2024, 04:44:32 pm »
On pagecontrol I always start with a tpanel and the rest on the panel.
Then just cut the panel, delete the pagecontrol, add the new pagecontrol and paste the panel.

On the past (in delphi) I just used an empty page control, separated forms with panel and used the parent property to place it in the page control.
The three code for the panels was seperate from the main form.
Used forminheritance for the seperate panels. So the code for the swapping is coded ones.

Joanna

  • Hero Member
  • *****
  • Posts: 774
Re: Replacing TPageControl with TcyPageControl - easiest way to do ?
« Reply #6 on: March 06, 2024, 12:24:04 am »
I didn’t know that the parent class for controls could be changed in forum designer ! Thanks we I learned something new  :D
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

 

TinyPortal © 2005-2018