B4J Question [ABMaterial] Display formatted ABMEditor Text on table.

Discussion in 'B4J Questions' started by Mashiane, Jun 4, 2018.

  1. Mashiane

    Mashiane Expert Licensed User

    Hi there

    I'm having an editor in my modal sheet, data is saved and retrieved property.

    How can I convert this text to normal for display in an ABMLabel to show as normal text? Is there a built in function that can help with the formatting?

    See Impact and Status below. These can contain paragraph text etc that I intend to limit to a particular number of characters before display.

    Can someone please advise?


    Tagged.png

    Thanks
     
  2. alwaysbusy

    alwaysbusy Expert Licensed User

    This has been asked many times before on the forum and the answer is you can't. First thing you should ask yourself, why should I use an ABMEditor in the first place. Like in your example, it is hard to imagine 'On Hold 'must be so heavely formatted it needs its own iFrame, with its own CSS, Javascript, embedded images, etc.

    As said before, an ABMEditor is an almost complete webpage (an iFrame), so loading such a list for e.g. 20 rows, would mean loading 21 almost full webpages! If you insist in using an ABMEditor, you will have to strip the html codes yourself (you could maybe replace the bold/italic/underline tags by {} tags to keep some formatting).
     
  3. Mashiane

    Mashiane Expert Licensed User

    I think there has been some misunderstanding of my question and I didnt find any reference here specific to ABMEditor text in relation to my question. I am NOT at all using an ABMEditor on a table. My ABMEditor is on a modal sheet, the text is saved as HTML and retrieved as HTML to a database. What I want to do is display that saved text on a table without the tags. Forget about the 'On Hold', it's irrelevant, the issue is the tags around the text, thus my indication of ...These can contain paragraph text etc that I intend to limit to a particular number of characters before display.... I had thought there is an easier way to perhaps do that within ABM.

    The last part of your answer however seems to address my problem and thanks. I have to strip the html codes myself. Ta!
     
  4. alwaysbusy

    alwaysbusy Expert Licensed User

    You could also try to make an ABMCustomComponent with just a <div> and its innerHTML being what you get returned in the GetHTML() method. (untested)

    If that would work, maybe I can look into a new method in ABMLabel (e.g. setTextAsRAWHTML).
     
    Mashiane likes this.
  5. Mashiane

    Mashiane Expert Licensed User

    You are a star!!! Thanks a million, will try the custom component so long.
     
  6. alwaysbusy

    alwaysbusy Expert Licensed User

    It looks like it is possible if I would add a write-only TextAsRAWHTML property:

    Note that we use ABM.SIZE_CUSTOM, which is a normal <div> tag
    Code:
    Dim realEditorLbl As ABMLabel
    realEditorLbl.Initialize(
    page"realEditorLbl""", ABM.SIZE_CUSTOM, False"")
    page.CellR(1,1).AddComponent(realEditorLbl)
    ...
    Sub btn1_Clicked(Target As String)
       
    Dim editor As ABMEditor = page.Component("editor")
       
    Dim editorlbl As ABMEditor = page.Component("editorlbl")
       editorlbl.SetHTML(editor.GetHTML)
       editorlbl.Refresh  
      
       
    Dim realEditorLbl As ABMLabel = page.Component("realEditorLbl")
       realEditorLbl.TextAsRAWHTML = editor.GetHTML
       realEditorLbl.Refresh
    End Sub
    The result in the label is pretty close (top = ABMEditor, read-only, bottom = ABMLabel)

    [​IMG]
     
    Last edited: Jun 4, 2018
    prajinpraveen, Mashiane and mindful like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice