Ticket Q103874
Visible to All Users

How to deal with TdxBarButton ButtonStyle = bsChecked

created 17 years ago

Hi,
I have somes issues with the tdxBarButton.
How can i do :
A tdxBarButton with the property butonstyle = bsChecked is in the mainmenu of the TdxbarManager on a form.
In the connected action's execute method, some test/action is done and controls if the menuitem must be checked or not, independantly from the existing check status (not like a toggle check button).
I have tried to do it without success. How can I do it ??
Regards,
Eddy
PS : When I use an anothe action to do it, it works. VCL is working perfectly. I join a test case.

Show previous comments (6)
Serge (DevExpress Support) 17 years ago

    Thank you for the new details, Eddy. Yes, the standard TMenuItem has an extra property - AutoCheck, which is missing from the ExpressBars buttons. By design, an ExpressBars button automatically changes its Down property value when clicked. We use this approach from the very first editions of the ExpressBars, and many our users rely on this. So, it must be maintained.
    As a solution, "detach" the BarButton from your Action, and update its Down state from within the Action's OnUpdate event handler:

    Delphi
    procedure TForm1.Action1Update(Sender: TObject); begin dxBarButton1.Down := Action1.Checked; end;

    Another way out is to modify the ExpressBars' source code. Just comment some lines in two procedures, as shown:

    Delphi
    dxBar.pas 1) procedure TdxBarButton.Click; begin // if Enabled and (bstChecked in FInternalStates) then // Down := not Down; inherited Click; end; 2) procedure TdxBarButtonControl.ControlUnclick(ByMouse: Boolean); begin if not ByMouse or (FHotPartIndex = bcpButton) then begin // if (ButtonItem <> nil) and (bstChecked in ButtonItem.FInternalStates) then // ButtonItem.Down := not ButtonItem.Down; ControlInactivate(True); inherited; end; end;

    Will this meet your requirements?
    Thanks,
    Serge

    EP EP
    EUROPEAN PAYMENT 17 years ago

      Thank you Serge,
      The first solution gives the expected result. You can close the ticket.
      Regards,
      Eddy POULLET

      Serge (DevExpress Support) 17 years ago

        Hi Eddy,
        Thank you for the good news. I'm glad that our assistance was helpful.
        If you need any further assistance on this subject, please feel free to reactivate this ticket.
        Thanks,
        Serge

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.