In cxGrid I have a column with property Options.Editing:=False; Properties:=CheckBox. So, user can not change state of the checkboxes. But the checkboxes still have custom color and user does't see that he can not edit them.
How do I make checkboxes grey in a cxGrid column, which one can not edit?
You can use OnCustomDrawCell event to draw a disabled checkbox.
Check out: http://www.devexpress.com/Support/Center/p/Q253981.aspx
You could make an OnCustomDrawCell event on the grid view, with something like:
if not AViewInfo.Item.Options.Editing then
ACanvas.Brush.Color := clGray;
Columns that are not editable will not become grey. This goes for all kinds of editors, be they checkboxes, textedits or whatever. The checkbox has a property for NullStyle that can be set to nssGrayedChecked, but this will only be displayed for NULL values.
You have some other options, though. The simplest may be to set the column to not focusable, as well as not editable (Options.Focusing = false). This will perhaps make it easier for your users to understand why they can't change the value. THe second easiest option is to use a custom style that in some way indicates a disabled/noneditable column, for instance by having a grey background color.
Use cxStyleRepository
<TcxGridDbColumn>.styles.Content
Related
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.
How to change the color of active TAB in a TabControl (on FireMonkey) as shown below?
There are 2 ways to make this happen.
1) First option is you can create CustomStyle for TabControl from TStyleBook (Style Designer).
Then you can add whatever you want to use in your custom design (TRectangle is recommmended for many shape and colors).
2) I prefer to use second way for it. Set the TTabControl's TabPosition to None, then add a TGridPanelLayout to where you want to add tabs in your form. After that, set your TGridPanelLayout's column count for your tab count.
Now you need to know that your each tab box should be same. Drop a TRectangle for first column then set Align to Client (All colors and inner components are depends on your choice).
Be sure that your TRectangle components HitTest parameter is true and inner components' HitTest parameter is false.
Also you can handle your tab selections from OnClick event. Set each TRectangle (for tab) a Tag then connect all tabs to same OnClick event. Then you get Sender's Tag and set your TabControl1.ActiveTab from your Tag.
I've customised the style of a Firmeonkey list box item in such a way that now it can consist of 4 TLables in it. Each of the lable has Alignment as alNone.
I'm setting position of each of them in my code whenever i need to add any item. I've observed that when my list has scroll bar and if first component is not visible (i.e. i've scrolled down enough) at that time if i re-add all the items again in list box, then the position of TLabels in first items (or items which are not shown) get distorted.
For setting positions I am using below code :
(tmpListBoxItem.FindStyleResource('txtCol2') As TLabel).Position.X :=
(tmpListBoxItem.FindStyleResource('txtCol2') As TLabel).Position.X + (tmpListBoxItem.FindStyleResource('txtCol2') As TLabel).Width;
Any suggesstions, how can i overcome this issue.
Regards,
Padam Jain
Firemonkey styles are repeatedly 'applied' and 'freed' as components appear and disappear from screen.
It is not enough to simply set properties of style objects once and expect those values to be remembered. What you need to do is either listen to the OnApplyStyleLookup event or override the ApplyStyle method of a custom component and use the same you have above to set the properties again.
This means you'll need somewhere to store the values you are going to set.
I would suggest for your situation that you subclass TListBoxItem so you can add suitable properties or fields and put your code in ApplyStyle.
The help indicates that adding gboGroupStyle to the ButtonOptions on a TButtonGroup:
"Specifies that the buttons should inherit the group style that is set on the container."
But this explanation still leaves me lost - any ideas?
The gboGroupStyle option in the TButtonGroup.ButtonOptions property has nothing to do with GroupIndex as it's known e.g. from TSpeedButton.
Setting of the gboGroupStyle option to True allows you to:
set the TButtonGroup.ItemIndex property, so you can predefine which button will be focused as default, nothing cool
click the buttons with ENTER or SPACE keys, what will fire the TGrpButtonItem.OnClick event of the button item (if assigned), perform its action, or fire the TButtonGroup.OnButtonClicked event
I agree the name of this is quite misleading, but that's what I found in the source code from Delphi-XE2.
gboGroupStyle makes the TButtonGroup act as a group - that means, one and only one button is selected at a given time. It is similar to grouping several TSpeedButtons with the GroupIndex, where only one button inside that group is selected at any time. The currently selected button can be read and written via the ItemIndex property of TButtonGroup. To visualize the selected button one can implement an OnBeforeDrawButton or OnDrawButton handler.
From my experimentation it looks like if gboGroupStyle is used then the ItemIndex property can be set to something other than -1, so that the TButtonGroup remembers the last button that was pressed.
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)