Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
LCL
»
custom component with different properties
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
Initializing an array
by
jamie
[
Today
at 05:35:14 pm]
PostgreSQL: typeinfo erro...
by
Чебурашка
[
Today
at 04:50:52 pm]
Default and speed effect
by
Martin_fr
[
Today
at 04:45:25 pm]
Is Meta programming possi...
by
ASerge
[
Today
at 04:39:06 pm]
Sevenzip. Pas with multiv...
by
datilas
[
Today
at 04:33:37 pm]
Hole punching - Step by S...
by
ginoo
[
Today
at 04:25:22 pm]
Error in Sway
by
AmatCoder
[
Today
at 04:02:28 pm]
Google Snappy bindings fo...
by
Okoba
[
Today
at 03:39:37 pm]
CEF4Delphi under Ubuntu C...
by
myisjwj
[
Today
at 02:51:10 pm]
how to download fulling f...
by
af0815
[
Today
at 02:36:40 pm]
Why is the rectangle the ...
by
zeljko
[
Today
at 02:35:37 pm]
lhelp not working on Linu...
by
zeljko
[
Today
at 02:33:47 pm]
Anonymous Unions-Middle R...
by
Warfley
[
Today
at 02:31:22 pm]
How to download a file fr...
by
maurobio
[
Today
at 01:55:45 pm]
min() function behavior i...
by
tetrastes
[
Today
at 10:17:25 am]
Dark mode in app - white ...
by
d7_2_laz
[
Today
at 10:11:37 am]
BoxChart cannot be color ...
by
wp
[
Today
at 10:10:50 am]
Help for downloand file
by
rvk
[
Today
at 09:29:43 am]
Installing GDB on MAC OS ...
by
dbannon
[
Today
at 01:53:46 am]
Magic, non referenced var...
by
jamie
[
Today
at 01:33:46 am]
Are We Dead Yet?
by
Joanna
[
Today
at 12:27:08 am]
How to dock Stack and Pro...
by
Molochnik
[May 30, 2023, 11:20:19 pm]
[Solved] OnMouseDown - Ho...
by
marcio2003
[May 30, 2023, 08:46:43 pm]
LazPaint (alpha-blending,...
by
CM630
[May 30, 2023, 08:35:04 pm]
process exeuction with in...
by
Edson
[May 30, 2023, 05:33:56 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: custom component with different properties (Read 310 times)
Espectr0
Full Member
Posts: 156
custom component with different properties
«
on:
March 27, 2023, 01:20:37 am »
Hola,
is it possible to make a component that has certain properties in windows and not in macos?
and when loading the project in macos the error "property not found..." does not appear?
Would we have to modify the lfm every time?
thanks
Logged
jamie
Hero Member
Posts: 5332
Re: custom component with different properties
«
Reply #1 on:
March 27, 2023, 01:31:38 am »
you can simply put a dummy property in there.
in code you can use some compiler test to check for the OS being targeted and decide not to include code.
At least that way you won't have that problem.
This is why they make widget interfaces.
Logged
The only true wisdom is knowing you know nothing
KodeZwerg
Hero Member
Posts: 1396
Fifty shades of code.
Re: custom component with different properties
«
Reply #2 on:
March 27, 2023, 01:44:22 am »
Code: Pascal
[Select]
[+]
[-]
program
Project1
;
type
TMyString
=
class
strict
private
FString
:
string
;
published
{$IFDEF MSWINDOWS}
property
MyString
:
string
read
FString
write
FString
;
{$ENDIF}
end
;
var
MyString
:
TMyString
;
begin
MyString
:
=
TMyString
.
Create
;
try
// the next line works exclusive under windows
// all other OS do not have the "MyString" property
MyString
.
MyString
:
=
'Some string'
;
finally
MyString
.
Free
;
end
;
end
.
Logged
«
Last Edit:
Tomorrow
at 31:76:97 by
KodeZwerg
»
jamie
Hero Member
Posts: 5332
Re: custom component with different properties
«
Reply #3 on:
March 27, 2023, 01:46:56 am »
and what happens when you move the project to MACos ?
The Lfm file still contains a property name that could of been set in the windows target.
Logged
The only true wisdom is knowing you know nothing
Espectr0
Full Member
Posts: 156
Re: custom component with different properties
«
Reply #4 on:
March 27, 2023, 10:01:12 am »
I think one of the most practical solutions could be to move the properties from "published" to "public" with their conditionals and thus they would not be saved in the lfm.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
LCL
»
custom component with different properties
TinyPortal
© 2005-2018