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
Threads - stringlist and ...
by
Warfley
[
Today
at 07:11:05 pm]
MemDataset validate not d...
by
eldonfsr
[
Today
at 07:02:49 pm]
New version of BGRABitmap
by
circular
[
Today
at 05:18:09 pm]
first generic attempt
by
Paolo
[
Today
at 04:59:25 pm]
Best way to delete an ins...
by
Handoko
[
Today
at 04:46:46 pm]
Bluetooth on Raspberry, d...
by
pascalbythree
[
Today
at 04:21:35 pm]
Are We Dead Yet?
by
Joanna
[
Today
at 04:09:25 pm]
Online Package Manager
by
GetMem
[
Today
at 03:54:17 pm]
Non-local goto example ne...
by
alpine
[
Today
at 01:56:19 pm]
Can't load because <x> de...
by
marcov
[
Today
at 01:23:43 pm]
Hole punching - Step by S...
by
nummer8
[
Today
at 12:04:20 pm]
Providing *.deb files for...
by
TRon
[
Today
at 11:49:40 am]
Insert variant array to e...
by
TRon
[
Today
at 11:36:03 am]
Load local HTML file into...
by
c4p
[
Today
at 10:27:28 am]
LAMW - simple esc/POS pri...
by
Mongkey
[
Today
at 02:46:21 am]
ZenGL +android + MacOS Co...
by
Seenkao
[
Today
at 02:34:38 am]
[SOLVED] Using high inste...
by
lagprogramming
[May 27, 2023, 07:50:48 pm]
LAMW - default manifest r...
by
jmpessoa
[May 27, 2023, 07:25:21 pm]
Improvements in rtl/objpa...
by
PascalDragon
[May 27, 2023, 06:35:26 pm]
Optimization of for loops...
by
lagprogramming
[May 27, 2023, 03:56:09 pm]
How to download a file fr...
by
maurobio
[May 27, 2023, 02:58:43 pm]
Solved- TSQLQuery.ExecSQL...
by
br4d
[May 27, 2023, 02:26:56 pm]
[Solved] Help with spellc...
by
Espectr0
[May 27, 2023, 12:04:11 pm]
[SOLVED] How to get recei...
by
cdbc
[May 27, 2023, 10:04:41 am]
Reading MAC address of Ac...
by
Jurassic Pork
[May 27, 2023, 07:56:41 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: custom component with different properties (Read 307 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: 5315
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: 1395
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: 5315
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