Allen Posted February 16, 2022 Share Posted February 16, 2022 Hi; I have a DBGrid with several columns. when using the flex attribute to expand columns to fill the width of the grid, instead of utilizing the available width, the data rows become small, and lose their orientation with their headers. The flex attribute seems to be correctly applied the the header. In my screenshot the Flex = 1 attribute is applied to 1, 2 & 3. Any suggestions gratefully appreciated. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 16, 2022 Share Posted February 16, 2022 1 hour ago, Allen said: I have a DBGrid with several columns. when using the flex attribute to expand columns to fill the width of the grid, instead of utilizing the available width, the data rows become small, and lose their orientation with their headers. The flex attribute seems to be correctly applied the the header. In my screenshot the Flex = 1 attribute is applied to 1, 2 & 3. Any suggestions gratefully appreciated. Hello, Which build of UniGUI are you using? I couldn't reproduce your issue. Can you make a simple testcase to check? Quote Link to comment Share on other sites More sharing options...
Allen Posted February 16, 2022 Author Share Posted February 16, 2022 Hi; I am using UniGui 1.90.0.1557 Delphi 11 I went to one of your demo apps and adjusted the Flex attribute and the project appearance is as expected. My project structure is as follows: Main form has a UniPanel that has UniFrames loaded into it. As best I can tell my grids settings match the demo, I will attempt to build a simple demo that has the behavior I am seeing. The components in use are MyDac, TUniFrame, TUniDBGrid. Will get back to you as soon as I have a testcase. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 16, 2022 Share Posted February 16, 2022 Hi, OK. Quote Link to comment Share on other sites More sharing options...
Allen Posted March 8, 2022 Author Share Posted March 8, 2022 Sherzod; In trying to build a standalone testcase for this, If I use a clientdataset with embedded data then this always seems to work as intended. However in my app I am using the Devart UniDAC components with MySQL and keep reverting back to the behavior highlighted above. What is the best way to send you a project the has the behavior I am experiencing? I have resorted to the following in my frame to arrive at a usable short term solution procedure TDashboard.UniFrameBeforeReady(Sender: TObject); var FlexGridWidth, i: Integer; begin UniMainModule.SetDBUpdcomp(MyQuery1, 'TlogHttp.UniFrameBeforeReady'); MyQuery1.SQL.Text := 'SELECT idAppLog,logTime,logLevel,session,UserId,Method,referer,uri,info ' + ' FROM frlog order by idAppLog desc;'; UniDataSource1.DataSet := MyQuery1; UniDataSource1.Enabled := true; UniDBGrid1.DataSource := UniDataSource1; UniDBGrid1.Columns.Items[0].Width := 64; UniDBGrid1.Columns.Items[1].Width := 64; UniDBGrid1.Columns.Items[2].Width := 64; UniDBGrid1.Columns.Items[3].Width := 64; UniDBGrid1.Columns.Items[4].Width := 64; UniDBGrid1.Columns.Items[5].Width := 64; UniDBGrid1.Columns.Items[6].Width := 64; UniDBGrid1.Columns.Items[7].Width := 64; FlexGridWidth := UniDBGrid1.Width; for i := 0 to UniDBGrid1.Columns.Count - 2 do begin if UniDBGrid1.Columns.Items[i].Visible then FlexGridWidth := FlexGridWidth - UniDBGrid1.Columns.Items[i].Width; UniDBGrid1.Columns.Items[i]. end; UniDBGrid1.Columns.Items[8].Width := FlexGridWidth; // UniDBGrid1.Columns.Items[8].Flex := 1; MyQuery1.Open; end; In the code above UniDBGrid1.Columns.Items[8].Width is slightly narrower that the available space on the frame / grid. Is there a better way to compute the available width for the "Flex" column? -Allen Quote Link to comment Share on other sites More sharing options...
Allen Posted March 9, 2022 Author Share Posted March 9, 2022 SOLVED The column flex attribute can not be set at design time from the object inspector, instead when set from the grids ClientEvents.ExtEvents.reconfigure as: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { sender.columnManager.columns[8].flex=1; } then all works as expected Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.