Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How to hide a whole Tactionmanager category


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 5 - Last Post: Dec 13, 2017 5:56 AM Last Post By: Adriano Macome
Adriano Macome

Posts: 56
Registered: 9/26/11
How to hide a whole Tactionmanager category  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 12, 2017 12:12 PM
Hello;

Hidding action is easy, as we can use ActionName.Visible property. But how can we hide a whole category if we don't know how to find it by name?

For example, I have 3 actions on the same category. Then I inserted that category in a menu bar. I want to hide that category. How do I refer to it?.

Thank you !

Adriano.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How to hide a whole Tactionmanager category  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 12, 2017 2:00 PM   in response to: Adriano Macome in response to: Adriano Macome
Adriano Macome wrote:

Hidding action is easy, as we can use ActionName.Visible property.
But how can we hide a whole category if we don't know how to find it
by name?

For example, I have 3 actions on the same category. Then I inserted
that category in a menu bar. I want to hide that category. How do I
refer to it?.

Action categories are only really used by TActionList for grouping
purposes at design-time. They are not actually used at runtime, and
certainly not by TActionMainMenuBar, for instance (except when you drag
a Category from a TActionManager to a TActionMainMenuBar at
design-time).

To do what you are asking for, you could loop through your TActionList
one action at a time, hiding the actions that have the desired
Category. But that will only hide the child menu items, not the
top-level menu items. For those, you can use the
TActionMainMenuBar.ActionControls[] property (if you are using
TActionMainMenuBar, that is), setting the ActionControls[index].Visible
property of the desired top-level item(s) to False. Then you don't
have to touch your TActionList items at all.

--
Remy Lebeau (TeamB)
Adriano Macome

Posts: 56
Registered: 9/26/11
Re: How to hide a whole Tactionmanager category  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 13, 2017 3:34 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thank you Remy;
I understand. But let me say this is not very good. I think we need a chance to access by name even categories. Or at least, when they are used as a menu item.

Best regards!
Adriano Macome

Posts: 56
Registered: 9/26/11
Re: How to hide a whole Tactionmanager category  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 13, 2017 4:50 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Sorry Remy;

How do I access to the item if it is a sub-menu item?. ActionMMBar.ActionControls gives me a way to navigate main items. But I can't find how to navigate subitems of each main item. I tried lots of thigns, for example casting this way:

TActionClientItem(ActionMMBar.ActionControls[...]).Items[...]

How do I find sub-items?

Thank you!

Adriano Macome

Posts: 56
Registered: 9/26/11
Re: How to hide a whole Tactionmanager category  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 13, 2017 5:23 AM   in response to: Adriano Macome in response to: Adriano Macome
For example, I try:

s := TActionClientItem(ActionMMBar.ActionControls[1]).Items[2].Caption;

it compiles, but I get "invalid typecast" at runtime.
Adriano Macome

Posts: 56
Registered: 9/26/11
Re: How to hide a whole Tactionmanager category  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 13, 2017 5:56 AM   in response to: Adriano Macome in response to: Adriano Macome
Hi Remy;

I found a solution!!. It is possible to create an action on the action manager, with no category. So I created one, and then I set it as the action property for the menu item.

Then if I hide this action, the menĂș item is hidded too.

It works!.

Thank you for your help and best regards.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02