My Environment : C++ Builder XE4
I try to set default value as "true" for TCheckBox.
I thought there was a property named "Checked" for TCheckBox. However, I cannot find "Checked" property in Object Inspector.
On the other hand, I can set "Checked" in code.
In this case, should I write code
CheckBox1->Checked = true;
for every TCheckBoxs, which need to be set true as default?
I am not quite sure about the older version of RadStudio or C++ Builder. But I think there was "Checked" property found in the C++ Builder 6.
Not sure what is going on that you don't see it. I have attached a screenshot of the Object Inspector for TCheckBox in C++ Builder XE5 Update 2. However, this hasn't changed for as far back as I can remember. As you can see, "Checked" is shown after "Caption" and before "Color".
If you can't figure it out, please post a screenshot of your object inspector for a TCheckBox
In the Property tab of the Object Inspector, there is a setting for visible/invisible. Over the Property tab, right-click will show the "View" menu.
I set the "View" menu as "None", then set to "All". Then I can find the "Checked" Property for the TCheckBox.
Related
I am learning Delphi and building a simple NotePad. However, as soon as I add an Action to some ToolButtons (note the align left, center, and right buttons and Bold), they are disabled in the running app, although the Enabled property is set to true in the Object Inspector. They become enabled in the running app if I remove the Action from them in the Object Inspector, but then they are just useless clickable buttons. I have added some pictures below.
I have Googled and tried myself almost to insanity and I really can't figure it out myself.
A normal TAction needs an OnExecute event to become enabled. You can control this with the property DisableIfNoHandler, which defaults to True.
I had created a simple program which includes many checkboxes and TComboEdit. When an certain checkbox is checked, then an editbox becomes enabled. Some checkbox is checked by default. My problem is when I run the program the unchecked component's edit box are visible too, which should be disabled as the checkbox is not checked at all. But when I check them and uncheck again the edit box disables which it should be. So how to update component's status at form create ? Or any other good way to do it.
so sorry for the grammar mistakes.
Either set the visible property of the edit fields to false in the designer, or do as David Heffernan suggests: Write an OnCreate handler, where you do that in code.
I've noticed that some properties disappear from the Object Inspector when selecting more than one item.
Why does this happen and how to control this behavior when creating a component?
Example:
Add 2 buttons (TButton) to a form and select one of them.
In the Object Inspector you can see all TButton's published properties (Note that there's also the Constraints property).
Add the other button to the current selection (Click while pressing Shift key).
As you can see, some properties have been hidden from Object Inspector (Note that the Constraints is no more visible).
Whether a property is displayed when multiple objects are selected is controlled by the property editor configured for that property. Property editors (descended from TPropertyEditor in DesignEditors.pas) have a GetAttributes method that returns a set of attributes that apply to the editor. If the set includes paMultiSelect, then the property will be displayed.
Given that the property value is displayed as the constraint values, rather than just (TSizeConstraints), I conclude that that property is not using the generic TClassProperty editor. That editor sets paMultiSelect, but based on your pictures, the property editor to TSizeConstraints doesn't. It was probably an oversight.
You could try registering your own property editor. Find the property editor currently registered for TSizeConstraints (by searching the source code for TSizeConstraints, for instance) and, in a design-time package, declare a new class descended from that one. Override GetAttributes to return the value you need. Finally, follow examples elsewhere in the code to call RegisterPropertyEditor.
I have a weird situation here. The ParentFont property of newly-added components keeps changing to FALSE, within the IDE.
I can demonstrate it as follows:
File|New VCL Forms Application. No need to save anything.
Add 3 tLabels to the new empty form.
In turn, look at each one in the Object Inspector. The ParentFont is set to FALSE - it should be true.
Change each of the labels to ParentFont = TRUE.
Change the font size of the form, several times, and confirm that the labels change as expected.
Select one label, check its ParentFont in the Object Inspector. It's FALSE again!
Change the font size of the form again, and note that the last-inspected label doesn't change.
To me this is consistent with the label's font somehow being changed upon being selected in the IDE, however I can not detect this.
Does anyone have an idea what might be broken? And/or what I can do about it?
=========== [EDIT] ==============
Well, I have uninstalled and done a clean install of Delphi, with no 3rd party components. The problem is still evident!
Here's a video to demonstrate:
http://topshare.com.au/DelphiParentfontProblemDemo.avi
Turns out it's a known problem with XE5:
https://forums.embarcadero.com/thread.jspa?messageID=716297#716297
How to remove the Accelerators from TMainMenuActionBar ?
can't seem to find the AutoHotKey = maManual property to change, nor to find any other property that will cause the right effect.
(Assuming the question is about TActionMainMenuBar) you would set the AutoHotKeys property through the ActionManager component that the action bar is linked to (through its ActionManager property). Unlike the TMainMenu's AutoHotKeys, this one is a boolean property.
To set the property at design time,
Select the 'ActionManager' component on the form
Click the ... button on the right side of the ActionBars property in OI.
Select your MainMenuBar from the popped up Editing ActionManager1.ActionBars' dialog.
Click the ... button on the right side of the Items property in OI, which will launch the Editing ActionManager1.Items dialog
Do not select any of the items at this time. Instead, set the AutoHotKeys property to True or False in OI.
At run time you can do:
ActionManager1.ActionBars[0].Items.AutoHotKeys := False;
Note that you might need to re-set the Caption of an Item after toggling AutoHotKeys. I.e. 'F&ormat' -> 'Format'.