Recent

Author Topic: IDE: Property editor does not show all possible values of a property  (Read 534 times)

CM630

  • Hero Member
  • *****
  • Posts: 1689
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
In a TComponent there is:

Code: Pascal  [Select][+][-]
  1. TFlowControl=(fcNone=0,
  2. fcXonXoff=1, fcXonXoff_and_DTR=1,
  3. fcRTS_CTS=2, fcHardware = 2,
  4. fcXonXoff_no_DTR=3,
  5. fcXonXoff_and_RTS_CTS=4,
  6. fcDTR_DSR=5,
  7. fcXonXoff_and_DTR_DSR=6,
  8. fcDTR=7);
  9. ...
  10. published:
  11. ...
  12.     property FlowControl: TFlowControl read FFlowControl write SetFlowControl;
  13. ...
  14.  

When I build the IDE the last two values (fcXonXoff_and_DTR_DSR and fcDTR) are not shown in the property editor.
Is this fixable?


In case in matters, the control is TLazSerial. I am trying to update the FlowControl property by adding more values and renaming the non-standard fcHardware to fcRTS_CTS. In the same time I want to keep the compatibility from the previous versions.

Edit: I tried to change:
Code: Pascal  [Select][+][-]
  1. TFlowControl=(fcNone=0, fcXonXoff_and_DTR=1, fcRTS_CTS=2, fcXonXoff_no_DTR=3,fcXonXoff_and_RTS_CTS=4, fcDTR_DSR=5, fcXonXoff_and_DTR_DSR=6, fcDTR=7,
  2.                  fcXonXoff=1, fcHardware = 2);
When I opened the project fcHardware was automatically converted to ... fcDTR. Maybe because it is the first in alphabetic order.
« Last Edit: April 16, 2026, 03:39:02 pm by CM630 »
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

dsiders

  • Hero Member
  • *****
  • Posts: 1613
Re: IDE: Property editor does not show all possible values of a property
« Reply #1 on: April 16, 2026, 07:04:22 pm »
In a TComponent there is:

Code: Pascal  [Select][+][-]
  1. TFlowControl=(fcNone=0,
  2. fcXonXoff=1, fcXonXoff_and_DTR=1,
  3. fcRTS_CTS=2, fcHardware = 2,
  4. fcXonXoff_no_DTR=3,
  5. fcXonXoff_and_RTS_CTS=4,
  6. fcDTR_DSR=5,
  7. fcXonXoff_and_DTR_DSR=6,
  8. fcDTR=7);
  9. ...
  10. published:
  11. ...
  12.     property FlowControl: TFlowControl read FFlowControl write SetFlowControl;
  13. ...
  14.  

When I build the IDE the last two values (fcXonXoff_and_DTR_DSR and fcDTR) are not shown in the property editor.
Is this fixable?


In case in matters, the control is TLazSerial. I am trying to update the FlowControl property by adding more values and renaming the non-standard fcHardware to fcRTS_CTS. In the same time I want to keep the compatibility from the previous versions.

Edit: I tried to change:
Code: Pascal  [Select][+][-]
  1. TFlowControl=(fcNone=0, fcXonXoff_and_DTR=1, fcRTS_CTS=2, fcXonXoff_no_DTR=3,fcXonXoff_and_RTS_CTS=4, fcDTR_DSR=5, fcXonXoff_and_DTR_DSR=6, fcDTR=7,
  2.                  fcXonXoff=1, fcHardware = 2);
When I opened the project fcHardware was automatically converted to ... fcDTR. Maybe because it is the first in alphabetic order.

You can't have duplicate ordinal values in the enumeration. The alphabetic order is probably a property editor artifact.

Raskaton

  • New Member
  • *
  • Posts: 27
As I know, you can't use non default order at all. Only started from 0, and no pass values.
For published properties TComponent in IDE, and for RTTI components, only this allowed:
Code: Pascal  [Select][+][-]
  1. TFlowControl = (fcNone,
  2. fcXonXoff, fcXonXoff_and_DTR,
  3. fcRTS_CTS, fcHardware,
  4. fcXonXoff_no_DTR,
  5. fcXonXoff_and_RTS_CTS,
  6. fcDTR_DSR,
  7. fcXonXoff_and_DTR_DSR,
  8. fcDTR);
Code: Text  [Select][+][-]
  1. Ord(fcNone) = 0
  2. Ord(fcDTR) = 9
  3. TFlowControl(1) = fcXonXoff
  4.  
And don't use underscores ('_') in names. Pascal style is CamelCase: fcXonXoffRtsCts  :-[

n7800

  • Hero Member
  • *****
  • Posts: 693
  • Lazarus IDE contributor
    • GitLab profile
As I know, you can't use non default order at all. Only started from 0, and no pass values.

Do you mean just the published properties or in general? Because it's possible in the language itself, and it's a good replacement for many separate constants with a single type with assignment checks.

Raskaton

  • New Member
  • *
  • Posts: 27
Do you mean just the published properties or in general?
I mean IDE Property editor case. And RTTI visual component TTIPropertyGrid. If component just for streaming to file/clipboard it is fine.

 

TinyPortal © 2005-2018