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.
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.
Dear Eddy,
I've examined your sample, and, to be honest, it looks confusing. First, it doesn't contain any bsChecked button. Moreover, the purpose of the following event handler is unclear to me:
procedure TForm1.Action1Execute(Sender: TObject); begin // I want that the check status is determined by the code // The next line is not taken account....... Action1.Checked := True; // or Action1.Checked := False; end;
Are you sure this sample illustrates the described situation? Could you please explain your requirements in greater detail?
By the way, you're using an older build of our components. Please visit our version info page at http://www.devexpress.com/Support/Versions.xml, to learn about the most recent versions of our products, and obtain instructions on how to update them.
Thanks,
Serge
Hi,
You are right concerning the property bsChecked. Sorry.
The first subitem (dxBarButton1) must be have the property bsChecked.
The two others subitems shows only that status of the first subitem can be changed by an another
action.
But the goal (and the question) is to change the status of the first subitem inside the connected action itself
(Action1Execute). I have used too a postmessage but it doesn't work. The subitem reacts always as toggle.
Regards,
Eddy POULLET
Thank you for the clarification, Eddy. I've modified the button's state, and your sample seems to operate correctly now. I've attached its executable compiled with the most recent ExpressBars 6.35. Please test it at your end, and let me know your results.
Thanks,
Serge
Sorry, Serge,
but obvioulsy it doesn't work. With your executable like my one, the toggle behavior is always there.
My goal is that the defined state (and only that one) in the action1 becomes the effective state.
In the sample, the Action1Execute asks that the ( Action1.Checked := True; ) menu item stays checked after one, two or thousand click. It is not the case, it toggles always.
Thanks for the help.
Hi Eddy,
But this is how other VCL components work. For example, put a TCheckBox onto the same form and bind it to Action1. Clicking the CheckBox will fire the Action's OnExecute event, but the checkbox's will be toggled on every click. We just implement the same behavior in our components.
Thanks,
Serge
Hi Serge,
No, it is not right (the VCL has a property autocheck to control it) . I join a sample with a menuitem with a check build with VCL component. You can see that the code can keep complete control on the checked state. It is a verry annoying problem for us, if it is not possible to have the same behavior.
Regards,
PS : More, it's the same problem with your checkbox editor when the program must validate the check status or ask a confirmation of the choice to the user. The behavior is maybe MS "compliant" but it is different from yours others editors.
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:
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:
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
Thank you Serge,
The first solution gives the expected result. You can close the ticket.
Regards,
Eddy POULLET
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