Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
[Solved]How can I make a descendent of a TCustomLabeledEdit
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
How to: create DLL file f...
by
paule32
[
Today
at 09:24:19 pm]
Poll: Watches and Display...
by
Martin_fr
[
Today
at 09:20:13 pm]
Converting a string/index...
by
1HuntnMan
[
Today
at 08:48:12 pm]
Linux Workspaces -- StayO...
by
AmatCoder
[
Today
at 08:34:20 pm]
I just released a commerc...
by
Seenkao
[
Today
at 07:57:21 pm]
what to do if my target M...
by
Thaddy
[
Today
at 07:54:39 pm]
Access violation when re-...
by
TRon
[
Today
at 07:37:31 pm]
[SOLVED] assembler name i...
by
TRon
[
Today
at 07:26:33 pm]
Database standards OR Am ...
by
wpflum
[
Today
at 07:18:20 pm]
A fairly simple sound sol...
by
KodeZwerg
[
Today
at 07:01:52 pm]
Step-into the field sette...
by
Martin_fr
[
Today
at 06:54:19 pm]
[Fun Fact] PNG and Micros...
by
Ten_Mile_Hike
[
Today
at 06:24:19 pm]
Demoscene The Champs Crac...
by
KodeZwerg
[
Today
at 06:20:31 pm]
HTTP/2+HTTP/1.1+WebSocket...
by
iLya2IK
[
Today
at 06:14:30 pm]
Improvement of TFPTimerTh...
by
AlexTP
[
Today
at 05:56:38 pm]
Arabic text, problem on L...
by
nouzi
[
Today
at 05:21:27 pm]
WKWebView takeSnapshot
by
MISV
[
Today
at 04:53:41 pm]
Question for people who h...
by
VisualLab
[
Today
at 04:46:24 pm]
Slow copying of small str...
by
Nitorami
[
Today
at 04:41:52 pm]
location of non visual co...
by
gerardus
[
Today
at 04:16:44 pm]
How to get along with the...
by
BrassGear
[
Today
at 03:24:10 pm]
Assign (textfile) not com...
by
Thaddy
[
Today
at 03:16:52 pm]
[Solved] Find child contr...
by
Handoko
[
Today
at 03:01:47 pm]
lazarus-project_3.2.0-0_a...
by
Edgardo M. López
[
Today
at 02:29:07 pm]
Azure sql database will n...
by
wpflum
[
Today
at 02:18:43 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [Solved]How can I make a descendent of a TCustomLabeledEdit (Read 333 times)
bobonwhidbey
Hero Member
Posts: 592
[Solved]How can I make a descendent of a TCustomLabeledEdit
«
on:
April 01, 2023, 06:50:51 pm »
I'm trying to make a new component but
TMyComp = class(TCustomLabelEdit)
doesn't work even though ExtCtrls is in my Uses clause.
«
Last Edit: April 01, 2023, 08:21:26 pm by bobonwhidbey
»
Logged
Lazarus 3.0RC2, FPC 3.2.2 x86_64-win64-win32/win64
wp
Hero Member
Posts: 11916
Re: How can I make a descendent of a TCustomLabeledEdit
«
Reply #1 on:
April 01, 2023, 07:00:57 pm »
What isn't working? And what should be different from TCustomLabeledEdit?
The following demo is working. It creates a TMyComp component as descendant of TCustomLabeledEdit in which the label font color defaults to red.
Code: Pascal
[Select]
[+]
[-]
unit
Unit1
;
{$mode objfpc}{$H+}
interface
uses
Classes
,
SysUtils
,
Forms
,
Controls
,
Graphics
,
Dialogs
,
ExtCtrls
;
type
TMyComp
=
class
(
TCustomLabeledEdit
)
public
constructor
Create
(
AOwner
:
TComponent
)
;
override
;
end
;
{ TForm1 }
TForm1
=
class
(
TForm
)
procedure
FormCreate
(
Sender
:
TObject
)
;
private
myComp
:
TMyComp
;
public
end
;
var
Form1
:
TForm1
;
implementation
{$R *.lfm}
constructor
TMyComp
.
Create
(
AOwner
:
TComponent
)
;
begin
inherited
;
EditLabel
.
Font
.
Color
:
=
clRed
;
end
;
{ TForm1 }
procedure
TForm1
.
FormCreate
(
Sender
:
TObject
)
;
begin
myComp
:
=
TMyComp
.
Create
(
self
)
;
myComp
.
Left
:
=
8
;
myComp
.
Top
:
=
24
;
myComp
.
Width
:
=
200
;
myComp
.
Parent
:
=
self
;
myComp
.
EditLabel
.
Caption
:
=
'My new component'
;
myComp
.
Text
:
=
'This is a test.'
;
end
;
«
Last Edit: April 01, 2023, 07:03:40 pm by wp
»
Logged
Blaazen
Hero Member
Posts: 3237
POKE 54296,15
Re: How can I make a descendent of a TCustomLabeledEdit
«
Reply #2 on:
April 01, 2023, 07:02:33 pm »
It is "Labeled". A typo, I guess. And yes, it is in ExtCtrls.
Code: Pascal
[Select]
[+]
[-]
TMyComp
=
class
(
TCustomLabeledEdit
)
Otherwise I cannot imagine how it cannot be subclassed.
Logged
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/
bobonwhidbey
Hero Member
Posts: 592
Re: How can I make a descendent of a TCustomLabeledEdit
«
Reply #3 on:
April 01, 2023, 08:21:11 pm »
Thanks Blaazen....just a dumb typo :'(
Logged
Lazarus 3.0RC2, FPC 3.2.2 x86_64-win64-win32/win64
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
[Solved]How can I make a descendent of a TCustomLabeledEdit
TinyPortal
© 2005-2018