Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If the MinValue and MaxValue are already properties of your component/control, but are currently public and not published all you need to do is re-declare them in the published section, but only by name:</p> <pre><code>published property MinValue; property MaxValue; </code></pre> <p>That'll change only the visibility of those properties and should make them show up in the object inspector if their types are supported. Have a look at many of the T... versus TCustom... class pairs where the T... class often only redeclares properties as published to make them show up in the Object Inspector.</p> <p><strong>Edit</strong> (In response to comments)</p> <p>Ok, hang on, if you want to have some control, say a TMyEdit with say a SomeFactor Integer property for which the entry in the Object Inspector would not only show the value of SomeFactor, but also the min and max values allowed for SomeFactor, you'll need a to code property editor that shows its own form.</p> <p>You can of course add the MinValue and MaxValue to a descendant of TIntegerProperty and use those in the overrides for the GetValue and SetValue methods (that's why they are virtual after all), then register this TMinMaxIntegerProperty for use by the SomeFactor property. However, that won't make the MinValue and MaxValue show up in the Object Inspector as the TIntegerProperty basically only edits/shows the actual value for SomeFactor. To achieve what you want, you would have to code a descendant of a custom property editor, for example one that shows a form to edit and format a string. There are plenty of examples in the components I use, but I can't post their code here of course.</p> <p>If what you want is simply a TMyEdit with a SomeFactor integer property and want to add a SomeFactorMinValue and a SomeFactorMaxValue to your TMyEdit control, then you can access those in the GetValue/SetValue methods through the Instance reference of the FPropList entry. See SetOrdValue implementation that is used in the TIntegerProperty editor for info. It employs SetOrdProp (from TypInfo) to set the value for on Instance which should be a reference to the TMyEdit control holding the SomeFactor property. With some casting you should then be able to the SomeFactorMinValue and SomeFactorMaxValue properties.</p> <p><strong>Note</strong>: Not sure how the FPropList gets its entries. It gets its count through the constructor though. You may have to do some further investigation here yourself. (For some reason Ctrl-click and code-insight have decided to go on strike in my D2009.)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload