05-12-2006, 10:38 PM
See how dialog functions populate controls (DT_SetControls).
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
typelib DHTMLEDLib {683364A1-B37D-11D1-ADC5-006008A5848C} 1.0
;declare type and variable for "dialog scope" data
type DHTML_DIALOG_DATA VARIANT'doc add_more_members_here_if_you_need
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 383 335 "ed1"
;4 ActiveX 0x54000000 0x0 4 20 364 120 "DHTMLEDLib.DHTMLEdit"
;5 Button 0x54038040 0x0 22 4 12 13 "Italic"
;3 Button 0x54038040 0x0 8 4 12 13 "Bold"
;1 Button 0x54030001 0x4 274 156 48 14 "OK"
;2 Button 0x54030000 0x4 326 156 48 14 "Cancel"
;7 Button 0x54032000 0x0 248 4 48 14 "Save"
;9 ComboBox 0x54230243 0x0 40 4 28 213 "Textsize"
;END DIALOG
;DIALOG EDITOR: "" 0x2010804 "" ""
ret
;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
&d=+DT_GetParam(hDlg)
sel message
,case WM_INITDIALOG
,DHTMLEDLib.DHTMLEdit dh4._getcontrol(id(4 hDlg))
,dh4.LoadDocument(d.doc)
,dh4._setevents("dh4__DHTMLEditEvents")
,str icl="$my qm$\icons\editor\editor.icl"
,SendMessage(id(3 hDlg) BM_SETIMAGE IMAGE_ICON GetFileIcon(icl 0 0))
,SendMessage(id(5 hDlg) BM_SETIMAGE IMAGE_ICON GetFileIcon(icl 1 0))
,ret 1
,case WM_DESTROY
,,DT_DeleteData(hDlg)
,,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_DROPDOWN<<16|9
,TO_CBFill(lParam "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 .
,
,case CBN_SELENDOK<<16|9
,,fz=CB_SelectedItem(lParam)
,,option=DECMD_SETFONTSIZE
,,dh4.ExecCommand(option 0 fz)
,case 5
,,option=DECMD_ITALIC
,,dh4.ExecCommand(option 0)
,case 3
,,option=DECMD_BOLD
,,dh4.ExecCommand(option 0)
,case 7
,,str s=dh4.DocumentHTML()
,,mes s
,,;dh4.SaveDocument(d.doc) ;;this works, but DocumentHTML gives E_NOINTERFACE error
,,
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
;err+ out _error.description