posted
I'm looking for a toolbar implementation for a rich text box control. Is there reusable sample code somewhere that could be imported into an existing form?
The GW toolbar is what I would like to emulate:
[This message was edited by ctaleck on May 27, 2008 at 01:01 PM.]Posts:
78 | Registered: May 01, 2008
posted
You can use the HTMLEditorEx control to update the font, insert image, etc. HTMLEditorEx located in the Formativ "Form Designer" - Additional tab. See our Stationery solution which uses the HTMLEditorEx control, select a Stationery and press the Edit option which will let you to update the stationery.
See below the sample code to display the Font dialog and update the Html font:
- Create a From and name it to Maindlg - Drop the HTMLEditorEx to the Form and name it to "htmlEditor" - Add a button and name it to btnFont. - You need to have a html file to edit ("c:\temp\text.htm"). - Add the following source to the applet.
Sub Main(Client, GWEvent)
Maindlg.htmlEditor.EditFile("c:\temp\text.htm")
Maindlg.ShowModal
End Sub
Sub btnFontClick(Sender)
Maindlg.heSignature.Fontdialog
End Sub
See below the list of some HTMLEditorEx methods: - InsertImage - InsertLink - InsertHorizontalLine
Hope this helps.
Regards, Advansys SupportPosts:
821 | Registered: February 19, 2006
posted
I created a sample form from your suggestion and got it working. Although the Font Dialog is not exactly similar to the toolbar concept I was looking for, it does get the job done in those rare cases where someone would want to format their text.
I tried looking for more documentation on the THTMLEditorEx but was not successful. I found other references to "THTML" but none of them with "EditorEx." Specifically, I would like to know how to get the text of out the control and either into a variable or back into the text file in the temp dir.
I searched each of these help files in the Delphi help files as suggested in the readme.txt: dbxpress.hlp del6com.hlp del6cw.hlp del6dap.hlp del6dbd.hlp del6iota.hlp del6new.hlp del6op.hlp del6prog.hlp del6vcl.hlp <- I assume this is the file to search, but I tried all of them anyway... delphi6.hlp dlx1clx.hlp ibx.hlp
Also, your button code should be htmlEditor:
Sub btnFontClick(Sender)
Maindlg.htmlEditor.Fontdialog
End Sub
[This message was edited by ctaleck on May 28, 2008 at 12:54 PM.]Posts:
78 | Registered: May 01, 2008
posted
Stationery solution is one of our commercial solution. Unfortunately we are unable to provide the source of the commercial solutions.
quote:I would like to know how to get the text of out the control and either into a variable or back into the text file in the temp dir.
You can use the Save method to save the changes to the file. See beloe for more information.
- Maindlg.htmlEditor.Save : Changes will be saved to the existing HTML file. If you want to load the updated string to a variable then you can call the following method. myHtml = utilities.LoadStringFromFile("c:\temp\text.htm")
- Maindlg.htmlEditor.CancelEdits: Cancel the changes.
Regards, Advansys SupportPosts:
821 | Registered: February 19, 2006
posted
THTMLEditorEx is our custom extension to the IHTMLDocument2 interface which lets you to edit the HTML document. It has the methods listed below:
Sub btnHTMLDocumentClick(Sender)
dim oHTMLDocument
set oHTMLDocument = nothing
if Utilities.IHTMLDocumentFromViewHandle(Maindlg.Handle, oHTMLDocument) = 0 then
msgbox oHTMLDocument.body.innertext
msgbox oHTMLDocument.body.innerHtml
end if
set oHTMLDocument = nothing
End Sub
Hope this helps.
Regards, Advansys SupportPosts:
821 | Registered: February 19, 2006
posted
I tried to do a variation of this by hiding and showing the two versions of the controls separately. However, I discovered that you cannot hide an EmbeddedWB. Any ideas on why this code does not work?
posted
WebBrowser.Visible property will not hide/show the control, see MSDN documentation below:
quote: Visible Property: Sets or gets a value that indicates whether the object is visible or hidden.
Remarks: When the Windows Internet Explorer application is first created, it is hidden. It becomes visible after the Navigate method or the GoSearch method is used.
This method only applies when you are automating Internet Explorer. You co-create an instance of Internet Explorer, and then set this method to TRUE to show the instance.
The WebBrowser object saves the value of this property, but otherwise ignores it.
You can add a Panel control from "Form Designer" - Standard/Enhanced tab then add EmbeddedWB control on top of the panel. Finally, hide/show panel control.
Maindlg.panel.visible = false
Regards, Advansys SupportPosts:
821 | Registered: February 19, 2006