How to access and control a checkbox that's inside a style? - delphi

I have a style for list box items which contains a checkbox. For every list box item, there is a property called isChecked that I can read and write to just fine, but it does not influence the checkbox in the style. Any idea how to make the checkbox synchronize with the isChecked property?
Here's the style structure:

Just found out list box contains a boolean property named "ShowCheckboxes"...

Related

MS Access -- Yes/No statement

I want to create a Yes/No row in a table, the row would be called 'prepayment'. So, if there is one, and you check 'Yes' in the form, I want some textbox to appear -- so you could type in the sum of prepayment. Is there some way to do it the way that textbox to type in the sum wouldn't be visible in the form unless you check 'Yes'?
I didn't really try anything yet. Just have no idea how to do it...
Solomon,
Set the Visible property on the Textbox to No.
Create an On_Click event for the Checkbox.
The code for the On_Click event should change the Textbox Visible property to Yes. You might also want to check the current setting of the Textbox Visible property so you can hide it if they uncheck the Checkbox.

Trying to add items to a TRadioGroup but no Item Editor or Items property is available

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?

Why some properties are hidden from Object Inspector when more than one item is selected?

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.

Delphi(FMX) Livebindings with Multiple RadioButtons

I have a form with 2 RadioButtons(with same GroupName) and I need to save 'A'(if RadioButton1 is selected) or 'I'(if RadioButton2 is selected) in the field Status using LiveBindings.
One Component to One Field is easy, but in this case I have two components getting and setting values from one field.
I created a function that returns the radiobutton selecting through Groupname and fill the field manually, but I wanted something more automatic.
Thanks in advanced!
Here are the steps to accomplish this.
Create your two RadioButtons, call it RadioButton1 and RadioButton2.
Set their GroupName property to the same string for both radio buttons.
Right click your 1st radio button and select Bind Visually...
In the LiveBindings designer, right click your radio button and select Bindable Members, and then select the checkbox IsChecked followed by clicking the ok button.
Still within the Live Bindings designer, Now drag a link between the IsChecked property and the field you wish to bind to (note this can be a string field).
Repeat steps 4 and 5 for the other Radio Button.
Now you are almost down, but you need to convert the string to a boolean so that the IsChecked property will have a boolean value. To do this, select the binding link from the LiveBindings Designer for your radio button. Then in its CustomFormat property, assign the following string
IfThen(ToStr(%s)="Poor",True, False)
This will allow the radio button to be checked when the underlying database value is 'Poor'
Do the same for your other radio button, except use a different string
IfThen(ToStr(%s)="Excellent",True, False)
Now to give the radio buttons the ability to change the underlying database field, you will need to attach code to perform this. Let us use the radio button's OnClick event (attach to both radio buttons). This code assumes your underlying dataset is named FDCustomer, and your field is named Status. Note that the radio button is not checked yet at the time of the event, so we look for IsChecked to be false.
if Sender = RadioButton1 then
begin
if not TRadioButton(Sender).IsChecked then // checking
begin
fdcustomer.Edit;
fdcustomer.FieldByName('Status').AsString:= 'Poor';
end;
end
else if Sender = RadioButton2 then
begin
if not TRadioButton(Sender).IsChecked then
begin
fdcustomer.Edit;
fdcustomer.FieldByName('Status').AsString:= 'Excellent';
end;
end;

how can i make a TRibbonComboBox act like a TCombobox with Style of csDropDownList?

how can i make a TRibbonComboBox act like a TCombobox with Style of csDropDownList? we don't want the user to be able to edit the choices in the list.
we need to use TRibbonComboBox because we want the current selection to be visible.
Microsoft word shows a combobox where you can select an item but cannot edit the item itself.
should i consider trying a TCombobox in the ribbon? i'd expect it won't look or not work correctly.
thank you for you comments!
You can just use TRibbonComboBox.ReadOnly:
Determines whether the user can change the text of the edit control.
And furthermore:
Setting ReadOnly to true ensures that the text is not altered, while still allowing the user to select text. The selected text can then be manipulated by the application, or copied to the Clipboard.
(see documentation)

Resources