/ Forums / Advansys Formativ / Formativ Creator / Toolbar Implementation for Rich Text Box

  • Creator
    Topic
  • #3607
    ctaleck
    Participant

      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.]

    • Author
      Replies
    • #5611
      Support 3
      Participant

        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:
        – InsertImage
        – InsertLink
        – InsertHorizontalLine

        Hope this helps.

        Regards,
        Advansys Support

        #5612
        ctaleck
        Participant

          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.]

          #5608
          ctaleck
          Participant

            How would I go about getting the source code for the Stationery sample? The version I have is Flexlocked.

            #5616
            Support 3
            Participant

              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:temptext.htm”)

              Maindlg.htmlEditor.CancelEdits: Cancel the changes.

              Regards,
              Advansys Support

              #5609
              Support 3
              Participant

                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

                #5610
                ctaleck
                Participant

                  Is there a way to make a THTMLEditorEx scrollable, but not editable?

                  #5615
                  Support 3
                  Participant

                    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:temptext.htm")  
                    

                    Scrollbar appear to works in both of these controls.

                    Regards,
                    Advansys Support

                    #5613
                    ctaleck
                    Participant

                      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
                      #5614
                      Support 3
                      Participant

                        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

                      Viewing 9 replies - 1 through 9 (of 9 total)
                      • You must be logged in to reply to this topic.