Recent

Author Topic: ButtonEdit Component  (Read 35899 times)

Derit

  • Jr. Member
  • **
  • Posts: 55
Re: ButtonEdit Component
« Reply #45 on: April 02, 2014, 05:04:59 pm »
Unfortunately no. I got bunch of messages like:
Identifier not found: TCustomEditButton = ButtonEdit.TCustomEditButton;
Identifier not found: TEditButton = ButtonEdit.TEditButton;

uses ButtonEdit and Create with Code,
i think bart will replace the old Editbutton with new ButtonEdit,
i require code for create ButtonEdit not from component parlete
Lazarus Trunk/FPC Trunk/2.6.2/2.6.4

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: ButtonEdit Component
« Reply #46 on: April 02, 2014, 11:09:14 pm »
Well, I got it to compile and even build the IDE (not committed yet), but now I'm stuck.
Every form that has a TEditButton (the old one) on it refuses to load, because the component is not registered.
And I cannot register it (in EditBtn.pas), because it then complains that TEditButton is already  registered.

So, this (renaming the component to TButtonEdit), it seems, is not going to work.

So, how to proceed from here?
Implement it as a separate component and then manually (!) replace all affected components?
Stick with the old name?

Bart

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: ButtonEdit Component
« Reply #47 on: April 02, 2014, 11:45:19 pm »
Ah, well.
Fixed building.
Fixed the registering thingy.

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: ButtonEdit Component
« Reply #48 on: April 03, 2014, 09:48:23 am »
Yes, Blaazen's way for CalculatePreferredSize() works. The behavior then resembles TEdit's behavior.
You must also imitate TEdit's Height calculation inside CalculatePreferredSize() somehow.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: ButtonEdit Component
« Reply #49 on: April 03, 2014, 10:02:07 am »
Quote
You must also imitate TEdit's Height calculation inside CalculatePreferredSize() somehow.
Looking to the old code, there were:
Code: [Select]
procedure TCustomGroupedEditButton.AnchorEditAndButton;
begin
  DisableAutoSizing;
  try
    Button.Anchors:=[];
    if IsRightToLeft then begin
      // button + edit
      Button.AnchorParallel(akLeft, 0, Self);
      Edit.AnchorAsAlign(alRight, 0);
      Edit.AnchorToNeighbour(akLeft, 0, Button);
    end else begin
      // edit + button
      Button.AnchorParallel(akRight, 0, Self);
      Edit.AnchorAsAlign(alLeft, 0);
      Edit.AnchorToNeighbour(akRight, 0, Button);
    end;
    Button.AnchorParallel(akTop, 0, Edit);
    Button.AnchorParallel(akBottom, 0, Edit);
  finally
    EnableAutoSizing;
  end;
end;
This method was called from two places:
1) constructor
2) overriden SetBiDiMode method

AFAIR this worked well.
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/

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: ButtonEdit Component
« Reply #50 on: April 03, 2014, 10:51:47 am »
> procedure TCustomGroupedEditButton.AnchorEditAndButton;

That is the code for setting anchors inside the component. It must be dumped in the new component because internal anchors were the main reason for problems.
For example setting border space affected the anchored button.
The new component correctly encapsulates both Edit and Button parts inside its boundaries.
Anchoring is meant for layouting LCL components together.

Now, TEdit's height calculation based on font size is rather complex. Once it is found it must be reused (or copied) for TButtonEdit.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: ButtonEdit Component
« Reply #51 on: April 03, 2014, 11:05:28 am »
The height of the new component responds to the font size when AutoSize = True.
I think this is due to the fact that the container behaves like that when changing the font size. (The font actually is the font of the container, the edit has ParentFont := True).

I will implement the CalculatePreferredSize() solution suggested by Blaazen to fix not being able to set Width when Autosize = True.

Once this (sort of) works, I think we should "kill" the old component (or reverse the conditional defines)?
This way we get much more testing than with the current define, and I suspect there will be regressions that need to be fixed.

Then there is the component palette:
It does not have an proper Icon for TButtonEdit. (should be the same as current TEditButton).
The Icon for TEditButton should be changed somehow to represent that is obsolete.

I don't know how to do that.

Bart

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: ButtonEdit Component
« Reply #52 on: April 03, 2014, 11:19:54 am »
I will implement the CalculatePreferredSize() solution suggested by Blaazen to fix not being able to set Width when Autosize = True.

Done in r44590.

Bart

Derit

  • Jr. Member
  • **
  • Posts: 55
Re: ButtonEdit Component
« Reply #53 on: April 03, 2014, 11:20:22 am »

Then there is the component palette:
It does not have an proper Icon for TButtonEdit. (should be the same as current TEditButton).
The Icon for TEditButton should be changed somehow to represent that is obsolete.

I don't know how to do that.

Bart
i'm already insert icon to git
for change you use  res file from image folder ....
Lazarus Trunk/FPC Trunk/2.6.2/2.6.4

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: ButtonEdit Component
« Reply #54 on: April 04, 2014, 12:44:38 pm »
Then there is the component palette:
It does not have an proper Icon for TButtonEdit. (should be the same as current TEditButton).

Done in r44601.
Actually easier than I thought.

Bart

 

TinyPortal © 2005-2018