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

Saturday, May 30, 2015

New features in Attracs Bold

It is very easy to believe that Bold for Delphi is dead and the best action is to leave Delphi and just port your existing applications to some other platforms like C#.

I would like to inform that Attracs version of Bold is very actively developed.
Beside all small bug fixes and changes this is some bigger improvements.
Thanks to our skilled consultants that made it possible.

Autosubscription. 
You do not need to call DefaultSubscribe in derived code. Bold handle that automatically resulting in cleaner code.

No hash lookup for datatypes
Internally Bold now call hash lookups for datatypes. This is fast but when done frequently the time will add up. Attracs version use hardcoded datatypes instead as this changes very seldom or never. Together with some other optimization Bold can now handle about twice as many objects per second.

Developer Express grid and editors is boldaware
Not much to say about that. Much nicer components than the original in Bold

Caching of OCL result
Boldaware components evaluate OCL expressions when size of component is changed. For grids this is done for all cells. Using a cache is more effective.

Spanfetch avoid lazyfetch
In Bold it is very easy to trigger a lazy fetch of data. This means that one SQL statement is generated each time data is needed. This can be merged to one final SQL per table that is more effective. So this means a parsing of OCL and calculate the most effective SQL from that. Now there is even support for OCL variables but still a bit unstable. A very powerful and complicated addition to Bold.

ViewModels
When you have a many Bold-handles on a form it is easy to make a mess. Viewmodel is a new component that collect the handles in a nice treeview. It have also some other features so very little code is required on forms. In some cases no code at all. Less code also means less chances for bugs.

LogServer
This is the latest feature. Usually we log to a plain text-file. But that means a lot of information is lost. Because then we need to parse raw text to get information like performance, frequency of events, exceptions etc. Log to a database is better because it is more structured. Data is saved on the proper place.
This also means we can log more as it is easy to find data with SQL and diskspace is cheap. We log all user actions to a database by intercept events also from timers etc. We can also log all modifications of objects. The log can contain time, user, value etc. Hopefully this means much better chance to reproduce those random bugs in live environment.