Subject Re: IB_Currency bug (KeyDown event)
Author Marco Menardi
Hi Fabio, (I also received your "private" mail).
Seems that it could be a "legacy" flag, since in windows previous
Win98 you could hot have a "right aligned" TEdit if not also
"multiline" (I've found this page:
http://www.scalabium.com/faq/dct0034.htm).
I've done some (very quick) test with your patch, and seems to work,
but I would need more time to do better tests (and, please, you do
also, in as much modes as you can).
This seems also to solve the problem that if you have IB_Currency in a
dialog (ButtonStyle must be ebsNone), if you press "enter" you will
not "fire" the default OK button (the same should be for IB_Date...
but the buttom displayed may prevent this without further investigation).
Thanks for your bug report and for having found a solution!
best regards
Marco Menardi

--- In IBObjects@yahoogroups.com, "Fabio Bot" <fabiobot@y...> wrote:
> Hi,
>
> IB_Currency has a bug that doesn't allow to change the focus in the
> event KEYDOWN.
>
> Create a new form and put two components IB_Currency:
> IB_Currency1 and IB_Currency2
>
> Now put the following code in the event KeyDown of IB_Currency1:
> if Key = VK_DOWN then
> IB_Currency2.SetFocus;
>
> Run the program and do type arrow down on first IB_Currency, verify
> that the focus is not going to IB_Currency2.
> Repeat this test with another component as IB_Date, you will see that
> it work's right.
>
> Well, debugging the code I reached the problem that's on the
> CreateParams event from IB_Currency (at IB_Controls.pas).
>
> procedure TIB_Currency.CreateParams(var Params: TCreateParams);
> begin
> inherited CreateParams( Params );
> // ES_MULTILINE necessary for right alignment
> if not (csDesigning in ComponentState) then
> Params.Style := Params.Style or ES_RIGHT or ES_MULTILINE;
> end;
>
> If I remove the "or ES_MULTILINE" then the bug disappears:
>
> procedure TIB_Currency.CreateParams(var Params: TCreateParams);
> begin
> inherited CreateParams( Params );
> if not (csDesigning in ComponentState) then
> Params.Style := Params.Style or ES_RIGHT;
> end;
>
>
> Please Marco Menardi / Jason Wharton,
> Can you put this patch on next release please ?
>
> Thanks in advance,
>
> Fábio Bot.
> Curitiba/PR - Brazil