Recent

Author Topic: Correct way to modify LCL  (Read 3617 times)

sfeinst

  • Full Member
  • ***
  • Posts: 186
Correct way to modify LCL
« on: November 17, 2010, 12:58:36 pm »
I'm trying to modify the LCL to add a feature to a TMemo  What I'd like to know is what the"correct" way is to do this.  I'm planning on adding the ability to set tab stops.  I looked at the LCL and saw that in Windows there is a way to do this and I think there may be a way in QT (which is the other LCL I use).

I modified Win32WSStdCtrls to add a class procedure that does the work.
I modified WSStdCtrls to add an empty class procedure.
I modified StdCtrls to add a procedure and property.  The procedure calls the WSStdCtrls procedure and stores the value.  The property reads the value or calls the procedure.
I modified custommemo.inc and wrote the actual procedure used in StdCtrls.

All of this worked under Windows (I have not tried other LCLs yet).

I plan on doing this for QT and possibly gtk2 (I haven't checked it out yet).  But I do not have the ability to code for any of the Mac environments or Win CE or any other LCL Lazarus supprots.

So now finally to the question:
Since this would be an incomplete solution (not all LCL interfaces would be supported), is this the correct way to modify the TMemo (ie only supported by Windows, QT and gtk2)? 

Or, is the correct way to do this to create a new component descending from either TMemo or TCustomMemo and state that component is just not implemented in all environments?

Or is there a different option not mentioned?

Thanks.

ivan17

  • Full Member
  • ***
  • Posts: 173
Re: Correct way to modify LCL
« Reply #1 on: November 17, 2010, 03:32:44 pm »
usually, you should go with a descendant control - it is easier to maintain and install, it will automatically inherit FUTURE improvements to the TMemo but most important reason - standard controls (memo, editbox, grid, even button) should be kept to the basic and common functionality, not bloated with everything everyone thinks of.  make a tabmemo available for (rare) people who need it, but keep in mind that even they will prefer to use standard memo in some other project.

as for technical details regarding files, i'll leave that to someone more experienced.

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: Correct way to modify LCL
« Reply #2 on: November 30, 2010, 10:44:48 pm »
I agree with ivan17. Specifically, you should create a TCustomMemo based control.
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

 

TinyPortal © 2005-2018