Menu ▾ ▴

#2 TEsMenuButton problem with giving button priority.

open
nobody
7
2013-01-13
2003-01-13
Anonymous
No

Exported from Bugzilla, issue 4188.

--- Comment added on 12/16/2002 10:42:44 AM ---
I dropped a menubutton on my form and now when I type a return char into an
edit the menu pops up instead. The edit never sees the char and the menu is
created via the CMDialogKey message. Any suggestions for how to eliminate
this.

I confirmed the compaint. Take it a step further and put a
TButton with Default set to TRUE. Press ENTER anywhere on the form and the
menu drops down instead of the button (which you would expect with Default
to TRUE).

Discussion

  • Robert Love

    Robert Love - 2003-01-14

    Logged In: YES
    user_id=562750

    I can not recreate this bug, using Delphi 7 and the Open
    Source release. Is someone can reproduce please attach a
    test project. It might be easier to track it down.

     
  • Chuck Gadd

    Chuck Gadd - 2003-01-18

    Logged In: YES
    user_id=23191

    I can duplicate this bug using the sourceforge source code.

    A TButton handles this by only processing return if the
    control is active.

    And, to handle the "Default" property of TButton, if default
    is true,
    then the control is ALWAYS active unless another TButton has
    focus.

    We could add a "default" property to TEsMenuButton, and make
    it behave in a similar way. If the TEsMenuButton is
    focused, then it handles the CMDialogKey message. If it is
    not focused, but it's new DEFAULT property is true, then it
    would also handle the message.

    I've got this implemented, and can post the needed changes.

     
  • Jovian

    Jovian - 2003-03-25

    Logged In: YES
    user_id=741836

    I can duplicate the problem and here is the fix to it.

    You need to modify the esmnubtn.pas procedure
    TEsCustomMenuButton.CMDialogKey to look like the
    following Code:

    procedure TEsCustomMenuButton.CMDialogKey(var
    Message: TCMDialogKey);
    begin
    with Message do
    if (KeyDataToShiftState(Message.KeyData) = []) and
    (Focused) then
    begin
    if (CharCode = VK_RETURN) then
    begin
    Click;
    Result := 1;
    end else
    inherited;
    end;

    {Original Code Commented out by J.R. 03/10/2003}
    // with Message do
    // if (CharCode = VK_RETURN) or
    // (KeyDataToShiftState(Message.KeyData) = []) and
    CanFocus then
    // begin
    // Click;
    // Result := 1;
    // end else
    // inherited;
    end;

    Is amazing Turbopower did't fix this major bug. Apperantly the
    developer was working late and did not knew what to type :-)

     

Log in to post a comment.