Question...anyone know how to implement something like.. dbgrid ? lazarus / 43-Android ---------------------------------------------------------------------- amartitegui · 2017-12-14 16:11 Hi, I would need to show some results in a grid. something like 5 columns, scroll too. Using LAMW at this moment... Any good ideas? ---------------------------------------------------------------------- jmpessoa · 2017-12-14 19:35 What about jGridView? ---------------------------------------------------------------------- kwer · 2017-12-19 07:09 @amartitegui : Good questions....but it's a hard task... you can see . /demos/GUI/AppActivityLauncherDemo1  ...use java to complete it. ---------------------------------------------------------------------- c4p · 2017-12-19 11:14 I have tried to use jGridView but spacing and layout were an issue, I ended up using jListView instead. Would really love jGridView to work similar to dbGrid, just having the cells beside each other would be a great help, spacing is currently too wide. Also option not to wrap text, truncate for example, would be ideal. ---------------------------------------------------------------------- amartitegui · 2017-12-19 17:26 I made it work thanks to Jmpessoa example. really like how it works, and its quite flexible tool for data shoing... Pitty cant change colours though. Here I show you a mysql example. Here  IS HOW i POPULATE THE GRID. (variable names should be yours): NOTICE that I didn't write conetion data (mysqlconnector, sqlquery, transaction... that you shoud arrange before check if connected) first, define col, row: var   row,col:integer; begin and later in procedure... if MySQL56Connection1.connected then begin   jGridView1.clear;   jGridView1.Columns:=8;   row:=0;          try       SQLQuery1.close;       SQLQuery1.SQL.Text:=''YOUR QUERY')';       SQLQuery1.active:=true;       SQLQuery1.Open;       while not SQLQuery1.EOF do         begin             jGridView1.AddRow(row);             if not SQLQuery1.FieldByName('Id').isnull then jGridView1.Cells[0,row]:=SQLQuery1.FieldByName('Id').value;             if not SQLQuery1.FieldByName('numeroPedido').isnull then jGridView1.Cells[1,row]:=SQLQuery1.FieldByName('numeroPedido').value;             if not SQLQuery1.FieldByName('cliente').isnull then jGridView1.Cells[2,row]:=SQLQuery1.FieldByName('cliente').value;             if not SQLQuery1.FieldByName('referenciaCliente').isnull then jGridView1.Cells[3,row]:=SQLQuery1.FieldByName('referenciaCliente ').value;             if not SQLQuery1.FieldByName('servida').isnull then jGridView1.Cells[4,row]:=SQLQuery1.FieldByName('servida').value;             if not SQLQuery1.FieldByName('forrado_hoja').isnull then jGridView1.Cells[5,row]:=SQLQuery1.FieldByName('forrado_hoja').value;             if not SQLQuery1.FieldByName('forrado_bastidor').isnull then jGridView1.Cells[6,row]:=SQLQuery1.FieldByName('forrado_bastidor' ).value;             if not SQLQuery1.FieldByName('material_suelto').isnull then jGridView1.Cells[7,row]:=SQLQuery1.FieldByName('material_suelto') .value;           inc(row);           SQLQuery1.Next;         end;        SQLQuery1.Close;     finally     end;    end;                    Also, to make it easier and nicer to look. I use 2 grids. one above the other. The first one I populate with a single row (as header). That way when you need to repopulate data grid you can clear and dont need to repopulate headers. and Also, you can give it a different colour. As example of header(of course, your header names): procedure Tgps_sgtl_droid.preparagrid; var   row,col:integer; begin    with jGridView2 do begin        Clear;        Columns:=8;        row:=0;        jGridView2.AddRow(row);        jGridView2.Cells[0,row]:='ID';        jGridView2.Cells[1,row]:='PEDIDO';        jGridView2.Cells[2,row]:='CLIENTE';        jGridView2.Cells[3,row]:='REF CLIENTE';        jGridView2.Cells[4,row]:='SERVIDA';        jGridView2.Cells[5,row]:='FORR HOJA';        jGridView2.Cells[6,row]:='FORR BASTI';        jGridView2.Cells[7,row]:='MAT SUELTO';    end; end;      set both grids parentwidth and second one achored to header one, anchored below. with top margin=1 (header margin.bottom=1 too). looks quite fine. and is easy to repopulate. hope it helps ---------------------------------------------------------------------- c4p · 2017-12-20 05:52 Any screenshots? ---------------------------------------------------------------------- amartitegui · 2017-12-20 06:57 sure. There ---------------------------------------------------------------------- c4p · 2017-12-20 07:13 Very nice. What spacing do you have set for the columns? ---------------------------------------------------------------------- c4p · 2017-12-20 07:30 Does anyone know how to set the columns to line up like this in jGridView: Col1   Col2            Col3 1234  qwertyuiop  00000 Seems a straightforward question to ask but hard to do this currently with jGridView as far as I can see, tried with stretchmode, horz spacing, column size etc. Need col2 to be at least twice the size of col1, or at least virtually no horz spacing between columns. Keep ending up with: Col1             Col2               Col3 1234            qwertyuiop     00000 I think this needs a separate column size rather than a global one, or an autosize column width? unless I am overlooking something? ---------------------------------------------------------------------- amartitegui · 2017-12-20 16:09 Dont know much about. sorry. The aligning was fine in my example. i may check further tomorrow and let u know what i find. But dont really know. Sorry ---------------------------------------------------------------------- jmpessoa · 2017-12-20 16:42 Hi c4p! You can try: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TAndroidModule1.jButton1Click(Sender: TObject);begin   jListView1.TextAlign := alCenter;   jListView1.ItemLayout := layText;   jListView1.Add('col1(col2)col3');   jListView1.Add('data1(data2)data3');end;  and: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TAndroidModule1.jButton1Click(Sender: TObject);begin   jListView1.TextAlign := alCenter;   jListView1.ItemLayout := layText;   jListView1.Add('col1(col2)col3');   jListView1.Add('data1(Part1|Part2)data3');end; ---------------------------------------------------------------------- c4p · 2017-12-20 23:27 Thanks jmpessoa, I was referring to the jGridView, it does not have the SetDelimiter method. I was looking for a way to set each column width manually (rather than using the global column size of SetColumnWidth) and would use SetHorizontalSpacing to allow for spacing between each. This would mean more work to the jGridView component, unless I have overlooked a method already available? Thank you again jmpessoa for all your work on LAMW. Quote from: jmpessoa on December 20, 2017, 05:42:47 pmHi c4p! You can try: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TAndroidModule1.jButton1Click(Sender: TObject);begin   jListView1.TextAlign := alCenter;   jListView1.ItemLayout := layText;   jListView1.Add('col1(col2)col3');   jListView1.Add('data1(data2)data3');end;  and: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TAndroidModule1.jButton1Click(Sender: TObject);begin   jListView1.TextAlign := alCenter;   jListView1.ItemLayout := layText;   jListView1.Add('col1(col2)col3');   jListView1.Add('data1(Part1|Part2)data3');end; ---------------------------------------------------------------------- Thyphoon · 2020-04-02 13:47 @amartitegui I´m trying to do exactly what you did in your example, but I hot this error: E/libcontrols.so(22622): EInOutError: Can not load DB-Lib client library "libsybdb.so". Check your installation. can you tell me how did you go about this? Thanks! ---------------------------------------------------------------------- Thyphoon · 2020-04-06 11:37 Hi jmpessoa! How can I add a 4th column? to this example? Quote from: jmpessoa on December 20, 2017, 05:42:47 pmHi c4p! You can try: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TAndroidModule1.jButton1Click(Sender: TObject);begin   jListView1.TextAlign := alCenter;   jListView1.ItemLayout := layText;   jListView1.Add('col1(col2)col3');   jListView1.Add('data1(data2)data3');end;  and: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TAndroidModule1.jButton1Click(Sender: TObject);begin   jListView1.TextAlign := alCenter;   jListView1.ItemLayout := layText;   jListView1.Add('col1(col2)col3');   jListView1.Add('data1(Part1|Part2)data3');end;