?
Solved

How to get text out a TCustomLabel

Posted on 1999-06-25
6
Medium Priority
?
214 Views
Last Modified: 2012-05-04
How can I get the text out a TCustomLabel

if Controls[i] is TCustomLabel then
  Text := TCustomLabel(Controls[i]).(Want to get the text);

Is their any way exept to use

if Controls[i] is TLabel then
  Text := TCustomLabel(Controls[i]).caption;
0
Comment
Question by:delpro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 15

Expert Comment

by:simonet
ID: 1384571
The ".Caption" way is the correct way of doing it.

Yours,

Alex
0
 
LVL 1

Expert Comment

by:simoraikov
ID: 1384572
Why you don't want to use ".caption"
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1384573
Well, if you are masochistic you can use the WM_GETTEXT API message to get the text from the edit control...

Cheers,

Raymond,

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Accepted Solution

by:
Radler earned 60 total points
ID: 1384574
Using the hierarchy, the property Caption is visible at TLabel, so
if Controls[i] is TLabel   then
      Text := TLabel((Controls[i]).Caption;
end;
How Formx.Controls[i] always is a TControl instace, is valid to do only:
var
      Txt : array[0..128] of char;
Controls[i].GetTextBuffer( Txt, 127 );

try use this with any Control to see the results.

0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 1384575
Hi guys
I think Radler is right.
Simonet: Sorry a TCustomLabel has no caption property.
rwilson: WM_GETTEXT works only for windows (TWincontrols). Since TCustomLabel is a TGraphicControl that uses the parent TWinControl to be drawn, WM_GETTEXT will not work to extract the caption from a TCustomLabel.

Regards, ptm.
0
 

Author Comment

by:delpro
ID: 1384576
It is Controls[i].GetTextBuf( Txt, 127 ); and not
  Controls[i].GetTextBuffer( Txt, 127 );
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question