Hi All, me again, sorry if this is a stupid question, but I am seeing an issue while adding a few controls inside a ModalSheet dynamically.
Basically a modalsheet opens up and it allows the user to create a Database table, the user can continue to add more columns and select which column needs to be made the Primary key.
This all works beautiful up to 8 columns, but the issue i am seeing starts happening when I want to add more than 8 columns.
Each row on the modalsheet container consists of a ABMInput control, ABMCombo, ABMCheckBox and two ABMButtons.
If the user clicks on the Add button another row will be added to the container with the same controls described above.
As I mentioned this works just fine as long as I keep it under 8 rows, please watch the small video i created which shows the issue, basically after the 8th row, the 9th row gets created with the same controls but when i click on the ABMCombo control, it doesn't display the items added to it, the ABMCombo should contain the Column Type items, INTEGER, TEXT, BLOB and REAL, as you guys can see all the items created up to the 8th row display these items inside the ABMCombo controls just fine, but after the 9th one, the ABMCombo doesn't show the drop down list of items, I've noticed that If I create a 10th row and then i go back to the 9th row then i can make the ABMCombo display the list of items, but When I select any of them it doesn't show it as the item selected either way.
I was wondering if this is a limitation of ABMaterial, or if and most likely i 'am doing something wrong, here's also the relevant code that creates the ModalSheet with the initial controls and the code that adds the rest of the rows upon clicking the Add button.
And here's the code that adds more rows with the same controls.
Here's a small video I created which shows the issue, you guys will notice that on the 9th and 10th row even though I continue to click on the ABMCombo control the list of items doesn't get displayed.
Hopefully someone can shed some light on this problem.
Walter
Basically a modalsheet opens up and it allows the user to create a Database table, the user can continue to add more columns and select which column needs to be made the Primary key.
This all works beautiful up to 8 columns, but the issue i am seeing starts happening when I want to add more than 8 columns.
Each row on the modalsheet container consists of a ABMInput control, ABMCombo, ABMCheckBox and two ABMButtons.
If the user clicks on the Add button another row will be added to the container with the same controls described above.
As I mentioned this works just fine as long as I keep it under 8 rows, please watch the small video i created which shows the issue, basically after the 8th row, the 9th row gets created with the same controls but when i click on the ABMCombo control, it doesn't display the items added to it, the ABMCombo should contain the Column Type items, INTEGER, TEXT, BLOB and REAL, as you guys can see all the items created up to the 8th row display these items inside the ABMCombo controls just fine, but after the 9th one, the ABMCombo doesn't show the drop down list of items, I've noticed that If I create a 10th row and then i go back to the 9th row then i can make the ABMCombo display the list of items, but When I select any of them it doesn't show it as the item selected either way.
I was wondering if this is a limitation of ABMaterial, or if and most likely i 'am doing something wrong, here's also the relevant code that creates the ModalSheet with the initial controls and the code that adds the rest of the rows upon clicking the Add button.
CreateModalSheet:
Sub BuildModalSheet() As ABMModalSheet
Dim myModal As ABMModalSheet
myModal.Initialize(page, "myModal", False, ABM.MODALSHEET_TYPE_NORMAL, "mymodal")
myModal.Content.UseTheme("mymodal")
myModal.Footer.UseTheme("mymodal")
myModal.Size = ABM.MODALSHEET_SIZE_NORMAL
myModal.IsDismissible = False
fieldlist.Initialize
fieldindex = fieldindex + 1
' create the grid for the content
myModal.Content.AddRows(1,True, "").AddCells12(5,"centre")
'''myModal.Content.AddRows(5,True, "").AddCellsOS(4,0,0,0,3,3,4,"centre")
myModal.Content.AddRows(10,True, "").AddCellsOSMPV(4,-1,0,0,4,3,3,0,0,0,0,ABM.VISIBILITY_ALL, "centre")
'''myModal.Content.AddRows(5,True, "").AddCells12(1,"")
myModal.Content.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components
' add paragraph
myModal.Content.Cell(1,1).AddComponent(ABMShared.BuildParagraph3(page,"par1","Enter Field Name and Field Type to Create Database Table"))
Dim googleInp As ABMInput
googleInp.Initialize(page, "tablename", ABM.INPUT_TEXT, "Enter Table Name", False, "input")
googleInp.AutoCompleteType = ABM.AUTOCOMPLETE_GOOGLE
myModal.Content.Cell(1,1).AddComponent(googleInp)
' create the input fields for the content
Dim inp1 As ABMInput
inp1.Initialize(page, "inp1", ABM.INPUT_TEXT, "FieldName", False, "input")
inp1.Tag = fieldindex&",1"
inp1.PlaceHolderText = "FieldName"
myModal.Content.Cell(2,1).AddComponent(inp1)
Dim fieldType As ABMCombo
fieldType.Initialize(page, "ftype1", "FieldType", 350, "combo")
fieldType.Tag = fieldindex&",2"
fieldType.AddItem("0", "TEXT",BuildSimpleItem("0", "", "TEXT"))
fieldType.AddItem("1", "INTEGER", BuildSimpleItem("1", "", "INTEGER"))
fieldType.AddItem("2", "BLOB", BuildSimpleItem("2", "", "BLOB"))
fieldType.AddItem("3", "REAL", BuildSimpleItem("3", "", "REAL"))
myModal.Content.Cell(2,2).AddComponent(fieldType)
Dim primarykey As ABMCheckbox
primarykey.Initialize(page, "chkbox1"&fieldindex, "Make Primary Key", False, "")
primarykey.Tag = fieldindex&",3"
myModal.Content.Cell(2,3).MarginTop = "30px"
myModal.Content.Cell(2,3).AddComponent(primarykey)
Dim btnfieldadd As ABMButton
btnfieldadd.InitializeFloating(page, "btnfieldadd", "mdi-content-add", "right")
btnfieldadd.Size = ABM.BUTTONSIZE_NORMAL
btnfieldadd.Tag = "2,4"
myModal.Content.cell(2,4).UseTheme("right")
myModal.Content.Cell(2,4).AddComponent(btnfieldadd)
Log("adding btnfieldadd at: " & fieldindex&",4")
' create the grid for the footer
' we add a row without the default 20px padding so we need to use AddRowsM(). If we do not use this method, a scrollbar will appear to the sheet.
myModal.Footer.AddRowsM(1,True,0,0, "").AddCellsOS(1,2,6,6,3,3,3,"modalsheet").AddCellsOS(1,4,0,0,3,3,3, "modalsheet")
myModal.Footer.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components
' create the buttons for the footer
Dim msbtn1 As ABMButton
msbtn1.InitializeFlat(page, "msbtn1", "", "", "CREATE", "transparent")
myModal.Footer.Cell(1,1).AddComponent(msbtn1)
Dim msbtn2 As ABMButton
msbtn2.InitializeFlat(page, "msbtn2", "", "", "CANCEL", "transparent")
myModal.Footer.Cell(1,2).AddComponent(msbtn2)
fieldindex = fieldindex + 1
Return myModal
End Sub
And here's the code that adds more rows with the same controls.
BtnAddfield:
Sub btnfieldadd_Clicked(Target As String)
Dim myModal As ABMModalSheet = page.ModalSheet("myModal")
Dim btn As ABMButton = myModal.Content.Component("btnfieldadd")
Dim btn2 As ABMButton = myModal.Content.Component("btnfielddelete")
Dim tag() As String = Regex.Split(",", btn.Tag)
If fieldindex > 2 Then
Dim tag2() As String = Regex.Split(",", btn2.Tag)
End If
Log("removing add button at: " & tag(0)&","&tag(1))
myModal.Content.Cell(tag(0),tag(1)).RemoveComponent("btnfieldadd")
If fieldindex > 2 Then
'''If btn2.IsInitialized Then
myModal.Content.Cell(tag2(0),tag2(1)).RemoveComponent("btnfielddelete")
'''End If
'''Log("removing button at cell: " & tag(0) & "," & tag(1))
End If
If fieldindex >= 5 Then
'''Log("inserting row...")
'''myModal.Content.AddRow(1, True, "", "").
'''myModal.Content.AddRows(1,True, "").AddCellsOS(4,0,1,1,4,3,3,"centre")
myModal.Content.AddRows(1,True, "").AddCellsOS(4,0,0,0,3,3,3,"centre")
'''myModal.Content.AddRows(1,True, "").AddCellsOSMPV(4,-1,0,0,3,3,3,0,0,10,10,ABM.VISIBILITY_ALL, "centre")
'''myModal.Content.AddRows(1,True, "").AddCellsOSMPV(4,-1,0,0,4,3,3,0,0,10,10,ABM.VISIBILITY_ALL, "centre")
myModal.Content.BuildGrid
myModal.Refresh
End If
' create the input fields for the content
'''fieldindex = fieldindex + 1
fieldindex = fieldindex + 1
Dim inp1 As ABMInput
inp1.Initialize(page, "inp"&fieldindex, ABM.INPUT_TEXT, "FieldName", False, "input")
Log("input field: " & "inp"&fieldindex)
inp1.PlaceHolderText = "FieldName"
myModal.Content.Cell(fieldindex,1).AddComponent(inp1)
'''Log("adding fieldname at cell: " & fieldindex & "," & 1)
Dim fieldType As ABMCombo
fieldType.Initialize(page, "ftype"&fieldindex, "FieldType", 350, "combo")
fieldType.AddItem("0", "TEXT",BuildSimpleItem("0", "", "TEXT"))
fieldType.AddItem("1", "INTEGER", BuildSimpleItem("1", "", "INTEGER"))
fieldType.AddItem("2", "BLOB", BuildSimpleItem("2", "", "BLOB"))
fieldType.AddItem("3", "REAL", BuildSimpleItem("3", "", "REAL"))
myModal.Content.Cell(fieldindex,2).AddComponent(fieldType)
'''Log("adding ABMCombo at cell: " & fieldindex&","&2)
Dim primarykey As ABMCheckbox
primarykey.Initialize(page, "chkbox1"&fieldindex, "Make Primary Key", False, "")
primarykey.Tag = fieldindex&",3"
myModal.Content.Cell(fieldindex,3).MarginTop = "30px"
myModal.Content.Cell(fieldindex,3).AddComponent(primarykey)
Dim btnfieldadd As ABMButton
btnfieldadd.InitializeFloating(page, "btnfieldadd", "mdi-content-add", "right")
btnfieldadd.Size = ABM.BUTTONSIZE_NORMAL
btnfieldadd.Tag = fieldindex&",4"
myModal.Content.Cell(fieldindex,4).UseTheme("right")
myModal.Content.Cell(fieldindex,4).AddComponent(btnfieldadd)
Log("adding btnfieldadd at: " & fieldindex&",4")
'''Log("adding ABMButton at cell: " & fieldindex&","&4)
Dim btnfielddelete As ABMButton
btnfielddelete.InitializeFloating(page, "btnfielddelete", "mdi-action-delete", "right")
btnfielddelete.Size = ABM.BUTTONSIZE_NORMAL
btnfielddelete.Tag = fieldindex&",4"
myModal.Content.Cell(fieldindex,4).UseTheme("right")
myModal.Content.Cell(fieldindex,4).AddComponent(btnfielddelete)
Log("adding btnfielddelete at: " & fieldindex&",4")
'''fieldindex = fieldindex + 1
myModal.Refresh
End Sub
Here's a small video I created which shows the issue, you guys will notice that on the 9th and 10th row even though I continue to click on the ABMCombo control the list of items doesn't get displayed.
Hopefully someone can shed some light on this problem.
Walter