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
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
[Solved]Printing unicode ...
by
bobonwhidbey
[
Today
at 05:23:56 am]
Interesting article about...
by
440bx
[
Today
at 04:36:02 am]
had a question and found ...
by
egsuh
[
Today
at 03:57:14 am]
How to set the desktop co...
by
Fibonacci
[
Today
at 02:42:15 am]
MIDI commands
by
finlazarus
[
Today
at 02:26:09 am]
FPSpreadSheet, ReadAsText...
by
andresayang
[
Today
at 02:13:18 am]
Lazarus for Windows on aa...
by
msintle
[
Today
at 01:53:20 am]
Common File Dialogs Have ...
by
msintle
[
Today
at 01:52:27 am]
Game Music Emulator
by
TRon
[
Today
at 01:23:56 am]
Constants in constant exp...
by
440bx
[December 08, 2024, 11:41:59 pm]
ColorDialog can have opti...
by
Bart
[December 08, 2024, 09:14:55 pm]
Array of String lookup gi...
by
TRon
[December 08, 2024, 09:04:03 pm]
kernel 6.8 and checking s...
by
MarkMLl
[December 08, 2024, 08:12:08 pm]
AVRPascal – free code edi...
by
ackarwow
[December 08, 2024, 07:34:07 pm]
Api/component pack for Ra...
by
MarkMLl
[December 08, 2024, 07:11:01 pm]
SAVE StringGrid to PDF
by
dseligo
[December 08, 2024, 06:37:39 pm]
How to save a Graphic fro...
by
Hartmut
[December 08, 2024, 05:57:03 pm]
Array of String lookup gi...
by
Wilko500
[December 08, 2024, 05:47:16 pm]
Developing a Kernel Modul...
by
Joanna from IRC
[December 08, 2024, 04:35:26 pm]
How to get hash of entire...
by
Warfley
[December 08, 2024, 01:30:18 pm]
IFS Fractals: Iterating t...
by
Dzandaa
[December 08, 2024, 11:51:08 am]
Баги CYBERGRAPHICS AmigaO...
by
Smalovsky
[December 08, 2024, 09:39:52 am]
C operators and shift
by
MarkMLl
[December 08, 2024, 09:33:12 am]
fphttpapp and Windows Ser...
by
Thaddy
[December 08, 2024, 08:36:36 am]
MIDI file generator - wor...
by
finlazarus
[December 08, 2024, 02:49:40 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: custom component with different properties (Read 642 times)
Espectr0
Full Member
Posts: 221
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: 6735
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: 2269
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 xm by
KodeZwerg
»
jamie
Hero Member
Posts: 6735
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: 221
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