05-17-2006, 07:24 PM
i am trying to get the current selection, in the triedit documentation they say:
when i control click on dh4.DOM i get
.
but where and how do i access DOM.selection ?
thanks
Private Sub GetElementUnderInsertionPoint()
Dim rg As IHTMLTxtRange
Dim ctlRg As IHTMLControlRange
Select Case DHTMLEdit1.DOM.selection.Type
Case "None", "Text"
' This reduces the selection to just the insertion
' point. The parentElement method will then return the
' element directly under the mouse pointer.
Set rg = DHTMLEdit1.DOM.selection.createRange
rg.collapse
MsgBox rg.parentElement.outerHTML
Case "Control"
' A form or image is selected. The commonParentElement
' will return the site selected element.
Set ctlRg = DHTMLEdit1.DOM.selection.createRange
MsgBox ctlRg.commonParentElement.outerHTML
End Select
End Sub
when i control click on dh4.DOM i get
.
but where and how do i access DOM.selection ?
thanks