Replicated Fields Inquiry

xeir

Member
Licensed User
Thought I would get some insight before trying this as I'm sure someone out there may have done this before and be aware of the pro's and con's and the best way to do this.

I am looking to create, on the fly, a certain number of repeating or replicated field rows.

The number of rows would be based off of a field in a db with a row structure similar to the following (dd = drop down, lb = label and tx = text entry):

ddItem1 lbAO1 ddA1 lbDO1 ddD1 ddS1 txC1

There could be from 1 to possibly 100 rows that would be filled in from the db with the contents being based off of which record is selected from the main table and then populated partially from the main table and from sub tables as well. Upon text entry or drop down selection the record would be saved back to the db.

The dd's would be populated from sub tables.
ddItem would index off of an existing value.
ddA/ddD/ddS would default to the first index (blank) value.

So .. here's the questions:

1- I've looked at panels and placing controls on them and the editable table option. At this point, I am unsure which would probably be the easiest to pursue considering that I'm not sure how easy it is to replicate a set or row of controls and have it scrollable if the panel is used, or if the edit table option would suffice for my needs.

2- combobox says: 'ComboBox does not support the Text property and the user cannot write anything inside a ComboBox.' Yet, I can enter text in the field, which I don't want allow, just want a selection to be made. How can this be done? Or is there a drop down only option, list box won't work.

3- Is there a way to have a table hi-light the entire row when the user clicks on it instead of just the selected cell?

4- Is it possible to have a checkbox in the editable table? If not, I can simply show an 'X', just not as appealing.

If anyone has done something along these lines, I'd be grateful for any insight.

Mostly, I would hate to waste time re-creating the wheel if it already exists, grin.

Regards and Thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
2. That is correct on the device. You can use the Door library to make it behave the same on the desktop too:
obj1 is an Object and the ComboBox is named ComboBox1.
B4X:
    obj1.New1(False)
    obj1.FromControl("ComboBox1")
    obj1.SetProperty("DropDownStyle","DropDownList")
3. The table control doesn't support full row selection. Check out Filippo's ListView which does support it: http://www.b4x.com/forum/additional...ew-dll-without-sqlite-interface.html#post9571
4. You can customize the editable table to have a checkbox.
 

xeir

Member
Licensed User
Erel-

Thanks for the info:
2- Worked perfectly, figured it was something simple.
3- Considered ListView, didn't use for some other reason, will have to re-check that.
4- Good to know, I'll dig around and play with that one a bit.

As to the first question, still looking for any info relating, or if there's an example around for repeating controls, etc.

Thanks
 

xeir

Member
Licensed User
Thanks for the additional info on the panels.

Thought about the earlier info, and it would seem that using the editable table should be the easier way to go, I think, as it already does the table/panel/control handling.

Although I do have an issue or two, mostly in understanding what is going on or not going on as may be the case.

I've made the table the way I want it with a rough approximation of what I want on it. I added the Editable Table as a module into my project.

The table is in my main project 'Main.tblService', under App_Start I changed:

B4X:
EditableTable.SetEdit("Main.Table1","","Main.SetCombo")
to
EditableTable.SetEdit("Main.tblService","","Main.SetCombo")

Received an error, so changed this under EditableTable, line 18:

B4X:
AddPanel("Main.Table1","pnlEdit",20,20,110,26)
to
AddPanel("Main.tblService","pnlEdit",20,20,110,26)

I receive: An error occured on sub editabletable.setedit.
Line number: 46
Control(eventScrollH & count, Event).New1(o.GetProperty2("Item",0),"ValueChanged")
Object reference not set to an instance of an object.

A little lost here, as everything seems to be pointed in the correct direction.

while at it, I did think of something else, is it possible to have a drop down without showing the right side drop down icon? I ask because I can fit everything needed on a row without scrolling, but as soon as I add the code to show the combo-boxes, it will of course make the table wider.

Regards and I hope I'm not asking too many ridiculous questions.
 
Top