Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

ItemEnabled not working when set to False$

I have discovered that a disabled ShortCut item will still fire the OnClick event when you click on it. It does, however, correctly not respond to the mouse as it hovers over it and the item's label is grayed.

The ShortCut bar is on the Frame (Frameworks). I used the following code on a MDI Child create event:
Frame = @APPINFO<13> Set_Property(Frame:".SCB_SIDE", "OLE.ItemEnabled[2; 1]", False$)
When it's convenient, could someone please confirm this behavior?

Using SRP Controls Pro 3.1.0

Thanks.

Comments

  • This behavior is intended. It may seem counter intuitive at first, especially when you equate OnClick to mean "an item click." However, the OnClick event always happens no matter where you click on the control (even if you don't click on an item). So, it is a "click anywhere" event. This approach affords developers the greatest flexibility at the cost of a little less automation. So, you'll have to check the item's enabled state during the event to determine if the logic should continue.

    You might ask, "Why would anyone want the click event to happen when an item is disabled?" Believe it or not, I've encountered a situation in which a client wanted to display a popup when a user clicked on a disabled control that explained why the control was disabled.
  • Thanks for the explanation. Perhaps the help documentation needs to be changed. See the quote below:

    "The ItemEnabled property enables or disables an item. A disabled item will not fire the OnClick event when the user clicks on it."
  • Ouch! I hang my head in shame.

    Fixed.
Sign In or Register to comment.