Recent

Author Topic: Any example on how to get the "text" property of a tLabeledEdit?  (Read 651 times)

Bitbeisser

  • New Member
  • *
  • Posts: 28
Thought it would be a good idea to try and use a number of tLabeledEdit controls on a form.
However, it seems near impossible to actually get the edited text from that object, for example in the OnExit event. The existing documentation, at least as far as I was able to find it online, only states that RealGetText should be used but no example. And any which way I have tried, I just keep getting errors. either "Error: Only class methods, class properties and class variables can be referred with class references" or "Error: identifier idents no member "RealGetText"".

thanks for any useful hint,

Ralf

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Any example on how to get the "text" property of a tLabeledEdit?
« Reply #1 on: March 28, 2023, 05:39:59 pm »
TLabeledEdit is nothing else than TEdit with anchored TLabel so you can do exactly the same thing with it.
Usually you get the edited text from Text property in OnEditingDone (recommended) or even OnChange event.
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/

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2006
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Any example on how to get the "text" property of a tLabeledEdit?
« Reply #2 on: March 28, 2023, 05:40:55 pm »
I do not know what you try to do but anyway, on my Windows 10 64bit system it works as predicted.
Code: Pascal  [Select][+][-]
  1. // when it get focus
  2. procedure TForm1.LabeledEdit1Enter(Sender: TObject);
  3. begin
  4.   Label1.Caption := LabeledEdit1.Text + ' - OnEnter';
  5. end;
  6.  
  7. // when it loose focus
  8. procedure TForm1.LabeledEdit1Exit(Sender: TObject);
  9. begin
  10.   Label1.Caption := LabeledEdit1.Text + ' - OnExit';
  11. end;
  12.  
  13. // when mouse is over control
  14. procedure TForm1.LabeledEdit1MouseEnter(Sender: TObject);
  15. begin
  16.   Label1.Caption := LabeledEdit1.Text + ' - OnMouseEnter';
  17. end;
  18.  
  19. // when mouse leave controls area
  20. procedure TForm1.LabeledEdit1MouseLeave(Sender: TObject);
  21. begin
  22.   Label1.Caption := LabeledEdit1.Text + ' - OnMouseExit';
  23. end;
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Bitbeisser

  • New Member
  • *
  • Posts: 28
Re: Any example on how to get the "text" property of a tLabeledEdit?
« Reply #3 on: March 28, 2023, 06:12:30 pm »
Thanks guys!

It looks like I just needed a virtual second set of eyes on what I was doing.
I might be getting too old to do coding late at night, my basic error(s) was some simple typos (in multiple places due to copye&paste) where I didn't see the difference between "l" and "1" (lowercase L and the number 1 (one)) in some identifiers  :(

I somehow thought I was missing something very simple, just before the third cup of coffee in the moring, I didn't realize it was my own fault  :-[

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2006
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Any example on how to get the "text" property of a tLabeledEdit?
« Reply #4 on: March 28, 2023, 06:19:12 pm »
Thanks guys!
You are welcome.

I somehow thought I was missing something very simple, just before the third cup of coffee in the moring, I didn't realize it was my own fault  :-[
For that reason it is most often way better to show code instead of writing so we could easy say: hey, that should be a "1" instead of a "l"
 :-*
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Bitbeisser

  • New Member
  • *
  • Posts: 28
Re: Any example on how to get the "text" property of a tLabeledEdit?
« Reply #5 on: March 28, 2023, 08:40:34 pm »
I somehow thought I was missing something very simple, just before the third cup of coffee in the moring, I didn't realize it was my own fault  :-[
For that reason it is most often way better to show code instead of writing so we could easy say: hey, that should be a "1" instead of a "l"
 :-*
Well, I noticed this myself just when I was trying to copy a piece of the source code to post here. As I wanted to remove a couple of irrelevant lines first, I pasted it into a plain text editor, which had a much larger font set as in the Lazarus IDE. That's when it hit me... ;-)
Besides that I had another cup of coffee by that time..  8)


 

TinyPortal © 2005-2018