Henry Olive 6 Posted November 2 Good Day, Delphi 11,3 I have a string grid (as a Data Grid) linked to datasource(Bind) In String Grid's Columns Editor, i choose one of the column (it is an Integer field) i want to change its Align and i set Aligment Property to taRightJustify when i run the application the column header.caption is still LeftJustify. How can i change an Integer or Numeric fields's Align to taRightJustify ? Thank you Share this post Link to post
corneliusdavid 292 Posted November 4 I have looked for a way to adjust the caption titles as well and there doesn't seem to be a simple property like you'd expect. I suppose you could implement a custom draw event but I haven't needed to because I use Woll2Woll's FirePower grid for FMX and it does allow custom title alignments with a simple property. Share this post Link to post
Henry Olive 6 Posted November 6 Thank you so much, I'm new in FMX, beside StringGrid there is also Grid component i have just tried to use it but i think data connection is not possible can you please confirm. Thank you Share this post Link to post
corneliusdavid 292 Posted November 6 1 hour ago, Henry Olive said: i think data connection is not possible Firemonkey doesn't have data-aware controls like the VCL does. Instead, you use LiveBindings which is more flexible and powerful but has a learning curve. I would suggest activating the LiveBindings Wizard to make hooking it up simpler: in Tools > Options > IDE > LiveBindings, check the box for "Display LiveBindings Wizard in context menu". Then in your form, you can right+click on control (such as the grid) and select "LiveBindings Wizard" which will walk you through hooking it up. Share this post Link to post
Kryvich 190 Posted November 7 In StringGrid, check the HeaderSettings.TextSettings.HorzAlign property for the desired column. Share this post Link to post
corneliusdavid 292 Posted November 7 5 minutes ago, Kryvich said: In StringGrid, check the HeaderSettings.TextSettings.HorzAlign property for the desired column. There is no HeaderSettings directly off the StringGrid itself. However, it got me thinking... This line of code works: StringGrid1.Columns[1].HeaderSettings.TextSettings.HorzAlign := TTextAlign.Trailing; But, frustratingly, you cannot access the HeaderSettings of a Column at design-time. Share this post Link to post
Kryvich 190 Posted November 7 In Design mode, select the desired column and in the Object Inspector panel you can view/change its properties. 1 Share this post Link to post
corneliusdavid 292 Posted November 7 11 minutes ago, Kryvich said: In Design mode, select the desired column and in the Object Inspector panel you can view/change its properties. Yes, but the Header is only a simple string, it does not have a TextSetting sub-property. And the TextSettings property for the column in the object inspector only affects the data, not the header: Share this post Link to post
corneliusdavid 292 Posted November 7 Interesting. I've been playing around with a test project and it appears that when you apply LiveBindings to the grid, it hijacks the properties--and hides some of them. Your example is not using LiveBindings, mine was. As soon as I removed the table and LiveBindings components, then I could edit the column header TextSettings at design-time as you showed. I so seldom use StringGrid and then almost always use LiveBindings to hook up data sets, I had never encountered this before. Thanks for your screenshot. 1 Share this post Link to post
Henry Olive 6 Posted November 8 Unfortunatelly, if you are using Binding (which i use) there is no Align settings for Header Captions. Thank you so much corneliusdavid , Kryvich Share this post Link to post