### Toolbar Add ColorPicker

Example of adding the B4J ColorPicker View to the Top-Toolbar of the HTML Editor View.
Requires the library JavaObject.
The selected color is copied to the clipboard, use Paste to insert into HTML text.
Note:
The solution could be enhanced by creating an event to insert the colorvalue when the colorpicker dialog closes.
Add the ColorPicker at AppStart
`Sub AppStart (Form1 As Form, Args() As String)
...
' Use callsubdelayed to add the button to the right of the top-toolbar
CallSubDelayed(Me, "AddColorPicker")
...
Sub to add the ColorPicker
`Sub AddColorPicker
Dim joHE As JavaObject = HTMLEditor1
Dim joTB As JavaObject = joHE.RunMethod("lookup", Array(".top-toolbar"))
Dim tbColorPicker As ColorPicker
tbColorPicker.Initialize("tbColorPicker")
tbColorPicker.ToolTipText = "Select & copy color hex value."
tbColorPicker.PrefHeight = 26
' Set the prefwidth. Default is 52. If making wider, e.g. 150 the color value is also shown
tbColorPicker.PrefWidth = 52
joTB.RunMethodJO("getItems", Null).RunMethod("add", Array(tbColorPicker))
End Sub`
' Handle color selection. The HexRGB value is copied to the clipboard. Insert into the text by pasting.
`Sub tbColorPicker_ValueChanged (Value As Paint)
Dim ColorInt As Int = fx.Colors.To32Bit(Value)
Dim HexARGB As String = Bit.ToHexString(ColorInt)
Dim HexRGB As String = HexARGB.SubString2(2,8)
fx.Clipboard.SetString($"#${HexRGB}"$)
End Sub`
`

Changed: , Category: HTMLEditor, File: T6C198M1457.htm, ID: 1457