Recent

Author Topic: TECEditBtn.Button.OnClick bug ?  (Read 839 times)

chrv

  • Jr. Member
  • **
  • Posts: 58
TECEditBtn.Button.OnClick bug ?
« on: January 14, 2023, 03:20:21 pm »
Hi all,

I have a problem with this handler:
- Put a TECEditBtn named ECEditBtn1 on a form.
- Create a handler named button.OnClick (by double clicking on Button.OnClick)
- A handler named ECEditBtnButtonClick is created (not ECEditBtnButten1Click)
- Put a second TECEditBtn (ECEditBtn2).
- Try to generated a handler for Button.OnClick: the same handler ECEditBtnButtonClick is selected (not created)

Is it a bug?
Win32 Lazarus 2.0.12 FPC 3.2.0

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: TECEditBtn.Button.OnClick bug ?
« Reply #1 on: January 14, 2023, 04:50:46 pm »
What version of Lazarus and OS please ?
The only true wisdom is knowing you know nothing

dsiders

  • Hero Member
  • *****
  • Posts: 1080
Re: TECEditBtn.Button.OnClick bug ?
« Reply #2 on: January 14, 2023, 05:01:34 pm »
Hi all,

I have a problem with this handler:
- Put a TECEditBtn named ECEditBtn1 on a form.
- Create a handler named button.OnClick (by double clicking on Button.OnClick)
- A handler named ECEditBtnButtonClick is created (not ECEditBtnButten1Click)
- Put a second TECEditBtn (ECEditBtn2).
- Try to generated a handler for Button.OnClick: the same handler ECEditBtnButtonClick is selected (not created)

Is it a bug?

Problem does not exist using eccontrols 0.9.58 on Lazarus 2.2.4 and 2.3.0. Try updating from OPM.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

chrv

  • Jr. Member
  • **
  • Posts: 58
Re: TECEditBtn.Button.OnClick bug ?
« Reply #3 on: January 14, 2023, 06:02:52 pm »
Win32
Lazarus 2.0.12
FPC 3.2.0
econtrol_package.lpk 2.1.0.0 from OPM

I just droped 2 TECEditBtn on a form and double clicked on each Button.OnClick.
Here is what I get
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ECEditBtns;
  6. type
  7.   { TForm1 }
  8.   TForm1 = class(TForm)
  9.     ECEditBtn1: TECEditBtn;
  10.     ECEditBtn2: TECEditBtn;
  11.     procedure ECEditBtnButtonClick(Sender: TObject);
  12.   private
  13.   public
  14.   end;
  15. var
  16.   Form1: TForm1;
  17.  
  18. implementation
  19.  
  20. {$R *.lfm}
  21.  
  22. { TForm1 }
  23.  
  24. procedure TForm1.ECEditBtnButtonClick(Sender: TObject);
  25. begin
  26.  
  27. end;
  28.  
  29. end.            

See attached if you want.
Win32 Lazarus 2.0.12 FPC 3.2.0

dsiders

  • Hero Member
  • *****
  • Posts: 1080
Re: TECEditBtn.Button.OnClick bug ?
« Reply #4 on: January 14, 2023, 07:15:52 pm »
...
econtrol_package.lpk 2.1.0.0 from OPM

When I look at at OPM... it says the revision level is 0.9.58. And behaves as mentioned.

Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: TECEditBtn.Button.OnClick bug ?
« Reply #5 on: January 14, 2023, 07:53:35 pm »
I guess this would be great if you just were making a trial version of the controls, one instance of each control!   :'(

  But really, where does the IDE generate the incremental value?
The only true wisdom is knowing you know nothing

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: TECEditBtn.Button.OnClick bug ?
« Reply #6 on: January 14, 2023, 10:33:54 pm »
  But really, where does the IDE generate the incremental value?
Search for GetUniqueName in Lazarus sources?

Bart

chrv

  • Jr. Member
  • **
  • Posts: 58
Re: TECEditBtn.Button.OnClick bug ?
« Reply #7 on: January 15, 2023, 01:02:19 am »
Look at my code.
If event handler is set by code, everything is OK

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ECEditBtns;
  6. type
  7.   { TForm1 }
  8.   TForm1 = class(TForm)
  9.     ECEditBtn1: TECEditBtn;
  10.     ECEditBtn2: TECEditBtn;
  11.     procedure ECEditBtnButtonClick(Sender: TObject);
  12.     procedure ECEditBtnButton1Click(Sender: TObject);
  13.     procedure ECEditBtnButton2Click(Sender: TObject);
  14.     procedure FormCreate(Sender: TObject);
  15.   private
  16.   public
  17.   end;
  18.  
  19. var
  20.   Form1: TForm1;
  21. implementation
  22. {$R *.lfm}
  23. { TForm1 }
  24. procedure TForm1.ECEditBtnButtonClick(Sender: TObject);
  25. begin
  26.  
  27. end;
  28.  
  29. procedure TForm1.ECEditBtnButton1Click(Sender: TObject);
  30. begin
  31.   ShowMessage('1');
  32. end;
  33. procedure TForm1.ECEditBtnButton2Click(Sender: TObject);
  34. begin
  35.   ShowMessage('2');
  36. end;
  37. procedure TForm1.FormCreate(Sender: TObject);
  38. begin
  39.   ECEditBtn1.Button.OnClick:=@ECEditBtnButton1Click;
  40.   ECEditBtn2.Button.OnClick:=@ECEditBtnButton2Click;
  41. end;
  42. end.    
Win32 Lazarus 2.0.12 FPC 3.2.0

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: TECEditBtn.Button.OnClick bug ?
« Reply #8 on: January 15, 2023, 04:29:33 pm »
This is great news for me! :D

I see there is a GetNamePath in the TComponent and its virtual which means I can override this and alter the name on return depending on who is asking for it!  >:D

 Nice feature for trial software.  Thanks for pointing this out.

 in any case, I am sure this is an unseen bug.

The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018