Subject Re: Tib_Currency.ReadOnly accept delete key.
Author Marco Menardi
--- In IBObjects@yahoogroups.com, "rudi_josic" <rudijosic@c...> wrote:
> Thanks Marco.
>
> I will wait your message.
>
> Best Regards.-
>
> Rudi Josic'.

I'm testing with unbound controls right now, and the quick fix should
be modify IBC_Currency.IMP this way (sobstitute the corresponding
function with the same name with these, and recompile):

procedure TIB_Currency.KeyDown(var Key: Word; Shift: TShiftState);
var
Msg: TMsg;
begin
if EditCanModify then
begin
if (Key = VK_DELETE) then // Canc key
begin
Self.Value := 0;
Text := '';
ResetInLineCalcStatus;
Key := 0;
end
else if ShortCut( key, shift ) = FConversionShortCut then
begin
if Assigned( FBeforeConversion ) then
FBeforeConversion( Self );
ConvertCurrency;
SetCursor(Length(Text));
Key := 0; // stop further KeyDown processing (but does not
avoids processing on KeyPress! VCL mystery)
PeekMessage( Msg, Handle, WM_CHAR, WM_CHAR, PM_REMOVE ); // stop
eventual further processing by KeyPress (no, Key := 0 is not enough)
end;
end;
inherited;
end;


Please, test this fix for few days, and let me know (do you use it
with read-only fields as well?).
At least a form with only some unbound IB_Currency controls with
ReadOnly set to true, when you enter one of them (and the content is
selected) and press Enter, an exception is raisen. This seems harder
to fix, though.
Best regards
Marco Menardi