Recent

Author Topic: How to display barcode contents with jGridview?  (Read 1735 times)

Jonvy

  • Jr. Member
  • **
  • Posts: 90
How to display barcode contents with jGridview?
« on: March 24, 2023, 05:02:43 am »
Hello all,
I want to make an android app to display barcode contents,get the same result as I did in PC(See attachments PC_1.png,PC_2.png,PC_3.png).

First line will display position in barcode, 2nd line display barcode content in that positon.

It's no problem to do so in PC program.With different length of barcode can be shown dynamic.

For android app, I plan to use JGridview, but I don't know how to adjust each cell's width.
Such as my attachment,after position 10, it will display as 1 and 0,become 2 lines.

Also JGridview has no position bar to move to see more content, difficult to see more contents.

Can any one help me how to do this?

Maybe jGridview isn't the suitable component? Is there any other component can do this?


Best regards,
Jonvy
« Last Edit: March 24, 2023, 07:04:13 am by Jonvy »

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: How to display barcode contents with jGridview?
« Reply #1 on: March 25, 2023, 08:12:00 pm »
Hi, Jovy!

What about "jTableLayout"  component.... ?? 

demo:   "AppTableLayoutDemo1"
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Jonvy

  • Jr. Member
  • **
  • Posts: 90
Re: How to display barcode contents with jGridview?
« Reply #2 on: March 27, 2023, 04:50:22 pm »
Hi,jmpessoa
For jTableLayout, the result is same, can not get scroll.

So I want to use jHorizontalScrollView and JGridview together.

I did a test for following code:

Code: Pascal  [Select][+][-]
  1. {hint: Pascal files location: ...\AppLAMWProject1\jni }
  2. unit unit1;
  3.  
  4. {$mode delphi}
  5.  
  6. interface
  7.  
  8. uses
  9.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  10.   cthreads,
  11.   {$ENDIF}{$ENDIF}
  12.   Classes, SysUtils, AndroidWidget, Laz_And_Controls, gridview;
  13.  
  14. type
  15.  
  16.   { TAndroidModule1 }
  17.  
  18.   TAndroidModule1 = class(jForm)
  19.     Button1: jButton;
  20.     HorizontalScrollView1: jHorizontalScrollView;
  21.     procedure AndroidModule1Create(Sender: TObject);
  22.     procedure AndroidModule1Destroy(Sender: TObject);
  23.     procedure Button1Click(Sender: TObject);
  24.   private
  25.     GridViewBarcode: array[1..100] of jGridView;
  26.  
  27.   public
  28.     {public declarations}
  29.   end;
  30.  
  31. var
  32.   AndroidModule1: TAndroidModule1;
  33.   i,iLen:integer;
  34. implementation
  35.  
  36. {$R *.lfm}
  37.  
  38.  
  39. { TAndroidModule1 }
  40.  
  41. procedure TAndroidModule1.Button1Click(Sender: TObject);
  42. begin
  43.  
  44. end;
  45.  
  46. procedure TAndroidModule1.AndroidModule1Create(Sender: TObject);
  47. begin
  48.    iLen:=52; //example, 52 chars for testing only
  49.  
  50.   GridViewBarcode[1].Create(HorizontalScrollView1);
  51.   GridViewBarcode[1].Visible:=true;
  52.   GridViewBarcode[1].ColCount:=1;
  53.   GridViewBarcode[1].RowCount:=2;
  54.   GridViewBarcode[1].Cells[0,0]:='1';
  55.   GridViewBarcode[1].Cells[0,1]:='S1';
  56.   GridViewBarcode[1].PosRelativeToParent:=[rpLeft,rpCenterVertical];
  57.   GridViewBarcode[1].LayoutParamWidth:=lp96px;
  58.   for i:=2 to iLen do
  59.          begin
  60.          GridViewBarcode[i].Create(HorizontalScrollView1);
  61.          GridViewBarcode[i].Visible:=true;
  62.          GridViewBarcode[i].ColCount:=1;
  63.          GridViewBarcode[i].RowCount:=2;
  64.          GridViewBarcode[i].Cells[0,0]:=IntToStr(i);
  65.          GridViewBarcode[i].Cells[0,1]:='S'+IntToStr(i);
  66.          GridViewBarcode[i].Anchor:=GridViewBarcode[i-1];
  67.          GridViewBarcode[i].PosRelativeToAnchor:=[raToRightOf];
  68.          GridViewBarcode[i].LayoutParamWidth:=lp96px;
  69.          end;
  70.  
  71.  
  72. end;
  73.  
  74. procedure TAndroidModule1.AndroidModule1Destroy(Sender: TObject);
  75. begin
  76.   for i:=1 to iLen do
  77.            GridViewBarcode[i].Destroy;
  78.  
  79. end;
  80.  
  81. end.

But when I run the code, app will flash, then closed.
Is something wrong with my code?
« Last Edit: March 29, 2023, 04:24:50 am by Jonvy »

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: How to display barcode contents with jGridview?
« Reply #3 on: March 27, 2023, 10:43:21 pm »
Hi, Jonvy!

Put here some *.txt data (one bar code by line)  exemple...


I will try help you.....
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Jonvy

  • Jr. Member
  • **
  • Posts: 90
Re: How to display barcode contents with jGridview?
« Reply #4 on: March 29, 2023, 04:12:23 am »
Ok, I attach some txt here.
Each file means one barcode,barcode length is different, pls check it.


Jonvy

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: How to display barcode contents with jGridview?
« Reply #5 on: March 29, 2023, 09:03:18 pm »
Quote
Each file means one barcode,barcode length is different....

what do you want to reach?    can you draw some draft (paint) ?
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Jonvy

  • Jr. Member
  • **
  • Posts: 90
Re: How to display barcode contents with jGridview?
« Reply #6 on: March 30, 2023, 10:09:06 am »
I want to get the same result as I did in PC desktop.See attatchment.
Scan different barcode, the Gridview can show each digit of the character in barcode and tell the position.
Also I can scroll the Gridview horiontally as the mobile screen can not fill all data.

Jonvy

  • Jr. Member
  • **
  • Posts: 90
How to display barcode contents,moved to recyclerview.
« Reply #7 on: May 11, 2023, 03:36:22 am »
Hi all,
Since I'm new for Android programming, I get the wrong idea at beginning for thinking about jGridview.
I can't sovle this problem with LAMW, so I learned some time for make android app in Android Studio with Java, learned Java language and Android concept.
Finally I sovled this problem in Android Studio with Java(See attachment gif photo),use recyclerView.

Now I back to this forum, I still don't know how to do with LAMW,if anyone can tell me, it would be better.
If I have time, I can also think it myself.
Thanks!

Jonvy
« Last Edit: May 16, 2023, 02:39:57 am by Jonvy »

Mongkey

  • Sr. Member
  • ****
  • Posts: 430
Re: How to display barcode contents with jGridview?
« Reply #8 on: May 11, 2023, 07:00:14 am »
Actually you could do it in an easy way, may be you can try create panel as parent and label or text view as child, read your code, let see if it got 14ean system, just do:

Panel.create(self);
Panel.name:= 'testing';
For i :=0 to 13 do begin
//-- create textview/label ('testing');
//--layouting child
//--put numbering
//--put barcode value by number
end;

 

TinyPortal © 2005-2018