Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dhtml editor
#11
i was too quick on your sel answer.

i get error:
Error in dhtml: expected IHTMLDocument2
tip: to cast type (query interface), use operator +.

can you take a look on my code please ?
button sel (case 5) is the dummy for the code.

the icl is here

function dhtml

Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
;str template.getmacro("dhtml_template")
str template=
;<html>
;<style type="text/css">
;BODY {
;background: #ffffff;
;color: #000000;
;margin: 0px 0px 0px 0px;
;font-family: Arial, Helvetica, sans-serif;
;font-size: 12px;
;color:#666666;
;width: 640px;
;overflow: auto;
;}
;</style>
;<body>
;This is a test
;</body>
;</html>

if(hDlg) goto messages

typelib DHTMLEDLib {683364A1-B37D-11D1-ADC5-006008A5848C} 1.0
type TBBUTTON iBitmap idCommand !fsState !fsStyle !bReserved[2] dwData iString

;declare type and variable for "dialog scope" data
type DHTML_DIALOG_DATA VARIANT'doc txt

DHTML_DIALOG_DATA _d
DHTML_DIALOG_DATA& d=_d
;d.doc="C:\apache2triad\htdocs\emis\varpass.htm"
;d.doc=_s.expandpath("$desktop$\index.html")


if(!ShowDialog("dhtml" &dhtml 0 0 0 0 0 &d)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 370 167 "QM DHTML Editor"
;5 Button 0x54032000 0x0 170 0 48 14 "sel"
;3 Static 0x54000000 0x0 70 3 16 10 "Size"
;9 ComboBox 0x54230243 0x0 88 1 28 213 "Textsize"
;6 ToolbarWindow32 0x5400000D 0x0 2 0 364 14 ""
;4 ActiveX 0x54000000 0x10 2 14 364 148 "DHTMLEDLib.DHTMLEdit"
;END DIALOG
;DIALOG EDITOR: "" 0x2010804 "" ""


ret
;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
&d=+DT_GetParam(hDlg)
sel message
,case WM_INITDIALOG
,int-- hicon
,hicon=GetIcon("qm_red.ico")
,SendMessage hDlg WM_SETICON 0 hicon
,DHTMLEDLib.DHTMLEdit dh4._getcontrol(id(4 hDlg))
,;dh4.LoadDocument(d.doc)
,dh4.DocumentHTML=template
,dh4.AbsoluteDropMode=1

,;dh4._setevents("dh4__DHTMLEditEvents")
,int styles=WINAPI.TBSTYLE_FLAT
,str icl="editor.icl";str icons labels;_i=0
,rep 3
,,labels.formata("[]")
,,icons.formata("%s,%i[]" icl _i)
,,_i+1
,DT_TbAddButtons id(6 hDlg) 1001 labels icons styles|WINAPI.TBSTYLE_LIST 1
,TO_CBFill(id(9 hDlg) "1[]&2[]3[]4[]5[]6") ;;tip: make copy of this function, as well as for any other function that is not shown in the main popup list when you press .

,ret 1
,case WM_DESTROY
,,DT_DeleteData(hDlg)
,,DestroyIcon hicon
,,DestroyIcon(SendMessage(id(3 hDlg) BM_GETIMAGE IMAGE_ICON 0))
,,DestroyIcon(SendMessage(id(5 hDlg) BM_GETIMAGE IMAGE_ICON 0))
,case WM_COMMAND goto messages2
ret
;messages2
dh4._getcontrol(id(4 hDlg))
VARIANT fz option
sel wParam
,case CBN_SELENDOK<<16|9
,,fz=CB_SelectedItem(lParam)
,,option=DECMD_SETFONTSIZE
,,dh4.ExecCommand(option 0 fz)
,case 1001
,,option=DECMD_BOLD
,,dh4.ExecCommand(option 0)
,case 1002
,,option=DECMD_ITALIC
,,dh4.ExecCommand(option 0)
,case 1003
,,option=DECMD_UNDERLINE
,,dh4.ExecCommand(option 0)
,case 1004
,,option=DECMD_HYPERLINK
,,dh4.ExecCommand(option 0)    

,case 5
,,;MSHTML.IHTMLDocument2 doc=dh4.DOM
,,;sel(doc.selection.type)

,,
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1

;err+ out _error.description
pi


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)