Trying to add items to a TRadioGroup but no Item Editor or Items property is available - c++builder

I'm trying to create a 4-button radio group on a Form using the TRadioGroup component. I can add the radio group, but I can't add any items to it.
The documentation gives two ways of doing this: the 1st way is to right-click the group box and select "Item Editor", and the 2nd way is to edit the Items property in the Object Inspector. However I have no Item Editor selection available on right-click, and no Items property in the Object Inspector.
Is there something in the setup that I've missed here, or will I have to resort to using a TGroupBox and adding individual TRadioButton control to it?

Related

How to add a label and edit controls inside an already existing groupbox in a design mode using delphi

As one of my requirements, I have to add a label and edit field to an existing groupbox in delphi. But how many times, i add a label inside an existing groupbox it disappears or it wont get added. Is there an alternative way to do this?
Am not sure why but am able to add edit but not label
I'm going to take a wild guess here. You are adding new components without first selecting the group box in the design surface. When you do that the component becomes a child of the form and disappears beneath other controls.
Here's how to do it:
Click on the group box on the form design surface,
then double click on the label in the palette.
Alternatively:
Single click on the label in the palette,
then single click on the group box on the form design surface.
If you do get the component parent/child relationships messed up, you can inspect them in the Object TreeView (open this from the View menu). If the relationships are wrong, drag the child controls around in the Object TreeView, and drop them into their desired parents.

Style a firemonkey combobox component

Trying to get a new style on a ComboBox in FireMonkey (XE2).
But for some odd reason I cannot get the text of a ListBoxItem to show.
What I've tried is the following.
Create a new FireMonkey HD Application.
On the form I've added a ComboBox.
Right click on the ComboBox and select 'Edit custom style'
There I've added the following components
while the original one consist out of the following components
Now it seems to me that I need the TContent object (but I can't seem to find it in the toolpallete)
How can i bind my Text object to the strings that are placed in my ComboBox?
Any pointers are very welcome.
FireMonkey doesn't use a TText object to display the text. Instead it creates a copy of the list box item within the TContent (if I remember correctly).
As you've worked out you need to add a TContent to your form. The easy way to do this is to
go back to the form,
right click and select View as Text
Find the TStyleBook object and add a TContent at the appropriate point (the format for this should be obvious from the rest of the file).
No need to add any properties - defaults will be used the first time.
Right click, View as Form.
Go back into the style editor and edit away.

Delphi TActionMainenuBar - 2nd-level submenu menu item is disabled

With Delphi XE5 I am converting a TMainMenu to a TActionMainMenuBar but I am having issues with a submenu node within a category being disabled at runtime, for example in my 'File' category. Most 'File' category items are actions dragged over from the Action Manager, but I also want to group two of those actions under a submenu node within the File menu. With TMainMenu I would simply use Create submenu and edit the resulting TMenuItem caption, but I see that the TActionMainMenuBar has context items for each client item, and this is what I've tried to use. The result is that the layout looks ok but the submenu item is disabled at runtime (presumably because it does not have an action).
This is what I see at design time - I've created the 'Batch Reporting' item myself using 'Add item' in the object inspector.
This is what I see at run time, the item is disabled.
This is what I see in the object inspector with my context items included.
Should I be setting a special property on the 'Batch Reporting' item to give it a 'no action' status? Or am I forced to use an action with a 'do nothing' OnExecute?
I've found the answer - I was using the 'Context Items' of the submenu, I should have been using 'Items' as shown below. Very confusing!

How to disable menu, sub-menu in ActionMainMenuBar?

Using: Delphi XE3, VCL Forms application
I have a menu containing a sub-menu in a ActionMainMenuBar. How can I via code:
disable the menu
disable the sub-menu
Create a 'TAction' per menu/submenu that you want to enable disable. Do not assign them to any category.
Create an 'OnExecute' event handler for these actions, so that these can be enabled. You don't have to put any code in the handler, a comment ('//') is enough for the IDE to not to delete the handlers.
Select the 'TActionClient' that represents the menu/submenu from the form designer, just click on the item.
Assign one of the actions to its 'Action' property in the object inspector.
Enable/disable the action associated with the 'TActionClient' that represents the menu/submenu at run time for the menu/submenu to be enabled/disabled accordingly.
By using the 'enabled' property of the menu? or the menu-item that is the starting point of the submenu...
You can actually disable it at runtime (in Delphi 7 anyway) if you know the index of the top-level menu item for the category as follows:
ActionMainMenuBar.ActionControls[2].Enabled := False;
ActionControls[2] would be the category showing as a top-level menu item (after dragging the category onto ActionMainMenuBar from ActionManager.

Delphi 2010 Action Manager & Main Menu Bar

I'm trying to use the Action Manager and Action Main Menu Bar in Delphi 2010 an I have no idea how to make this work. I've tried looking at the examples that come with Delphi 2010 and I can't seem to figure this out.
I've tried playing around with the examples. I've been able to add an image to the Image List component and set that item to the new item index. At design time it displays properly at runtime it reverts back to the original.
I'd like to learn how to use the Action Manager and Action Main Menu Bar but I can find any help on these topics. Is there a tutorial on how to use the Action Manager and Action Main Menu Bar?
Drag and drop a ActionManager, a ActionMainMenuBar and a ImageList on your form.
Doubleclick the ImageList, you get the Imagelist Editor. Use the Add-button to add your icons (make sure their sizes are the same as the Height and Width properties that are set in the ImageList-control).
Set the Images-property of the ActionManager to your ImageList and set the ActionManager-property of your ActionMainMenuBar to your ActionManager.
Doubleclick the ActionManager, go to the tab 'Actions' and add new actions by the 'New'-button.
Click each Action in the ActionManager and set each action's properties, at least: ImageIndex (to choose an Icon), Caption and Category.
Note: A Category will serve as a main item in the menu (like File, Edit and View) and each Action will serve as menu item (like Save, Save as, Load). So set the Category property of all actions you want to belong to one main menu item to the same name. For instance give the actions 'Save' and 'Load' the category 'File' and give the actions 'Undo' and 'Redo' the category 'Edit'.
Doubleclick each Action in the ActionManager. You'll get the code editor. Type the code you want to perform when the user clicks this menu item. If you don't type any code or comment, the menu item will automatically be disabled when the application is running.
Now drag the categories from the ActionManager to the ActionMainMenuBar.
That's it.
I think Actions, Action Lists And Action Managers by Brian Long is a great start to explore the realm of actions.

Resources