B4J Question [SOLVED] Problem setting B4XTableM.Searchfield

Mikelgiles

Active Member
Licensed User
Longtime User
Has something changed in the B4XTable function? I have about a dozen lines setting the B4Table.searchfieldal to a string that used to work fine and now they give the error below. I had changed the app to use InlineEditing but the codes giving the error are not a part of that code. B4XTable.Searchfield appears to be a string and always worked before so I am pretty confused. What is the proper way to change a B4XTable.Searchfield by code?

2 lines of code giving the error:
B4XTableM.Searchfield = ""
B4XTableM.Searchfield = QD(5).SubString2(0,SearchfieldLength)

Error Log:
Error log
B4J Version: 8.50
Java Version: 11
Parsing code.    (0.18s)
Building folders structure.    (0.06s)
Compiling code.    (0.74s)
Compiling layouts code.    (0.01s)
Organizing libraries.    (0.00s)
Compiling generated Java code.    Error
B4J line: 626
B4XTableM.Searchfield = QD(5).SubString2(0,Sea
src\b4j\example\main.java:2781: [B]error: incompatible types: String cannot be converted to b4xfloattextfield[/B]
parent._b4xtablem._searchfield /*b4j.example.b4xfloattextfield*/  = (b4j.example.b4xfloattextfield)(parent._qd[(int) (5)].substring((int) (0),_searchfieldlength));
 

mangojack

Expert
Licensed User
Longtime User
B4X:
B4XTableM.Searchfield.TextField.Text = ""
B4XTableM.Searchfield.TextField.Text = QD(5).SubString2(0,SearchfieldLength)

In certain circumstances you might have to include Sleep(0) prior to calling the above. (allowing the table to load first)
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
This code could never worked.

Erel, have retested and both lines work in B4A & B4J with a freshly download B4XTable example.

B4X:
B4XTable1.Searchfield.Text = "Abc123"
B4XTable1.Searchfield.TextField.Text = "Def456"

They both immediately trigger a Search with 0 results... What am I misunderstanding.
 
Upvote 0

Mikelgiles

Active Member
Licensed User
Longtime User
This code could never worked.
B4XTable.SearchField is a B4XFloatTextField.

This code will work:
B4X:
B4XTableM.Searchfield.Text = QD(5).SubString2(0,SearchfieldLength)
Thanks Erel, this code does work by just adding '.Text' . The original code did work for months though. Any thoughts why it used to work and now doesnt?
 
Upvote 0

Mikelgiles

Active Member
Licensed User
Longtime User
adding '.Text' to Searchfield makes it work just fine but the original code did work for months. Any thoughts why it used to work and now doesn't?
 
Upvote 0

Mikelgiles

Active Member
Licensed User
Longtime User
B4X:
B4XTableM.Searchfield.TextField.Text = ""
B4XTableM.Searchfield.TextField.Text = QD(5).SubString2(0,SearchfieldLength)

In certain circumstances you might have to include Sleep(0) prior to calling the above. (allowing the table to load first)
Thanks mangojack, both of those lines worked fine but leaving .TextField out worked also. Now I am only confused about why the original code worked for months and just now surfaced as an error. I think my lack of java knowledge(or age LOL) may be the problem!
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
I think my lack of java knowledge(or age LOL) may be the problem!

Unfortunately for you ... in this case java knowledge was not involved. :) Don't worry , were both in the same boat.
 
Upvote 0

Mikelgiles

Active Member
Licensed User
Longtime User
I am having another problem with the Searchfield that was working fine before. It no longer recognizes the delete key, backspace, or back arrow. It does accept regular keys though. I can use a search ok but cant get rid of the filter by keyboard but can by code. Not sure what I am doing wrong as I know for sure that all keys used to work fine so I loaded older version and it works fine there so I am sure it has to do with differences in the old and new code. I have two B4XTables and the major difference is that the new version was using a different form for each table and the new version has both on the same form. Any thoughts on where I should look for the problem?
 
Upvote 0

Mikelgiles

Active Member
Licensed User
Longtime User
I am having another problem with the Searchfield that was working fine before. It no longer recognizes the delete key, backspace, or back arrow. It does accept regular keys though. I can use a search ok but cant get rid of the filter by keyboard but can by code. Not sure what I am doing wrong as I know for sure that all keys used to work fine so I loaded older version and it works fine there so I am sure it has to do with differences in the old and new code. I have two B4XTables and the major difference is that the new version was using a different form for each table and the new version has both on the same form. Any thoughts on where I should look for the problem?
Never did figure out why it worked on the old but not the new but the close button does remove all text so it takes care of my problem anyway. Not sure why I never thought of that before. So now I dont even have a problem LOL
 
Upvote 0
Top