B4A Library [Class] Flexible Table

LucaMs

Expert
Licensed User
Longtime User

Attachments

  • Arrays.zip
    6.6 KB · Views: 223

vbmundo

Well-Known Member
Licensed User

Lucas,

It's the ABC in Software Develop..

If the solution is REDECLARE a single ARRAY , is a BUG in the B4A Language.. is not my error...

NOW WORKS, but nobody may said me thay WAS MY ERROR.
 

vbmundo

Well-Known Member
Licensed User
The problem is Reference

See link (and understand) i posted in Post #581

Yes DonManfred, I have read and I am extremely surprised

It is impossible to believe that they have created something so contradictory in JAVA

If you show this to any programmer NO JAVA will tell you that you have gone mad.

Thanks for your help..
 

LucaMs

Expert
Licensed User
Longtime User
It's the ABC in Software Develop..
I know, sorry for that my banality

The problem is Reference
References can be the problem, sometimes, but he asks where is (was) the problem in his code (as I wrote, I have not read all).

For example, this his code:
B4X:
For i = 0 To data.Size-1
    Dim mm AsMap
    mm.Initialize
    mm=data.Get(i)
    Log(mm.GetValueAt(0))
    For ii = 0 To mm.Size-1
        Campos(ii)=mm.GetValueAt(ii)
    Next
    G.AddRowAutomaticWidth(Campos)
Next

should work even declaring and initializing mm before the loop.

[Also, why "i" and "ii" instead of R (R)ecord and F (F)ield? We take often bad habits, such as using always "i" as variable name for a loop - By the way, you do not need to declare this variable before you use it in a loop]
 
Last edited:

vbmundo

Well-Known Member
Licensed User

Lucas,

I use your logic acquired from other languages,
but Java or B4A this thought otherwise and that's why all this new logic has overcome us.

See the Link provided by DonManfred.

Thanks
 

LucaMs

Expert
Licensed User
Longtime User
See the Link provided by DonManfred.
I'm in a hurry, I read quickly and unfortunately in English; despite this, it seems to me that in that thread is explained the difference between primitive types of variables and their use as parameters and object variables, passed by reference.

I do not see different things from other languages.

Maybe I should reread more carefully, but I do not think so.
 

vbmundo

Well-Known Member
Licensed User

El Link explica que los ARRAYS no son tratados en B4A como habitualmente se usan en otros lenguajes. explica que se deben DEFINIR previamente para cada asignación de nuevos valores.

AUNQUE A TI Y A MI Y A MUCHOS, NOS CUESTE ENTENDERLO.

Saludos
 

vbmundo

Well-Known Member
Licensed User
[Also, why "i" and "ii" instead of R (R)ecord and F (F)ield? We take often bad habits, such as using always "i" as variable name for a loop - By the way, you do not need to declare this variable before you use it in a loop]

Years of using the same variables... jejeje.

these variables are only used within the FOR NEXT
 

LucaMs

Expert
Licensed User
Longtime User
Thank for your answer in Spanish but I would prefer it in Italian

Please, see the test project I'm attaching; in it I pass an array as parameter, without "redim" it and without problems.
 

Attachments

  • Test.zip
    6.8 KB · Views: 206

LucaMs

Expert
Licensed User
Longtime User
El Link explica que los ARRAYS no son tratados en B4A como habitualmente se usan en otros lenguajes. explica que se deben DEFINIR previamente para cada asignación de nuevos valores.

Here I attach another test. I copied and pasted Klaus' code (post #574), then I only moved the declaration of Campos before the loop and, as I thought, it works without problems.
 

Attachments

  • Campos Test.zip
    21.7 KB · Views: 228
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Hi Luca,

For any reason, with this Table and others, doesn't work.

Thanks

Do you mean "Table" as View (and other views?)?

I can think only to two things (but I cannot try using your data ):

1) the records (maps) you receive haven't a fixed number of fields
2) Table and "Table filling" are executed before Activity_Create is completed (sometimes you need to use CallSubDelayed in this routine)
 

vbmundo

Well-Known Member
Licensed User

Not my friend.

I has problem only into the Table, but I read others with this problem (DIM out of FOR NEXT)

Regards
 

watesoft

Active Member
Licensed User
Longtime User
Hello Klaus, I use your AutoScale Code Module to ScaleAllX Table v2.00

Logs:
Error occurred on line: 400 (Scale)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object anywheresoftware.b4a.objects.PanelWrapper.getObject()' on a null object reference
at b4a.tableclass.scale._scaleallx(scale.java:52)
at b4a.tableclass.scale._scaleviewx(scale.java:1073)
at b4a.tableclass.scale._scaleallx(scale.java:71)
at b4a.tableclass.scale._scaleviewx(scale.java:1002)
at b4a.tableclass.scale._scaleallx(scale.java:71)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:703)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at b4a.tableclass.main.afterFirstLayout(main.java:102)
at b4a.tableclass.main.access$000(main.java:17)
at b4a.tableclass.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:743)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:682)

Does AutoScale Code Module not fit for customview?
 

LucaMs

Expert
Licensed User
Longtime User
I has problem only into the Table
I don't like to call this view Table, because you could refer to "data table"; I would prefer Grid or TableGrid or... but it's too late for this

I read others with this problem (DIM out of FOR NEXT)
If you have tried "Campos Test", you saw that in this case the problem is not that. Same Klaus's routine, with the unique change which is right the moving of the declaration before the loop and it works. Then? The problem can be only the data or the Table building/filling.
 

vbmundo

Well-Known Member
Licensed User

I understand, but in my APP fail, and the most important.. thanks to DonManfred and Klaus now is Fixed.

This class name is
Flexible Table

thanks friend !!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…