B4J Question ABMEditor Sizing issue

codie01

Active Member
Licensed User
Longtime User
Hi All,

I am using ABMEditor, which is very good. I have a cell set to a height of 560px, however the ABMEditor component does not expand with the cell unless I click on it and then press the ALT key.

The result is you can not see all the content if you reload it. It does expand when you are first editing data in it.

I have tried refreshing the Cell, the container and the Editor, all without success! I have also used the following code:

B4X:
Sub section0cEditor1_loaded(Target As String)
    Dim myContainer0 As ABMContainer = page.Component("section0a")
    Dim myContainer2 As ABMContainer = myContainer0.Component("section0c")
    Dim myEditor1 As ABMEditor = myContainer2.Component("section0cEditor1")
    myEditor1.SetFocus
    myEditor1.Refresh
End Sub

Has anyone resolved this issue.

Thanks All!
 

codie01

Active Member
Licensed User
Longtime User
Hi Alian and All,

I have solved it and it now works every time. It requires a little extra programming however the result is outstanding.

Step 1. Build the component as normal
B4X:
    Dim section0cEditor1 As ABMEditor
    section0cEditor1.Initialize(page,"section0cEditor1",True,True,"EditorThemeSection1")
    section0cEditor1.HideToolbar
    section0cEditor1.SetEnabled(False)

Step 2. Place the editor component into a cell as normal, then set the cell height you want, will scroll if bigger.

B4X:
    section0c.Cell(4,1).AddComponent(section0cEditor1)
    section0c.Cell(4,1).SetFixedHeight(750,True)

Step 3. Set an update SUB for the editor so it is destroyed when you want it to update. When you rebuild the editor again, it forces the editor, "loaded" event.

B4X:
Sub updateEditortView
    Dim myContainer0 As ABMContainer = page.Component("section0a")
    Dim myContainer2 As ABMContainer = myContainer0.Component("section0c")

    myContainer2.Cell(4,1).RemoveAllComponents
 
    Dim section0cEditor1 As ABMEditor
    section0cEditor1.Initialize(page,"section0cEditor1",True,True,"EditorThemeSection1")
    section0cEditor1.HideToolbar
    section0cEditor1.SetEnabled(False)
 
    myContainer2.Cell(4,1).AddComponent(section0cEditor1)
    myContainer2.Cell(4,1).SetFixedHeight(750,True)
    myContainer2.Refresh
    section0cEditor1.Refresh
End Sub

Step 4. Every time the editor is rebuilt it runs the loaded event in the sub.

B4X:
Sub section0cEditor1_loaded(Target As String)
    Dim myContainer0 As ABMContainer = page.Component("section0a")
    Dim myContainer2 As ABMContainer = myContainer0.Component("section0c")
    Dim myEditor1 As ABMEditor = myContainer2.Component("section0cEditor1")
 
    Dim Cursor As ResultSet
    Dim sql1 As SQL
    sql1.Initialize2("com.mysql.jdbc.Driver", "jdbc:mysql://" & ABMShared.myServerAddress & "/" & myServerDatabase, myServerUsername, myServerPassword)
 
    Log(mySearch1&" "&mySearch2)
    Cursor = sql1.ExecQuery("SELECT * FROM mail where messagetime = '" & myMessagetime & "' AND messagedate = '" & myMessageDate & "'")

    Do While Cursor.NextRow = True
        myEditor1.SetHTML(Cursor.GetString("message"))
    Loop
 
    Cursor.Close
    sql1.Close
 
    myEditor1.Refresh
End Sub

job done!
 
Upvote 0

codie01

Active Member
Licensed User
Longtime User
upload_2018-12-5_2-39-26.png


B4J and ABMaterial Rock, here is the editor being used in a email program inside an ABMaterial web app, I have died and gone to heaven.
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
B4J and ABMaterial Rock, here is the editor being used in a email program inside an ABMaterial web app, I have died and gone to heaven
Reminds me of the "Doug and the Slugs" tune:
Makin it work, takes a little longer...
Makin it work, takes a bit of time...

 
Upvote 0

Harris

Expert
Licensed User
Longtime User
here is the editor being used in a email program inside an ABMaterial web app
Hey, would you mind sharing the code for this page? Would save me much work rebuilding it for my project.

Thanks
 
Upvote 0
Top