May 27, 2008 at 12:52 pm #3607
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.]
May 27, 2008 at 5:33 pm #5611
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:temptext.htm”).
– Add the following source to the applet.
Sub Main(Client, GWEvent) Maindlg.htmlEditor.EditFile("c:temptext.htm") Maindlg.ShowModal End Sub Sub btnFontClick(Sender) Maindlg.heSignature.Fontdialog End Sub
See below the list of some HTMLEditorEx methods:
Hope this helps.
Advansys SupportMay 28, 2008 at 12:35 pm #5612
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:
del6vcl.hlp <- I assume this is the file to search, but I tried all of them anyway…
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.]May 28, 2008 at 12:56 pm #5608
How would I go about getting the source code for the Stationery sample? The version I have is Flexlocked.May 28, 2008 at 2:48 pm #5616
Stationery solution is one of our commercial solution. Unfortunately we are unable to provide the source of the commercial solutions.
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:temptext.htm”)
– Maindlg.htmlEditor.CancelEdits: Cancel the changes.
Advansys SupportMay 28, 2008 at 6:40 pm #5609
THTMLEditorEx is our custom extension to the IHTMLDocument2 interface which lets you to edit the HTML document. It has the methods listed below:
You can access the IHTMLDocument2 (http://msdn.microsoft.com/en-us/library/aa752641.aspx) from the THTMLEditorEx which lets you to access the IHTMLDocument2 Members (See the sample code 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.
Advansys SupportNovember 16, 2009 at 3:04 pm #5610
Is there a way to make a THTMLEditorEx scrollable, but not editable?November 17, 2009 at 4:59 pm #5615
It may be possible to make THTMLEditorEx not editable, however a quick scan unable to locate any properties: http://msdn.microsoft.com/en-us/library/aa752085(VS.85).aspx
Another option is to use EmbeddedWB control from “Form Designer” – Additional tab.
Scrollbar appear to works in both of these controls.
Advansys SupportNovember 18, 2009 at 8:35 am #5613
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?
Form.EmbeddedWB1.Visible = FalseNovember 18, 2009 at 3:11 pm #5614
WebBrowser.Visible property will not hide/show the control, see MSDN documentation below:
Sets or gets a value that indicates whether the object is visible or hidden.
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
- You must be logged in to reply to this topic.