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
Lazarus.exe does nothing ...
by
wp
[
Today
at 08:23:50 pm]
FPC 3.2.2 / Lazarus 2.2.6...
by
robert rozee
[
Today
at 08:21:47 pm]
Is it possible to jump in...
by
Dzandaa
[
Today
at 07:54:12 pm]
is there a way to Forward...
by
440bx
[
Today
at 07:24:23 pm]
GTK 3 Widget Set Status?
by
zeljko
[
Today
at 06:20:21 pm]
weirdness with fnmatch (l...
by
robert rozee
[
Today
at 05:54:06 pm]
SaveDialog asks for filen...
by
gjunk
[
Today
at 03:50:26 pm]
Saving a Form state (rela...
by
Curt Carpenter
[
Today
at 03:50:01 pm]
Stem and Leaf Plot and In...
by
Zvoni
[
Today
at 03:43:51 pm]
Creating a new unit out o...
by
Okoba
[
Today
at 03:13:28 pm]
Hypocycloid demo
by
lainz
[
Today
at 03:08:18 pm]
Large system, i2C to go w...
by
pascalbythree
[
Today
at 02:14:59 pm]
Linker error with LLVM 15...
by
ChrisR
[
Today
at 01:36:49 pm]
Class Change Color Edit a...
by
emivaldo
[
Today
at 01:19:39 pm]
[fpspreadsheet] Cannot co...
by
veb86
[
Today
at 01:07:53 pm]
LazPaint Plugins
by
circular
[
Today
at 01:02:10 pm]
[SOLVED] QRCode component
by
Pe3s
[
Today
at 12:35:31 pm]
[solved] Confusing scope(...
by
TRon
[
Today
at 12:08:06 pm]
[solved] Website(s) where...
by
TRon
[
Today
at 12:00:01 pm]
[SOLVED] Components with ...
by
alpine
[
Today
at 11:32:31 am]
any workaround of nested ...
by
powerpcer
[
Today
at 11:12:52 am]
DBVirtualGrid - processin...
by
wp
[
Today
at 11:08:54 am]
Cannot get file opening e...
by
ranny
[
Today
at 10:06:29 am]
Improvement of DoCopyProp...
by
lagprogramming
[
Today
at 09:51:24 am]
RasPi: How can i detect t...
by
mdalacu
[
Today
at 09:45:24 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: custom component with different properties (Read 369 times)
Espectr0
Full Member
Posts: 171
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: 5691
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: 1644
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: 5691
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: 171
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