Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 18438, TValueListEditor - Missing Functionality

by Elahn Ientile Email: bdn@elahn.net


The TValueListEditor is missing a vital function, making the ItemProp.MaxLength property useless.
Download Details
FTP  download also available 0 bytes
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 6.0  to 6.0 11 downloads
Copyright: No significant restrictions


Size: 0 bytes
Updated on Fri, 26 Jul 2002 02:43:29 GMT
Originally uploaded on Fri, 26 Jul 2002 02:33:52 GMT
Description
In the TValueListEditor in Delphi 6, there is a missing function, "GetEditLimit". The absence of this function leaves this component missing necessary functionality.

So what functionality is missing? You cannot set the MaxLength of a 'Value' through its ItemProp, or rather you can set it, but it doesn't work.

For example:
ValueListEditor1.ItemProps[0].MaxLength := 25;

The above piece of code sets the maximum length of the 'Value' section of the first item in ValueListEditor1. This is supposed to behave in the same way as the MaxLength property of the standard Edit box.

What is needed to make it work? The following function "GetEditLimit" needs to be overriden from TCustomGrid:

----------------
protected function GetEditLimit: Integer; override;

function TValueListEditor.GetEditLimit: Integer;
var
ItemProp: TItemProp;
begin
ItemProp := FStrings.FindItemProp(Row-FixedRows);
if Assigned(ItemProp) then
Result := ItemProp.MaxLength else
Result := 0;
end;
----------------

Unfortunately, because FStrings is private, you can't inherit TValueListEditor in you own component and simply add this function. The easiest solution would be for Borland to add this function and issue an update.

So how can you do it? Copy the entire ValEdit unit, rename it and rename TValueListEditor. Add the function. Add a 'register' procedure, and put your the new component on the component palette. Not an elegant solution, but a temporary solution.

   Latest Comments  View All Add New

Move mouse over comment to see the full text
Reply  Posted by Kevin Jesshope on Jul 28 2002
TValueListEditor - Missing Functionality

Server Response from: ETNACDC03