Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Variant
#1
is there a trick to use a value without declaring a Variant when
is needed ?

Code:
Copy      Help
,,VARIANT fz="6"
,,ed.ExecCommand(5045 0 fz)

so i that i can directly use
Code:
Copy      Help
ed.ExecCommand(5045 0 6)

?
pi
#2
If argument is by reference (with &, like VARIANT&v), then you must declare and pass VARIANT variable. Unlike in VB, QM does not create a hidden variable for the value.
#3
simple question:

how do i populate a combo insite a dialog function and also set a start value ? (SETFONTSIZE 3)

when using
Code:
Copy      Help
\Dialog_Editor
instead of
macro xyz
Code:
Copy      Help
spe -1
str controls = "9"
str cb9Tex="1[]2[]3[]4[]5[]6"
if(!ShowDialog("dhtml" &dhtml &controls)) ret

Code:
Copy      Help
;\Dialog_Editor
***
replace the path in VARIANT doc for testing and the icon path
***
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
typelib DHTMLEDLib {683364A1-B37D-11D1-ADC5-006008A5848C} 1.0
VARIANT option
VARIANT doc="C:\apache2triad\htdocs\emis\varpass.htm"


if(hDlg) goto messages
if(!ShowDialog("dhtml" &dhtml)) 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
sel message
,case WM_INITDIALOG DT_Init(hDlg lParam)
,DHTMLEDLib.DHTMLEdit dh4._getcontrol(id(4 hDlg))
,DHTMLEDLib.DHTMLEdit ed._getcontrol(id(4 hDlg))
,dh4.LoadDocument(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
ed._getcontrol(id(4 hDlg))
VARIANT fz
sel wParam
,case CBN_SELENDOK<<16|9
,,_i=CB_SelectedItem(lParam)
,,option=DECMD_SETFONTSIZE
,,fz=_i
,,ed.ExecCommand(5045 0 fz)
,case 5
,,option=DECMD_ITALIC
,,ed.ExecCommand(option 0)
,case 3
,,option=DECMD_BOLD
,,ed.ExecCommand(option 0)
,case 7
,,str s=ed.DocumentHTML()
,,mes s
,,
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1

i am also glad when you have optimizing tips.
thanks
pi
#4
See how dialog functions populate controls (DT_SetControls).

Code:
Copy      Help
\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
#5
QM only minimally supports graphical ActiveX controls. For example Delete key does not work, does not show context menu, and probably more features are missing.
#6
i guess context menu can be replaced with a qm menu ?
pi
#7
what do you mean by
Code:
Copy      Help
;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 .
?

call function myfill ?
pi
#8
Functions from the System folder that are not shown in the main list are private. They may be modified, renamed or deleted in the future. But you can use code from such a function. For example, copy TO_CBFill to My_CBFill.
#9
_pi Wrote:i guess context menu can be replaced with a qm menu ?

Maybe, not sure.
#10
for context menu i have a handler, even when content changes.

dh4__DHTMLEditEvents
..dh4_ShowContextMenu

working with DHTMLEDLib.DHTMLEdit is still a miracle for me ...

as i wrote in another thread i have a toolbar with 8 text areas,
currently i load 8 html pages with 8 js html editors.
this is an overkill, so it would be better to have those function
completely made in qm.
pi


Forum Jump:


Users browsing this thread: 1 Guest(s)