B4J Question HTMLEditor questions

m4.s

Member
Licensed User
Longtime User
Is this a way to hide the toolbars altogether, and/or to hide a specific toolbar row, and/or one or more individual toolbar buttons? In my application, I'd like to allow user to hide all or some based on their personal preferences.
 
Check this example:
Code: Copy
Sub Process_Globals
   Private fx As JFX
   Private MainForm As Form
   Private HTMLEditor1 As HTMLEditor
End Sub

Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   MainForm.RootPane.LoadLayout("1") 'Load the layout file.
   MainForm.Show
   SetToolbar(HTMLEditor1, 0, False)
   SetToolbar(HTMLEditor1, 1, False)
End Sub

Sub SetToolbar (Editor As HTMLEditor, Index As Int, State As Boolean)
   Dim jo As JavaObject = Editor
   Dim nodes() As Object = jo.RunMethodJO("lookupAll", Array(".tool-bar")).RunMethod("toArray", Null)
   Dim toolbar As JavaObject = nodes(Index)
   toolbar.RunMethod("setVisible", Array(State))
   toolbar.RunMethod("setManaged", Array(State))
End Sub
Based on this answer: http://stackoverflow.com/questions/10075841/how-to-hide-the-controls-of-htmleditor
 
Last edited:
Upvote 0
As expected, Erel, your provided solution worked exactly as I needed it to. Many thanks!

Note however, that I did choose to change the initial Dim statement (in SetToolbar function) to:

Dim jo As JavaObject = Editor
...
 
Upvote 0
Back
Top