A VFP Html Richtext editor

Published on by Yousfi Benameur

This is a Wysiwyg html editor drived by automation from visual foxpro.
(what you see is what you get).
It uses the vfp browser (Internet Explorer).(remember to Apply IE11 emulation for
another and better uses).
it encapsulates all rich text modalities and can open,modify and save a document
as a web page.
All functionalities of a richtext editor  are embed in the toolbar.(Can be extended to other functions).
I made images from whose shipped with vfp(because no attachment).

Originally i have better ones.I suggest you do the same thing.

Apply any toolbar action to the document selection.

To clean all the page issue F5 (warning : this clear all objects on the page)

 

*Begin code

If !_vfp.StartMode=0
    On Shutdown Quit
Endi


Set Safe Off
*create ypreview.ico in temp folder
local myvar
text to m.myvar noshow
0000010002002020100000000000E8020000260000001010100000000000280100000E0300002800000020000000400000000100040000000000000200000000000000000000100000001000000000000000000080000080000000808000800000008000800080800000C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000877777777777777777777000000000008FFEEEEEEEEEEEEEEEEE7000000000008FFEE0000000000000EE7000000000008FFEEEEEEEEEEEEEEEEE7000000000008FFEE9999999999998000080000000008FFEEEEEEEEEEEEE00777700000000008FFEE0000000000087777788000000008FFEEEEEEEEEEE8077777787080000008FFFFFFFFFFFFF077777778E700000008FFFFFFFFFFFFF0777777787700000008FFFFFFFFFFFFF07E7777787700000008FFFFFFFFFFFFF0797777787700000008FFEE9999999998099777787080000008FFEEEEEEEEEEEE089997788000000008FFEE9999999999990777700800000008FFEEEEEEEEEEEEEEE000080000000008FFEE999999999999EEE7000000000008FFEEEEEEEEEEEEEEEEE7000000000008FFEE9999999999999EE7000000000008FFEEEEEEEEEEEEEEEEE7000000000008FF0000000000EE800000000000000008FFEEEEEEEEEEFF8FF780000000000008FFFFFFFFFFFFFF8F7800000000000008FFFFFFFFFFFFFF878000000000000008FFFFFFFFFFFFFF880000000000000008FFFFFFFFFFFFFF8000000000000000088888888888888880000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF800001FF800001F9800001F1800001E3800001C78000008F8000001F8000003F8000001F8000001F8000001F8000001F8000001F8000001F8000003F8000003F800000FF800001FF800001FF800001FF800001FF800001FF800003FF800007FF80000FFF80001FFF80003FFF80007FFFFFFFFFFFFFFFFFFF2800000010000000200000000100040000000000800000000000000000000000100000001000000000000000000080000080000000808000800000008000800080800000C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00000000000000000000000000000000000FEEEEEEEEE000000FEE9999000000000FEEEEE0877800000FFFFF0877E880000FFFFF07777870000FFFFF07977870000FEE9908997880000FEEEEE0877800000FEE9998000000000FEEEEEEEEE000000F99999F000000000FEEEEEF070000000FFFFFFF000000000000000000000000FFFF0000000C00000008000000010000000300000003000000030000000300000003000000070000000F0000000F0000000F0000001F0000003F0000007F0000
endtext

Strtofile(Strconv(m.myvar,16),Addbs(Sys(2023))+"ypreview.ico")
Set Safe On

Publi yform
yform=Newobject("yedhtml_tb_class")
yform.Show
Read Events
Retu
*
Define Class yedhtml_tb_class As Form
    Height = 554
    Width = 1001
    ShowWindow = 2
    ShowTips = .T.
    AutoCenter = .T.
    Caption = "yHtml Editor"
    Icon = Home(1)+"Graphics\Icons\Misc\misc15.ico"
    BackColor = Rgb(86,167,205)
    yinner = ""
    yfilename = ""
    otoolbar = .F.
    Name = "Form1"

    Add Object obrowser As OleControl With ;
        oleclass="shell.explorer.2",;
        Top = 6, ;
        Left = 9, ;
        Height = 540, ;
        Width = 980, ;
        Anchor = 15, ;
        Name = "oBrowser"

    Procedure Destroy
        If ! (Thisform.yinner== Thisform.obrowser.Document.getElementbyId("oDiv").innerHTML)

            If Messagebox("the selection have changed. Do you want to save ?",4+64,"saving... ?")=6
                Thisform.otoolbar.command15.Click()
                DoEvent
            Endi
        Endi

        Declare Integer Sleep In Kernel32 Integer
        For i=1 To 20
            Thisform.Height=Thisform.Height-2*i

            If  Thisform.Height<=40
                Exit
            Endi
            Sleep(5)
        Endfor
        Clea Events
    Endproc

    Procedure Load
        Publi m.yrep
        m.yrep=Addbs(Sys(2023))   &&temp folder
        Set Safe Off
        Set Textmerge On To (m.yrep+"yhtml_editor.html") Noshow
        TEXT
        <HTML>
        <HEAD>
        <TITLE>HTML Editor</TITLE>

        <SCRIPT>
        window.onload=doInit
        function doInit(){
        // Ensure that all document elements except the content editable DIV are unselectable.
        for (i=0; i<document.all.length; i++)
         document.all(i).unselectable = "on";
        oDiv.unselectable = "off";
        // Clear any text in the Document window and set the focus.
        oDiv.innerHTML="";
        oDiv.focus();
        }
        </SCRIPT>
        </HEAD>
        <BODY STYLE="overflow:hidden; margin:0px"  oncontextmenu="return false;" scroll="yes">
        <DIV  ID="oContainer" STYLE="background-color:threedface; border:1px solid #cccccc position:relative; height:100%; top:0;">
        <DIV ID="oDiv" CONTENTEDITABLE STYLE="height:100%;background-color:white; overflow:auto; width:100%;"> </DIV>
        </DIV>
        </BODY>
        </HTML>
        ENDTEXT

        Set Textmerge To
        Set Safe On
    Endproc

    Procedure Activate
        If Type("thisform.oToolbar")="O" And     !Isnull(Thisform.otoolbar)
            Return
        Endif

        *Set Classlib To ytoolbar Additive
        Thisform.otoolbar=Create("ytoolbar",Thisform)
        With Thisform.otoolbar
            .Dock(0)
            .Show
        Endwith
        *Release Classlib ytoolbar
    Endproc

    Procedure obrowser.Init
        This.Navigate(yrep+"yhtml_editor.html")
    Endproc

Enddefine
 

*Class ytoolbar

DEFINE CLASS ytoolbar AS toolbar
    Caption = "Toolbar1"
    Height = 31
    Left = 41
    Movable = .F.
    Top = 2
    Width = 1105
    BackColor = RGB(179,209,242)
    ShowWindow = 1
    oformref = .F.
    Name = "ytoolbar"

    ADD OBJECT separator9 AS separator WITH ;
        Top = 3, ;
        Left = 5, ;
        Height = 0, ;
        Width = 0, ;
        Name = "Separator9"

    ADD OBJECT command25 AS commandbutton WITH ;
        Top = 3, ;
        Left = 5, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home()+"graphics\bitmaps\tlbr_w95\new.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "New", ;
        Name = "Command25"

    ADD OBJECT command11 AS commandbutton WITH ;
        Top = 3, ;
        Left = 26, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\offctlbr\small\color\open.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Open", ;
        Name = "Command11"

    ADD OBJECT command1 AS commandbutton WITH ;
        Top = 3, ;
        Left = 47, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\paste.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Paste", ;
        Name = "Command1"

    ADD OBJECT command2 AS commandbutton WITH ;
        Top = 3, ;
        Left = 68, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\cut.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Cut", ;
        Name = "Command2"

    ADD OBJECT command3 AS commandbutton WITH ;
        Top = 3, ;
        Left = 89, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\copy.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Copy", ;
        Name = "Command3"


    ADD OBJECT command4 AS commandbutton WITH ;
        Top = 3, ;
        Left = 110, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\lft.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Left align", ;
        Name = "Command4"

    ADD OBJECT command5 AS commandbutton WITH ;
        Top = 3, ;
        Left = 131, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\cnt.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Align center", ;
        Name = "Command5"

    ADD OBJECT command8 AS commandbutton WITH ;
        Top = 3, ;
        Left = 152, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\rt.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Right Align", ;
        Name = "Command8"


    ADD OBJECT command6 AS commandbutton WITH ;
        Top = 3, ;
        Left = 173, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\bld.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Bold", ;
        Name = "Command6"

    ADD OBJECT command7 AS commandbutton WITH ;
        Top = 3, ;
        Left = 194, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\itl.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Italic", ;
        Name = "Command7"

    ADD OBJECT command9 AS commandbutton WITH ;
        Top = 3, ;
        Left = 215, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\undrln.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Underline", ;
        Name = "Command9"

    ADD OBJECT command16 AS commandbutton WITH ;
        Top = 3, ;
        Left = 236, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\undo.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Undo", ;
        Name = "Command16"

    ADD OBJECT command35 AS commandbutton WITH ;
        Top = 3, ;
        Left = 257, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\redo.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Redo", ;
        Name = "Command35"

    ADD OBJECT command21 AS commandbutton WITH ;
        Top = 3, ;
        Left = 278, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\delete.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Delete  selection", ;
        Name = "Command21"

    ADD OBJECT command27 AS commandbutton WITH ;
        Top = 3, ;
        Left = 299, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\wordundr.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Fonts", ;
        Name = "Command27"

    ADD OBJECT command10 AS commandbutton WITH ;
        Top = 3, ;
        Left = 320, ;
        Height = 24, ;
        Width = 22, ;
        Picture = "forecolor.gif", ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Forecolor", ;
        Name = "Command10"

    ADD OBJECT command30 AS commandbutton WITH ;
        Top = 3, ;
        Left = 341, ;
        Height = 24, ;
        Width = 22, ;
        Picture = "backcolor.gif", ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "BackColor", ;
        PicturePosition = 14, ;
        Name = "Command30"

    ADD OBJECT command37 AS commandbutton WITH ;
        Top = 3, ;
        Left = 362, ;
        Height = 22, ;
        Width = 23, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\find.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Search", ;
        Name = "Command37"

    ADD OBJECT command28 AS commandbutton WITH ;
        Top = 3, ;
        Left = 384, ;
        Height = 22, ;
        Width = 23, ;
        FontSize = 8, ;
        Picture = "", ;
        Caption = "Ind", ;
        MousePointer = 15, ;
        BackColor = RGB(255,255,0), ;
        Name = "Command28"

    ADD OBJECT command34 AS commandbutton WITH ;
        Top = 3, ;
        Left = 406, ;
        Height = 22, ;
        Width = 23, ;
        FontSize = 8, ;
        Picture = "images\unindent.bmp", ;
        Caption = "Uid", ;
        MousePointer = 15, ;
        BackColor = RGB(255,255,0), ;
        Name = "Command34"

    ADD OBJECT separator8 AS separator WITH ;
        Top = 3, ;
        Left = 436, ;
        Height = 0, ;
        Width = 0, ;
        Name = "Separator8"

    ADD OBJECT command12 AS commandbutton WITH ;
        Top = 3, ;
        Left = 436, ;
        Height = 24, ;
        Width = 21, ;
        Picture = (home(1)+"Graphics\Bitmaps\Outline\Nomask\bmp.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Insert img", ;
        Name = "Command12"

    ADD OBJECT command33 AS commandbutton WITH ;
        Top = 3, ;
        Left = 456, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\VW-DTLS.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Insert table", ;
        Name = "Command33"

    ADD OBJECT command38 AS commandbutton WITH ;
        Top = 3, ;
        Left = 477, ;
        Height = 22, ;
        Width = 23, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\mapnet.bmp"), ;
        Caption = "", ;
        ToolTipText = "Insert flash object", ;
        Name = "Command38"

    ADD OBJECT command39 AS commandbutton WITH ;
        Top = 3, ;
        Left = 499, ;
        Height = 22, ;
        Width = 23, ;
        Picture = (home(1)+"Gallery\Graphics\video.ico"), ;
        Caption = "", ;
        ToolTipText = "Insert  video", ;
        Name = "Command39"

    ADD OBJECT command13 AS commandbutton WITH ;
        Top = 3, ;
        Left = 521, ;
        Height = 24, ;
        Width = 23, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\print.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Print", ;
        Name = "Command13"

    ADD OBJECT command14 AS commandbutton WITH ;
        Top = 3, ;
        Left = 543, ;
        Height = 24, ;
        Width = 28, ;
        Picture = "d:\microsoft visual foxpro 9\graphics\bitmaps\tlbr_w95\rt.bmp", ;
        Caption = "H-Z", ;
        MousePointer = 15, ;
        ToolTipText = "Flip doc", ;
        Name = "Command14"

    ADD OBJECT command17 AS commandbutton WITH ;
        Top = 3, ;
        Left = 570, ;
        Height = 24, ;
        Width = 34, ;
        Picture = "d:\microsoft visual foxpro 9\graphics\bitmaps\tlbr_w95\copy.bmp", ;
        Caption = "Slct", ;
        MousePointer = 15, ;
        ToolTipText = "Select all", ;
        Name = "Command17"

    ADD OBJECT command22 AS commandbutton WITH ;
        Top = 3, ;
        Left = 603, ;
        Height = 24, ;
        Width = 34, ;
        Picture = "d:\microsoft visual foxpro 9\graphics\bitmaps\tlbr_w95\copy.bmp", ;
        Caption = "uSlct", ;
        MousePointer = 15, ;
        ToolTipText = "unSelect", ;
        Name = "Command22"

    ADD OBJECT command19 AS commandbutton WITH ;
        Top = 3, ;
        Left = 636, ;
        Height = 24, ;
        Width = 25, ;
        Picture = (home(1)+"Graphics\Bitmaps\Tlbr_w95\group.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Orederl List", ;
        Name = "Command19"

    ADD OBJECT command20 AS commandbutton WITH ;
        Top = 3, ;
        Left = 660, ;
        Height = 24, ;
        Width = 25, ;
        Picture = (home(1)+"Graphics\Bitmaps\Tlbr_w95\ungroup.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "UnOrdered List", ;
        Name = "Command20"

    ADD OBJECT command23 AS commandbutton WITH ;
        Top = 3, ;
        Left = 684, ;
        Height = 24, ;
        Width = 21, ;
        Picture = (home(1)+"Graphics\Bitmaps\Tlbr_w95\mcr.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Insert link", ;
        Name = "Command23"

    ADD OBJECT command24 AS commandbutton WITH ;
        Top = 3, ;
        Left = 704, ;
        Height = 24, ;
        Width = 21, ;
        Picture = (home(1)+"Graphics\Bitmaps\Tlbr_w95\front.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Un Insert link", ;
        Name = "Command24"

    ADD OBJECT command26 AS commandbutton WITH ;
        Top = 3, ;
        Left = 724, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"Graphics\Bitmaps\Tlbr_w95\line.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Insert Line", ;
        Name = "Command26"

    ADD OBJECT combo1 AS combobox WITH ;
        Height = 25, ;
        Left = 745, ;
        MousePointer = 15, ;
        ToolTipText = "Fontsize (pts)", ;
        Top = 3, ;
        Width = 36, ;
        Name = "Combo1"


    ADD OBJECT command31 AS commandbutton WITH ;
        Top = 3, ;
        Left = 780, ;
        Height = 24, ;
        Width = 22, ;
        Picture = "images\ui_superscript.gif", ;
        Caption = "Sps", ;
        MousePointer = 15, ;
        ToolTipText = "Superscript", ;
        BackColor = RGB(255,128,0), ;
        Name = "Command31"

    ADD OBJECT command32 AS commandbutton WITH ;
        Top = 3, ;
        Left = 801, ;
        Height = 24, ;
        Width = 22, ;
        Picture = "images\ui_subscript.gif", ;
        Caption = "Sbs", ;
        MousePointer = 15, ;
        ToolTipText = "Subscript", ;
        BackColor = RGB(255,128,0), ;
        Name = "Command32"

    ADD OBJECT command41 AS commandbutton WITH ;
        Top = 3, ;
        Left = 822, ;
        Height = 24, ;
        Width = 21, ;
        Picture = (home(1)+"Graphics\Bitmaps\Tlbr_w95\WORDUNDR.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Insert a text as marquee", ;
        PicturePosition = 13, ;
        Name = "Command41"

    ADD OBJECT command42 AS commandbutton WITH ;
        Top = 3, ;
        Left = 842, ;
        Height = 24, ;
        Width = 21, ;
        Picture = (home(1)+"Graphics\Bitmaps\Offctlbr\Small\Color\preview.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Preview in navigator", ;
        Name = "Command42"

    ADD OBJECT command40 AS commandbutton WITH ;
        Top = 3, ;
        Left = 862, ;
        Height = 24, ;
        Width = 21, ;
        Picture = (home(1)+"Graphics\Bitmaps\Offctlbr\Small\Color\paint.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Clear all objects", ;
        Name = "Command40"

    ADD OBJECT command18 AS commandbutton WITH ;
        Top = 3, ;
        Left = 882, ;
        Height = 22, ;
        Width = 23, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\camera.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Copy code to clipboard", ;
        Name = "Command18"

    ADD OBJECT command15 AS commandbutton WITH ;
        Top = 3, ;
        Left = 904, ;
        Height = 24, ;
        Width = 22, ;
        Picture = (home(1)+"graphics\bitmaps\tlbr_w95\save.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "Save", ;
        Name = "Command15"

    ADD OBJECT command36 AS commandbutton WITH ;
        Top = 3, ;
        Left = 925, ;
        Height = 24, ;
        Width = 21, ;
        Caption = "Sk", ;
        MousePointer = 15, ;
        ToolTipText = "Form Skin", ;
        BackColor = RGB(0,255,0), ;
        Name = "Command36"

    ADD OBJECT command43 AS commandbutton WITH ;
        Top = 3, ;
        Left = 945, ;
        Height = 24, ;
        Width = 21, ;
        Picture = (home(1)+"Graphics\Bitmaps\Tlbr_w95\Prop.bmp"), ;
        Caption = "", ;
        MousePointer = 15, ;
        ToolTipText = "preview any codes prg,txt,mpr,..", ;
        Name = "Command43"

    ADD OBJECT command29 AS commandbutton WITH ;
        Top = 3, ;
        Left = 965, ;
        Height = 24, ;
        Width = 22, ;
        FontBold = .T., ;
        FontSize = 12, ;
        Caption = "?", ;
        MousePointer = 15, ;
        ToolTipText = "About", ;
        ForeColor = RGB(255,0,0), ;
        BackColor = RGB(131,235,165), ;
        Name = "Command29"

    ADD OBJECT separator10 AS separator WITH ;
        Top = 3, ;
        Left = 994, ;
        Height = 0, ;
        Width = 0, ;
        Name = "Separator10"

    ADD OBJECT shape1 AS shape WITH ;
        Top = 3, ;
        Left = 994, ;
        Height = 24, ;
        Width = 106, ;
        BackStyle = 0, ;
        BorderStyle = 0, ;
        Name = "Shape1"

    PROCEDURE BeforeDock
        LPARAMETERS nLocation
        if nLocation=0
        dodefault()
        else
        nodefault
        endi
    ENDPROC

    PROCEDURE Init
        #DEFINE ERR_NOFORMPARM_LOC    "You must pass a form reference to create this toolbar."
        PARAMETER oForm

        IF TYPE("m.oForm")#"O" OR ISNULL(m.oForm) OR UPPER(oForm.BaseClass) # "FORM"
            MESSAGEBOX(ERR_NOFORMPARM_LOC)
            RETURN .F.
        ENDIF

        THIS.oFormRef = oForm
        *this.setall("backcolor",rgb(0,255,0),"commandbutton")
        this.setall("mousepointer",15,"commandbutton")

        _screen.activeform.backcolor=rgb(160,167,252)
        this.backcolor=_screen.activeform.backcolor

        publi loComDialog
        loComDialog = createobject("mscomdlg.commondialog")
        loComDialog.Filter = "All Files (*.*)|*.*|Html Files(*.html)|*.html|Htm Files (*.htm)|*.htm"
        loComDialog.MaxFileSize=140
        set safe off
    ENDPROC

    PROCEDURE command25.Click
        if !_screen.activeform.obrowser.document.getElementbyID("oDiv").innerhtml==""
        =_screen.activeform.obrowser.document.execCommand('SaveAs',.t.)    &&,getfile('htm|html'))  &&save in option or cancel
        endi

        _screen.activeform.obrowser.document.getElementbyID("oDiv").innerhtml=""
        _screen.activeform.obrowser.document.getElementbyID("oDiv").focus()
         _screen.activeform.yinner= _screen.activeform.obrowser.document.getElementbyId("oDiv").innerHTML
         _screen.activeform.yfilename=""
        return
    ENDPROC

    PROCEDURE command25.Init
        with this
        .picture=home()+"graphics\bitmaps\tlbr_w95\new.bmp"
        endwith
    ENDPROC

    PROCEDURE command11.Click
        loComDialog.ShowOpen()
        *MESSAGEBOX(loComDialog.FileName)  &&
        if empty(loComDialog.FileName)
        return .f.
        endi
        set safe off
        with  _screen.activeform
        .obrowser.document.getElementbyId("oDiv").innerHTML=filetostr(loComDialog.filename)
        .obrowser.document.getElementbyId("oDiv").focus()
        .yinner= _screen.activeform.obrowser.document.getElementbyId("oDiv").innerHTML
        .yfilename=loComDialog.filename
        endwith
        retu

    ENDPROC

    PROCEDURE command11.Init
        with this
        .picture=home(1)+"graphics\bitmaps\offctlbr\small\color\open.bmp"
        endwith
    ENDPROC

    PROCEDURE command1.Click
        _screen.activeform.obrowser.document.execCommand("paste")
    ENDPROC

    PROCEDURE command1.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\paste.bmp"
        endwith
    ENDPROC

    PROCEDURE command2.Click
        _screen.activeform.obrowser.document.execCommand("cut")
    ENDPROC


    PROCEDURE command2.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\cut.bmp"
        endwith
    ENDPROC


    PROCEDURE command3.Click
        _screen.activeform.obrowser.document.execCommand("copy")
    ENDPROC

    PROCEDURE command3.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\copy.bmp"

        endwith
    ENDPROC


    PROCEDURE command4.Click
        _screen.activeform.obrowser.document.execCommand("justifyleft")
    ENDPROC


    PROCEDURE command4.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\lft.bmp"

        endwith
    ENDPROC

    PROCEDURE command5.Click

        _screen.activeform.obrowser.document.execCommand("JustifyCenter")
    ENDPROC

    PROCEDURE command5.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\cnt.bmp"
        endwith
    ENDPROC

    PROCEDURE command8.Click
        _screen.activeform.obrowser.document.execCommand("justifyRight")
    ENDPROC

    PROCEDURE command8.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\rt.bmp"
        endwith
    ENDPROC


    PROCEDURE command6.Click

        _screen.activeform.obrowser.document.execCommand("bold")
    ENDPROC


    PROCEDURE command6.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\bld.bmp"
        endwith
    ENDPROC

    PROCEDURE command7.Click
        _screen.activeform.obrowser.document.execCommand("italic")
    ENDPROC

    PROCEDURE command7.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\itl.bmp"
        endwith
    ENDPROC

    PROCEDURE command9.Click
        _screen.activeform.obrowser.document.execCommand("underline")
    ENDPROC

    PROCEDURE command9.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\undrln.bmp"
        endwith
    ENDPROC


    PROCEDURE command16.Click
        _screen.activeform.obrowser.document.execCommand("undo")
    ENDPROC

    PROCEDURE command16.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\undo.bmp"  
        endwith
    ENDPROC

    PROCEDURE command35.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\redo.bmp"
        endwith
    ENDPROC

    PROCEDURE command35.Click
        _screen.activeform.obrowser.document.execCommand("redo")
    ENDPROC

    PROCEDURE command21.Click
        _screen.activeform.obrowser.document.execCommand("delete")
    ENDPROC

    PROCEDURE command21.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\delete.bmp"       
        endwith
    ENDPROC

    PROCEDURE command27.Click
        local xfont,xfontname,xfontsize,xfontstyle
        xfont=getfont("Arial",12)
        if not empty(xfont)
        xfontname=getwordnum(xfont,1,",")
        xfontsize=getwordnum(xfont,2,",")
        xfontsize=int(val(getwordnum(xfont,2,",")))   && Required. Integer or String that specifies the font size. This must be a value between 1 and 7, inclusive.
        xfontStyle=getwordnum(xfont,3,",")  
        _screen.activeform.obrowser.document.execCommand("FontName",.f., xfontname)

        local xpoint as integer
        do case
        case xfontsize<=9
        xpoint=1
        case between(xfontsize,10,11)
        xpoint=2
        case between(xfontsize,12,18)
        xpoint=3
        case between(xfontsize,19,23)
        xpoint=4
        case between(xfontsize,24,31)  &&29
        xpoint=5
        case between(xfontsize,32,45)
        xpoint=6
        case xfontsize>=46
        xpoint=7
        endcase
        _screen.activeform.obrowser.document.execCommand("FontSize",.f., m.xPOINT)     &&attention fontsize converted ~ to  points ( 1 to 7)
        if "B" $ xfontstyle
        _screen.activeform.obrowser.document.execCommand("Bold",.t.)
        endi
        if "I" $ xfontstyle
        _screen.activeform.obrowser.document.execCommand("Italic",.t.)
        endi
        _screen.activeform.obrowser.document.getElementbyID("oDiv").focus()
        endi
    ENDPROC

    PROCEDURE command27.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\wordundr.bmp"
        endwith
    ENDPROC

    PROCEDURE command10.Click
        * Changeforecolor of the selected text
        local xforecolor
        xforecolor=getcolor()
        if xforecolor#-1
        _screen.activeform.obrowser.document.execCommand("Forecolor",.f.,m.xforecolor)
        endi
        _screen.activeform.obrowser.document.getElementbyId("oDiv").focus()
    ENDPROC

    PROCEDURE command10.Init
   *This is an ex. how to create image gif with encoded text
        text to m.myvar noshow
        R0lGODlhFQAUAPcAAMDAwP//AAAAgICAgAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAFQAUAAAIeAALCBxIsKDBgwgTKlxYcIAAAQMYFhQAAABEiQMpEhBAICJGjhYHdMRIAEABiA4fLixZYGPJhyoRsiwAoCSAlAJkmhQ4oOIAhxsTEqDZ86bIkzmFVjQ69KRHoT+P8pTYsanCAFizat0aoCDXr1m9gv0qduxWjAkDAgA7
        endtext
        set safe off
        =strtofile(strconv(m.myvar,14),"Forecolor.gif")
        with this
        .picture="Forecolor.gif"
        endwith
    ENDPROC

    PROCEDURE command30.Click
        * Change Background of the selected text
        local xbackcolor
        xbackcolor=getcolor()
        if xbackcolor#-1
        _screen.activeform.obrowser.document.execCommand("Backcolor",.f.,m.xbackcolor)
        endi
        _screen.activeform.obrowser.document.getElementbyId("oDiv").focus()
    ENDPROC

    PROCEDURE command30.Init
        text to m.myvar noshow
        R0lGODlhFwAVAPcAAAAAAP////r6+u7u3e337Onp6fTU2OLK34YEhvz0/CQjJPDY8cK8xPTk/DQzNcy76uzk/M/I+7q0++Hf/AQE/AQEFDw9iXp76Jub9+zs/NTU3PT0/Ozs9OTk7K6usQ4PNWNm0srL5ElOudfZ+MjJ136FyAsahlhZYNvc5MzU/LW+5WFuod/k9HiEpj9BRxlZ9B1FpTJq9sTU/JSfupyeowRM9ARJ5ARDyxE6liRd2E9hiJmv4bi+zAxU7Bhc5x1UviVj5DRw6LfM+J+vznZ4fARa9gRU7ARU5CJq8zNt2Dx89HKg98PU9Mzd/ARk/ARc7Axc5BBp9Rhk5hMtVz2E9G2Y4Yak16fG+ARk9ARc5DOD+zdsvleDwrvV/ARs/ARs9ARm7A10/AtdzB56+E6S7jVKZuDs/AR0/DyU/DyM7MTT5WBkaQg7dBh86SyM/CRRhaS+3Ah77JXD8nycvMzU3MfIySyW+zCF0+Ps9FGWz8Pi/BOG4RhjnhCU7CmX4TSc5KjY+hF7wT6q63jB8a7R58/j8Fy26bfa7cLg79Lu/BWv8+n1+bvu/ILh+hvN9tTc3PT8/OTs7ODk5HqzpFKafpnNucvUzCBqKHe2esDywrTatp3Yn4u+jNDv0QiMBwQMBAwUDJbDltzl3NTd1PT89Oz07OTs5Ab8BEmmSDTULDuWODd9MySvE3Gkaoe2gJTEhH7UVJ7aguT03LHfmNLdzHHGKMvls+Ts3PT87Oz05B8qEvT85Ly9s/v4BwwMBPz83tzcxOzs1NPTw9zczOzs3OTk1Pz87PT05I+Ph9zc1NTUzPz89PT07Ozs5OTk3Pv3n+XkzK2sm/v3vPz5z/nqftKvDXNbEvbfmPfQXdzUvNzUxOzk1PTs3LSBI0A3Jq+QXtHCq+izbeTc0kQqDOiZRIhkOiwcDBwUDO7AkHRsZNzUzPz07PTs5PTMuORGIaMWCRQEBAwEBBoUFPzs7Pz09PTs7Ozk5Pz8/PT09Ozs7Nzc3NTU1E9PTwwMDAQEBP///ywAAAAAFwAVAAAIrQADCBxIsKDBgwgTKlzIUCChEg0PEiux4lDEgoS2rNgS7OLAEnO2WIBDzOOtFUxWvNHhMcAQLrfgvIEBxyMXFcQG6Hiz4qIQHSt0bNnJRk3Jhdy4cIHDFI4FNj0Z3tIRjJjVAS3YlDmqUKWOnAPmTCmjlSvCHTuGDFg7AO2QHQgNuJtLt65ddwbl3t07d5tBvnwNcCO4DfBeAwUNKF7MuLHig8G4RZ4sufJkggEBADs=
        endtext
        set safe off
        =strtofile(strconv(m.myvar,14),"Backcolor.gif")
        with this
        .picture="backcolor.gif"
        endwith
    ENDPROC

    PROCEDURE command37.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\find.bmp"
        endwith
    ENDPROC

    PROCEDURE command37.Click
        
        #define OLECMDID_FIND  32
        #define OLECMDEXECOPT_PROMPTUSER  1
        _screen.activeform.obrowser.execwb(OLECMDID_FIND,OLECMDID_FIND)
    ENDPROC

    PROCEDURE command28.Click
        _screen.activeform.obrowser.document.execCommand("indent")
    ENDPROC

    PROCEDURE command28.Init
        with this
        .picture="images\indent.bmp"   &&(to replace not created)
        endwith
    ENDPROC

    PROCEDURE command34.Click
        _screen.activeform.obrowser.document.execCommand("outdent")
    ENDPROC

    PROCEDURE command34.Init
        with this
        .picture="images\Unindent.bmp"  &&to replace (not created)
        endwith
    ENDPROC

    PROCEDURE command12.Click
        _screen.activeform.obrowser.document.execCommand("InsertImage",.t.)
    ENDPROC

    PROCEDURE command12.Init
        with this
        .picture=home(1)+"Graphics\Bitmaps\Outline\Nomask\bmp.bmp"
        endwith
    ENDPROC

    PROCEDURE command33.Click
        Local ze,ee
        Local Rows,cols,Table,tr,td,tbody
        rowstext = Inputbox("enter rows()","","2")
        colstext = Inputbox("enter cols()","","2")
        Rows = Val(rowstext)
        cols = Val(colstext)

        If Rows<=0 Or cols<=0
            Return .F.
        Endi


        ze=_Screen.ActiveForm.obrowser.Document
        Table = ze.createElement("table")
        Table.setAttribute("border", "1")
        Table.setAttribute("cellpadding", "2")
        Table.setAttribute("cellspacing", "2")

        tbody = ze.createElement("tbody")
        For i=1 To Rows
            tr =ze.createElement("tr")
            For j=1 To cols
                td =ze.createElement("td")
        *        br =ze .createElement("br")
        *        td.appendChild(br)
                tr.appendChild(td)
            Endfor
            tbody.appendChild(tr)
        Endfor
        tbody.appendChild(tr)
        Table.appendChild(tbody)

        ee=_Screen.ActiveForm.obrowser.Document.getElementbyId("oDiv")
        ee.appendChild(Table)
        retu
    ENDPROC

    PROCEDURE command33.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\VW-DTLS.bmp"
        endwith
    ENDPROC

    PROCEDURE command38.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\mapnet.bmp"
        endwith
    ENDPROC


    PROCEDURE command38.Click
        local yswf
        yswf=getfile('swf')
        if empty(m.yswf)
        return .f.
        endi
        yswf="file:///"+m.yswf


        text  to myvar textmerge noshow
        <object width='240' height='200'  >
        <param name='movie' value='<<yswf>> </param>
        <param name='allowFullScreen' Value='true'></param>
        <param name='allowscriptaccess' value='always'></param>
        <embed src='<<yswf>>' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='240' height='200'></embed>
        </object>
        endtext


        local ze,ole
        ze=_Screen.ActiveForm.obrowser.Document
        ole = ze.createElement("olecontrol")
        ole.innerhtml=m.myvar
        ee=ze.getElementbyId("oDiv")
        ee.appendChild(ole)
    ENDPROC

    PROCEDURE command39.Click
        local yvideo
        yvideo=getfile('avi;mpg;wmv;mp4')
        if empty(m.yvideo)
        return .f.
        endi
        yvideo="file:///"+m.yvideo

        text  to m.myvar textmerge noshow
        <p>
        <object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="WindowsMediaPlayer1" width="245" height="240">
          <param name="URL" value=" <<yvideo>> ">
          <param name="rate" value="1">
          <param name="balance" value="0">
          <param name="currentPosition" value="0">
          <param name="defaultFrame" value>
          <param name="playCount" value="1">
          <param name="autoStart" value="false">
          <param name="currentMarker" value="0">
          <param name="invokeURLs" value="-1">
          <param name="baseURL" value>
          <param name="volume" value="50">
          <param name="mute" value="0">
          <param name="uiMode" value="full">
          <param name="stretchToFit" value="0">
          <param name="windowlessVideo" value="0">
          <param name="enabled" value="-1">
          <param name="enableContextMenu" value="-1">
          <param name="fullScreen" value="0">
          <param name="SAMIStyle" value>
          <param name="SAMILang" value>
          <param name="SAMIFilename" value>
          <param name="captioningID" value>
          <param name="enableErrorDialogs" value="0">
          <param name="_cx" value="6482">
          <param name="_cy" value="6350">
        </object>
        </p>
        endtext


        local ze,ole
        ze=_Screen.ActiveForm.obrowser.Document
        ole = ze.createElement("olecontrol")
        ole.innerhtml=m.myvar

        ee=ze.getElementbyId("oDiv")
        ee.appendChild(ole)
        retu
    ENDPROC

    PROCEDURE command39.Init
        with this
        .picture=home(1)+"Graphics\Icons\Misc\camera.ico"
        endwith
    ENDPROC

    PROCEDURE command13.Click
        _screen.activeform.oBrowser.document.execCommand("Print",.t.)
    ENDPROC

    PROCEDURE command13.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\print.bmp"
        endwith
    ENDPROC

    PROCEDURE command14.Click
        *toggle vertical  -  horzontal mode
        *the writingMode property to toggle the alignment of the editable region
        *from vertical alignment to horizontal alignment.

        *messagebox(_screen.activeform.obrowser.document.getElementbyId("oDiv").style.writingmode)
        try
        if _screen.activeform.obrowser.document.getElementbyId("oDiv").style.writingmode=='tb-rl'
        _screen.activeform.obrowser.document.getElementbyId("oDiv").style.writingMode = 'lr-tb'
        else
        _screen.activeform.obrowser.document.getElementbyId("oDiv").style.writingMode = 'tb-rl'
        endi
        catch
        endtry
        retu
    ENDPROC

    PROCEDURE command17.Click
        _screen.activeform.obrowser.document.execCommand("SelectAll")
    ENDPROC

    PROCEDURE command22.Click
        _screen.activeform.obrowser.document.execCommand("UnSelect")
    ENDPROC

    PROCEDURE command19.Init
        with this
        .picture=home(1)+"Graphics\Bitmaps\Tlbr_w95\group.bmp"
        endwith
    ENDPROC

    PROCEDURE command19.Click
        _screen.activeform.obrowser.document.execCommand("InsertOrderedList")
        _screen.activeform.obrowser.document.GETElementbyID("oDiv").focus()
    ENDPROC


    PROCEDURE command20.Init
        with this
        .picture=home(1)+"Graphics\Bitmaps\Tlbr_w95\ungroup.bmp"
        endwith
    ENDPROC


    PROCEDURE command20.Click
        _screen.activeform.obrowser.document.execCommand("InsertUnOrderedList")
        _screen.activeform.obrowser.document.GETElementbyID("oDiv").focus()
    ENDPROC

    PROCEDURE command23.Click
        _screen.activeform.obrowser.document.execCommand("createlink")
    ENDPROC

    PROCEDURE command23.Init
        with this
        .picture=home(1)+"Graphics\Bitmaps\Tlbr_w95\mcr.bmp"
        endwith
    ENDPROC

    PROCEDURE command24.Click
        _screen.activeform.obrowser.document.execCommand("Unlink")
    ENDPROC

    PROCEDURE command24.Init
        with this
        .picture=home(1)+"Graphics\Bitmaps\Tlbr_w95\front.bmp"
        endwith
    ENDPROC

    PROCEDURE command26.Init
        with this
        .picture=home(1)+"Graphics\Bitmaps\Tlbr_w95\line.bmp"
        endwith
    ENDPROC

    PROCEDURE command26.Click
        _screen.activeform.obrowser.document.execCommand("InsertHorizontalRule")
    ENDPROC

    PROCEDURE combo1.Init
        WITH THIS
        for i=1 to 7
        .ADDITEM(trans(i))
        endfor
        .listindex=2
        .value=2
        .style=2
        endwith
    ENDPROC

    PROCEDURE combo1.Click
        _screen.activeform.obrowser.document.execCommand("FontSize",.f., this.value)     
        _screen.activeform.obrowser.document.getElementbyID("oDiv").focus()
    ENDPROC

    PROCEDURE command31.Click
        _screen.activeform.obrowser.document.execCommand("SuperScript")
    ENDPROC

    PROCEDURE command31.Init
        with this
        .picture="images\ui_superscript.gif"
        endwith
    ENDPROC

    PROCEDURE command32.Click
        _screen.activeform.obrowser.document.execCommand("SubScript")
    ENDPROC

    PROCEDURE command32.Init
        with this
        .picture="images\ui_subscript.gif"
        endwith
    ENDPROC

    PROCEDURE command41.Click
        _screen.activeform.obrowser.document.execCommand("InsertMarquee")
    ENDPROC


    PROCEDURE command41.Init
        with this
        .picture=home(1)+"Graphics\Bitmaps\Tlbr_w95\WORDUNDR.bmp"
        endwith
    ENDPROC

    PROCEDURE command42.Init
        with this
        .picture=home(1)+"Graphics\Bitmaps\Offctlbr\Small\Color\preview.bmp"
        endwith
    ENDPROC

    PROCEDURE command42.Click
        Local lcfilename
        lcfilename=Addbs(Sys(2023))+"tmp.hta"
        Set Safe Off
        TEXT to m.myvar noshow
        <html>
        <head>
        <title>This is a preview of yhtml_editor</title>
        <HTA:APPLICATION
             ID="yPreview"
             APPLICATIONNAME="This is a preview of yHtml_editor"
             SCROLL="auto"
             icon="ypreview.ico"
             SINGLEINSTANCE="yes"
           BORDER="thin"
             BORDERSTYLE="normal"
             CONTEXTMENU="no"
             CAPTION="yes"
           SHOWINTASKBAR="no"
           SYSMENU="yes"
           WINDOWSTATE="normal"
             align="center"
        >

        </head>
        <body   >
        <<_screen.activeform.obrowser.document.getElementbyId("oDiv").innerHTML>>
        </body>
        </html>
        ENDTEXT

        Strtofile(m.myvar,m.lcfilename)
        _Screen.ActiveForm.obrowser.Document.getElementbyId("oDiv").focus()
        Set Safe On


        *local o
        *o=newObject("hyperlink")
        *o.navigateto(m.lcfilename)

        Declare Integer ShellExecute In SHELL32.Dll Integer nWinHandle,;
            STRING cOperation,;
            STRING cFileName,;
            STRING cParameters,;
            STRING cDirectory,;
            INTEGER nShowWindow

        ShellExecute(0, "open", m.lcfilename,"","",1)
    ENDPROC


    PROCEDURE command40.Click
        if messagebox("This action clear all object from the canvas. confirm to do ?",4+64,"Clear canvas")=6
        _screen.activeform.obrowser.document.execCommand("Refresh")
        endi
    ENDPROC

    PROCEDURE command40.Init
        with this
        .picture=home(1)+"Graphics\Bitmaps\Offctlbr\Small\Color\paint.bmp"
        endwith
    ENDPROC

    PROCEDURE command18.Click
        _cliptext=_screen.activeform.obrowser.document.getElementbyId("oDiv").innerhtml
        messagebox("Html code is copied to the clipboard!",0+32+4096,"Copy code")
    ENDPROC

    PROCEDURE command18.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\camera.bmp"
        endwith
    ENDPROC

    PROCEDURE command15.Click
        loComDialog.ShowSave()
        if empty(loComDialog.FileName)
        return .f.
        endi
        if empty(justext(loComDialog.FileName))
        loComDialog.FileName=allt(loComDialog.FileName)+".html"
        endi
        set safe off
        strtofile(_screen.activeform.obrowser.document.getElementbyId("oDiv").innerHTML,loComDialog.FileName)
        _screen.activeform.obrowser.document.getElementbyId("oDiv").focus()
        set safe on
        retu
             
    ENDPROC

    PROCEDURE command15.Init
        with this
        .picture=home(1)+"graphics\bitmaps\tlbr_w95\save.bmp"
        endwith
    ENDPROC

    PROCEDURE command36.Init
        with this
        .picture="images\vista-116.ico"
        endwith
    ENDPROC

    PROCEDURE command36.Click
    local xcolor
        xcolor=getcolor()
        try
        _screen.activeform.backcolor=m.xcolor
        this.parent.backcolor=xcolor
        catch
        endtry
    ENDPROC

    PROCEDURE command43.Click
        set memowidth to 8192
        local lcfilename
        lcfilename=getfile("prg|txt|mpr")
        if empty(m.lcfilename)
        return .f.
        endi
        local ystr,x,cr
        cr=chr(13)+chr(10)
        ystr=filetostr(m.lcfilename)
        x=""
        for i=1 to memlines(ystr)
        x=x+[<tr><td bgcolor="#C0C0C0"><font color="#800080"><span style="background-color:#C0C0C0">]+trans(i,"999999")+[</span></font></td><td> <font color="#0000FF">]+mline(ystr,i)+[</font></td></tr>]+cr
        endfor

        local myvar
        text to m.myvar textmerge  noshow
        <html>
        <head>
        <title>preview code of : <<m.lcfilename>> --(<<memlines(m.ystr)>> lines). </title>
        <HTA:APPLICATION
             ID="ycodes"
             APPLICATIONNAME="ycode_preview"
             SCROLL="auto"
             icon="images/zoom.png"
             SINGLEINSTANCE="yes"
             BORDER="thin"
             BORDERSTYLE="normal"
             CONTEXTMENU="no"
             CAPTION="yes"
             SHOWINTASKBAR="no"
             SYSMENU="yes"
             WINDOWSTATE="normal"
        >
        </head>
        <body>
        <div align="left">
          <table border="0">
         <<x>>
        </table>
        </div>
        </body>
        </html>
        endtext

        set safe off  &&(scope) put this once in config.fpw and cut all in code
        local lcdest
        lcdest=addbs(sys(2023))+"hilight.hta"
        strtofile(m.myvar,m.lcdest)
        set safe on


        Declare Integer ShellExecute In SHELL32.Dll Integer nWinHandle,;
            STRING cOperation,;
            STRING cFileName,;
            STRING cParameters,;
            STRING cDirectory,;
            INTEGER nShowWindow

        ShellExecute(0, "open", m.lcDest,"","",1)
    ENDPROC

    PROCEDURE command43.Init
        with this
        .picture=home(1)+"Graphics\Bitmaps\Tlbr_w95\Prop.bmp"  &&"images/zoom.png"
        endwith
    ENDPROC

    PROCEDURE command29.Click
        local myvar
        text to myvar noshow
this is a Wysiwyg html editor drived  by automation from visual foxpro.
(what you see is what you get).
It use the vfp browser (Internet Explorer).(remember to Apply IE11 emulation for
another uses).
it encapsulates all rich text modalities and can open,modify and save a document
as a web page.
All functionalities are in the toolbar.(Can be extended to other functions).
I made images from whose shipped with vfp.Originally i have better ones.
I suggest you do the same thing.

Apply any toolbar action to the document selection.

To clean all the page issue F5 (warning : clear all objects on the page)
-make a proj, add config.fpw and raise an exe as application.

*!*--Author Yousfi Benameur El Bayadh Algeria
*!*--Time stamp vendredi 23 septembre 2011; 14:06:23
*!*--Subject :Visual foxpro Html editor
*!*--Version Vfp9Sp2    texted on  windows xp sp3 - win8.1
    endtext
        messagebox(m.myvar,0+32+4096,"About")
    ENDPROC

    PROCEDURE shape1.Click
        with this
        .width=sysmetric(1)/2
        .backcolor=this.parent.backcolor
        endwith
    ENDPROC


ENDDEFINE

*End code

 

A VFP Html  Richtext editor
A VFP Html  Richtext editor
To be informed of the latest articles, subscribe:
Comment on this post
E
Could you point the correct method where to code and how to declare this?<br /> I guess olecontrol1 in your reply means obrowser in the code, isn't it?
Reply
Y
in the toolbar can add a button or a menu option...<br /> and put this cod : <br /> local m.x as string<br /> m.x=inputbox("lineHeight:0.7,0.8,0.9,1,1.1,1.2","","0.8")<br /> if !inlist (m.x,"0.7","0.8","0.9","1","1.1","1.2")<br /> m.x="1"<br /> endi<br /> _screen.activeform.oBrowser.document.body.style.lineHeight=m.x
E
Hi Yousfi<br /> <br /> This functionality is very good and could fit my needs.<br /> But one thing is not working for me. The VFP interactive app runs OK but the EXE simply doesn't call the comdlg32.OCX - so nothing hapens.<br /> Any workaround?<br /> Thanks
Reply
Y
_screen.activeform.olecontrol1.document.body.style.lineHeight="0.7" ,"0.8","0.9","1","1.1","1.2".......<br /> or <br /> thisform.olecontrol1.document.body.style.lineHeight="0.7" ,"0.8","0.9","1","1.1","1.2".......
E
Hi Yousfi<br /> The previous problem was solved. Thank you.<br /> My question now is:<br /> How to reduce the space between lines?<br /> In my case 02 or more spacing lines when changing from a line to another.<br /> Any configuration?<br /> Thanks in advance!
Y
in my PC it works perfect(exe 64.1ko ).i build a project with the code shipped,add a config.fpw and compile (vfp9SP2).all is ok.<br /> this is maybe an issue of the ocx.Go to vfp menu/options/controls and add the rich32.ocx (in principe its automatically installed with vfp9).if not add the ocx here (its registered and ready to work).<br /> richtext (ocx and dlls) are in [c:\windows\system32 (32 bits)] or in [c:\windows\Syswow64 ( 64 bits)].
J
Hi Yousfi,<br /> <br /> I noticed that your codes are all blue. I know it is hard to adjust the syntax coloring inside our blogs so I just want to share you something that I do on my own blog.<br /> <br /> 1. I create the codes inside VFP, then beautify<br /> 2. I copy the entire codes and paste it on MSWord<br /> 3. I select all again inside Word and Copy<br /> 4. I paste those inside my blog<br /> <br /> Since MSWord has the capability to store HTML formats, then when we paste it over on our blogs, those HTML formats are retained. That is how I made my codes more readable preserving the syntax coloring as well as fonts. <br /> <br /> See this: http://sandstorm36.blogspot.com.au/2015/02/firefox-inside-vfp-form.html<br /> <br /> HTH!
Reply
Y
Hi Jun ! thanks for the idea i must reinstall word (i uninsntalled all office many years ago) and give it a try.<br /> Thank you and welcome !