Gord P 14 Posted August 27 (edited) I have a separator which is the third sub item of the fourth menu item in a ActionMainMenuBar. Because it is a separator there is no action associated with it. I have tried different routes but I am unable to access the Visible property of the item which is available in the Object Inspector at design time. ActionMainMenuBar1->ActionControls[3] gets me to the fourth menu item but I am unable to drill down. I tried ActionMainMenuBar1->ActionControls[3]->ActionClient->Items->Items[2] but could not access the visible property. ChatGPT and CoPilot kept providing the same error proned code. What is the correct way to do this? (edit: I suppose I could assign an action to the separator and set the Visible property of the action to false, but there must be a proper way to access the item's Visible property without creating an action) Edited August 27 by Gord P Share this post Link to post
Gord P 14 Posted August 28 I ended up doing what I mentioned in the edit above. That is, created an action for the separator (changing the caption to "-") and toggled the action. It is a simple enough solution. Share this post Link to post
Gord P 14 Posted August 29 (edited) Now having said that, I just came across a reason why you would want to access the item instead of changing the Action itself. For instance, if you wanted to change the caption of the menu item but you don't want the Action caption changed (say because a different control needs to have the original caption). In this case, accessing the item itself is necessary. This is doable at design time but I can't figure out how to do it at runtime. Anyone have any ideas? edit: Okay I finally figured it out. I was so close. I needed to dynamic_cast it. The correct line is dynamic_cast<TActionClientItem*>(ActionMainMenuBar1->ActionControls[3]->ActionClient->Items->Items[2])->Caption = "Finally!!!"; // or ->Visible = false; Edited August 29 by Gord P 1 Share this post Link to post