Advansys Home Page

Return to the Forum Home
 Post New TopicNote: Polls are considered new topics.  If you post a poll, it will be created as a new subject in this forum, not as a reply within this topic.Topic Replies: PopIt!Post A Reply
MyPop™ | register | search | faq | forum home


PreviousGo to the next oldest topic in this forum Go to the next newest topic in this forumNext
 Advansys Support Forums » Advansys Formativ » Formativ Studio » Toolbar Implementation for Rich Text Box

Rating:   Not yet rated
Author Topic:   Toolbar Implementation for Rich Text Box
ctaleck
Member
Describes the mood or content of the topic posted Click Here to See the Profile for ctaleck   Reply With QuoteEdit or Delete MessageReport This Post
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
Support 3
Advansys Support Team
Describes the mood or content of the topic posted Click Here to See the Profile for Support 3   Reply With QuoteEdit or Delete MessageReport This Post
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 Support

Posts: 821 | Registered: February 19, 2006
ctaleck
Member
Describes the mood or content of the topic posted Click Here to See the Profile for ctaleck   Reply With QuoteEdit or Delete MessageReport This Post
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
ctaleck
Member
Describes the mood or content of the topic posted Click Here to See the Profile for ctaleck   Reply With QuoteEdit or Delete MessageReport This Post
How would I go about getting the source code for the Stationery sample? The version I have is Flexlocked.
Posts: 78 | Registered: May 01, 2008
Support 3
Advansys Support Team
Describes the mood or content of the topic posted Click Here to See the Profile for Support 3   Reply With QuoteEdit or Delete MessageReport This Post
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 Support

Posts: 821 | Registered: February 19, 2006
Support 3
Advansys Support Team
Describes the mood or content of the topic posted Click Here to See the Profile for Support 3   Reply With QuoteEdit or Delete MessageReport This Post
THTMLEditorEx is our custom extension to the IHTMLDocument2 interface which lets you to edit the HTML document. It has the methods listed below:

- Fontdialog
- InsertImage
- InsertLink
- InsertHorizontalLine
- Save()
- CancelEdits()

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.

Regards,
Advansys Support

Posts: 821 | Registered: February 19, 2006
ctaleck
Member
Describes the mood or content of the topic posted Click Here to See the Profile for ctaleck   Reply With QuoteEdit or Delete MessageReport This Post
Is there a way to make a THTMLEditorEx scrollable, but not editable?
Posts: 78 | Registered: May 01, 2008
Support 3
Advansys Support Team
Describes the mood or content of the topic posted Click Here to See the Profile for Support 3   Reply With QuoteEdit or Delete MessageReport This Post
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.
      
MainForm.wbPreview.Navigate("c:\temp\text.htm")  


Scrollbar appear to works in both of these controls.

Regards,
Advansys Support

Posts: 821 | Registered: February 19, 2006
ctaleck
Member
Describes the mood or content of the topic posted Click Here to See the Profile for ctaleck   Reply With QuoteEdit or Delete MessageReport This Post
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 = False

Posts: 78 | Registered: May 01, 2008
Support 3
Advansys Support Team
Describes the mood or content of the topic posted Click Here to See the Profile for Support 3   Reply With QuoteEdit or Delete MessageReport This Post
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 Support

Posts: 821 | Registered: February 19, 2006

All times are
Post New TopicNote: Polls are considered new topics.  If you post a poll, it will be created as a new subject in this forum, not as a reply within this topic.Post A Reply
Print Page
Printable
Email a Friend
Email a Friend
Topic Replies: PopIt!
PopIt!
MyPop™
MyPop™
Contacts
Contacts
Administrative Links:
Close Topic
Close
Manage Topic
Manage
Delete Topic
Delete
Admin Options
PreviousGo to the next oldest topic in this forum Go to the next newest topic in this forumNext

Rate Topic:

Hop To:

© Advansys Pty Limited 2005.

OpenTopic 3.1.0