Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Share Me

  • Please share this topic with your friends. Click any of the icons below:
  • Twitter
  • facebook
  • reddit
  • email

TElXTree: OnCheckBoxChanging(...)

I would like a new event: OnCheckBoxChanging(Sender ..., PreviousItem : TElXTreeItem; ProposedItem : TElXTreeItem; var AllowChange : Boolean);

In this event I could check if PreviousItem is nil or an item that was previously selected and update data accordingly.

I could also disallow the change of selected item by setting AllowChange to False. I would do this in the case of unfinished processing by the user for the selected item, for example.

Thanks.
Raymond

Comments

  • 5 Comments sorted by Votes Date Added
  • Sorry, a change in the request:

    OnCheckBoxChanging(Sender ..., PreviousItem : TElXTreeItem; ProposedItem : TElXTreeItem; var AllowChange : Boolean; var NewCheckBoxState : Boolean);

    I want to be able to set the NewCheckBoxState to True if I want the item checked regardless of its previous state.

    In particular, I also need to set the NewCheckBoxState to False regardless of its previous state.

    Regards,
    Raymond
  • The event added 

    OnItemCheckStateChanging(Sender: TObject;
      Item: TElXTreeItem; OldValue: Integer; var NewValue: Integer;
      var AllowChange: Boolean);

    OldValue and NewValue are integers to unify event for both boolean chechbox/radiobutton and tri-state checkbox.

    As you might notice, params "PreviousItem : TElXTreeItem; ProposedItem : TElXTreeItem;" are not included.
  • Will this event be called twice? Once for the radiobutton that is currently checked and once for the radiobutton that is going to be checked?

    What would happen if the currently-active radio is not allowed to change?

    Is this even called if a radiobutton is clicked on whilst it is already active?
    This would be useful for deactivating (unchecking) a radiobutton, as I could set NewValue to -1 and AllowChange to True.

    Raymond
  • Posts: 0 Accepted Answer Vote Up0Vote Down
    The OnItemCheckStateChanging is triggered just before the state of checkbox/radiobutton is going to be changed after user clicked mouse button on item's checkbox/radiobutton (or anywhere in the item if RowCheck property is set to true)
Sign In or Register to comment.