Recent

Author Topic: Help with custom control  (Read 5194 times)

Marion

  • Full Member
  • ***
  • Posts: 123
Help with custom control
« on: April 24, 2014, 06:57:13 pm »
I wrote a TGraphicControl that has a palette of colors on it. It has one exposed property of SelectedColor of type TColor. This control has worked fine on any empty project I create, but in my actual project it doesn't work. I think it has to do with an old unit I was experimenting with before I decided to go with a custom control. I have removed references to the old files in the project inspector. I have deleted all of the old files. Yet, I think it is still referencing something old and not working properly in my actual project. Is there some hint to how to clean up my project to make the custom control work properly?
Thank you,
Marion
(A recovering Windows programmer.)

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Help with custom control
« Reply #1 on: April 24, 2014, 07:15:33 pm »
Do you have it as a component ? I mean *.lpk file and procedure Register which installs control to component palette. Or just a unit in uses (you create control only at run-time).
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Marion

  • Full Member
  • ***
  • Posts: 123
Re: Help with custom control
« Reply #2 on: April 24, 2014, 07:21:04 pm »
Yes. It is an lpk that Registers this control on the Misc palette. That all works fine when I start a brand new empty project. It only misbehaves in my existing project that has many, many hours of work in it.
Thank you,
Marion
(A recovering Windows programmer.)

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Help with custom control
« Reply #3 on: April 24, 2014, 07:51:48 pm »
I also has this experience sometime, when developing new custom control.
This way, the properties has not properly set as expected.


Usually, the bug is because there is yet already saved properties in old form (your real / big project),
during I were add/remove more properties, or since I added "default" value for some property.


Usually, it solved by looking/modifying directly at form (*.lfm / *.dfm) using text editor such notepad.exe
Sometime, it just solved by Cut & Paste (Ctrl+X, Ctrl+V) the old component, in place. This step usually will "refresh" the component's stream in form's stream (*.lfm)


if these don't correct, I try all the step in new computer or new VirtualMachine.
if the last step works, I know that I need to cleanup the temporary files by Restart computer,


Alternative step that I could pass is:
install new instance of Lazarus. Checkout a clean SVN (or Clone a new GIT).


That's all I usually did to solve my "non-logical problem".


 :) I hope it helps.
« Last Edit: April 24, 2014, 07:57:31 pm by x2nie »
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

Marion

  • Full Member
  • ***
  • Posts: 123
Re: Help with custom control
« Reply #4 on: April 24, 2014, 11:05:46 pm »
I did everything x2nie suggested without luck.

Thanks for the suggestions though.
Thank you,
Marion
(A recovering Windows programmer.)

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Help with custom control
« Reply #5 on: April 25, 2014, 12:03:22 am »
You could also try rewriting your (new, debugged) control with a slightly altered typename.
Back everything up.
Uninstall your previously named component from the palette.
Install the newly named component.
Then go through all your project's form .lfm files doing a find-and-replace on the renamed component.
Double-check there is nothing in your project .lpr that references the old component.
Delete all .ppus and .o files throughout your project.
Then rebuild (not just recompile).

Marion

  • Full Member
  • ***
  • Posts: 123
Re: Help with custom control
« Reply #6 on: April 25, 2014, 12:32:56 am »
I finally fixed it.

I moved the control's pas to a different lpk. Uninstalled the old lpk. Reinstalled the new lpk. That fixed it.

Thanks for everyone's help.

Thank you,
Marion
(A recovering Windows programmer.)

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Help with custom control
« Reply #7 on: April 25, 2014, 03:46:56 am »
I finally fixed it.

I moved the control's pas to a different lpk. Uninstalled the old lpk. Reinstalled the new lpk. That fixed it.


Okay. It seem that the bad artifact is in the package (procedure Register; ) or we need to clean-up the compiled package (*.ppu, *.o).
If it because of compiled file (*.ppu / *.o), we can solve it by "recompile-clean" menu in the Package-dialogbox.


Lastly, in case you need to use the old package (*.lpk), for example because of you like the name of the old package rather than the new one (or by another reason),
You can uninstall new package, reopen the old LPK, remove the unit from being listed in package, save package and re-add the deleted unit.


I did reinstall the old package when using old version of tortoise-svn-client, because this software will track file-deletion anytime.
This way, I can't delete old file and create new file with the old-file's name.
Modern tortoise-svn is smarter, when delete a file and create a new one with same name, tortoise will know that I didn't really delete them.

When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

 

TinyPortal © 2005-2018