Wednesday, September 16, 2015

Boldified component suite from Devexpress

It have been a while since I wrote something. Now I have the pleasure to announce that Daniel Mauric released his boldified DevExpress components as open source. They are stored at https://github.com/MauricDaniel/BoldDevEx.

Attracs have used some of the components for several years in production. But of course no warranty that it works perfect .

I want to point out that the grid is very useful component to have boldified. it combine the advantage of the original Boldgrid with a moden look & feel of the Devexpress grid. And a lot of features of course.
This is how to set it up:

  • Add a TcxGrid component on the form.
  • Select the TcxGridLevel with Right mouse button and choose Create View/Bold Table.
  • Delete the default TcxGridDBTableView component.
  • Decide a name for the grid for example Users. Rename the TcxGrid to grdUsers, TcxGridLevel to lvUsers, TcxGridBoldTableView to tvUsers.
  • Set property tvUsers.OptionsView.ColumnAutoWidth to True unless there are many columns so each column became very thin.
  • Add a BoldListHandle to the form and set the OCL expression for that.
  • Connect the grids Bold Table view DataController.BoldHandle to the BoldListHandle above.
  • Add columns and set OCL expressions for the column at DataBinding.BoldProperties.Expression property.
  • Inspect the columns so each column got a reasonable name. It should begin with col.
  • In general avoid things like formatdatetime, round, orderby etc in the columns OCL expression.
    Note When dealing with dates, floats, integers as string sorting is not working good anymore. It only works if the grid know the actual datatype. Things like default sorting and formatting can be done in the grid instead. Also avoid this kind of OCL if islocalAdmin then 'X' else '' endif. In this case isLocalAdmin is enough and let the grid display is as a boolean checkbox. Note:  See Boolean string representation for a column when the grid is used for editing.
  • If the grid is readonly then set property OptionsData.Editing to False of the view. If only some of the columns are readonly then set views OptionsData.Editing to True and then decide at the columns Options.editing property.
  • The views OptionsSelection.CellSelect can be set to False of you want to select only a whole row.
All controls implement IBoldValidateableComponent which means they can be validated at design time Bold menu/Validate Current Form.

And you must of course have  installed the original VCL DevExpress components to make use of this. Currently we use version 14.2.3. Version 15 have dropped support for Delphi 2007 and this is the latest version that Bold support. So we have to stay here until we add Unicode support to Bold and upgrade Delphi.

An example of boldified DevExpress grid