Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataObject.SetData() in an Activex control
Message
De
31/03/2007 13:39:36
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
29/03/2007 15:57:22
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01210037
Message ID:
01210802
Vues:
20
This message has been marked as the solution to the initial question of the thread.
Finally solved! The dataobject was VB data object and setting data to HTML format was a pain once you get to point and remember to VB short is integer and integer is long.
*** ActiveX Control Event ***
LPARAMETERS data, allowedeffects
LOCAL lnFormat,lcFragment,lcBytes
*Declare integer RegisterClipboardFormat in "user32" string lpString
lnFormat = RegisterClipboardFormat('HTML format')
IF m.lnFormat > 32767
  lnFormat = m.lnFormat - 65536 && I didn't expected problem be here. grrrr
ENDIF
allowedeffects = 1
m.lcFragment =  this.parent.oDataFormatter(this.SelectedNode.Key) && prepares HTML fragment for clipboard

LOCAL loStream as 'adodb.stream'
loStream = CREATEOBJECT( 'adodb.stream' )
loStream.Open()
loStream.Charset = 'ascii'
loStream.WriteText( m.lcFragment )
loStream.Position = 0
loStream.Type = 1  && adTypeBinary
lcBytes = loStream.Read()
loStream.Close()

data.clear
data.SetData(m.lcBytes , m.lnFormat)
Cetin

>I have a treeview and DHtmlEdit control on a form. I want to provide drag&drop from TV to DHTML. However in OleStartDrag I need to set both the data and format. It looks like:
>
>
>lparameters data, allowedeffects
>text to m.lcHTMLFragment noshow
><b>some html</b>
>endtext
>
>lcHTML = thisform.PrepareHtml(m.lcHTMLFragment)
>* this returns text adding necessary fragment info like "StartHTMLFragment:offset ..."
>
>data.SetData( m.lcHTML, "HTML Format" )
>
>This errors out (I don't remember the exact error message a different one with different trials).
>
>If I do the same with a native VFP object.OleStartDrag (say textbox.OleStartDrag) it works just as I want and HTML is pasted to DHTML.
>
>If I don't use Setdata() to change format to "HTML Format" (CF_HTML). Then DHTML gets the full HTML with tags in it (it doesn't render). ie:
>< b >this is bold< /b >
>vs:
>this is bold
>
>As a workaround, instead I am using RegisterClipboardFormat,OpenClipboard ... SetClipboardData etc winAPI. Another approach I use is to directly change the document HTML via its DOM.
>With both of these approaches I somewhat have what I want but would like to set dataobject instead.
>
>TV doesn't have an OleStartDrag event in its documentation and I initially thought it should be coming from VFP. However the dataobject (data) doesn't look like to the VFP's DataObject. ie: It doesn't have a SetFormat method. (If I could cast it to VFP's DataObject somehow my problems would end I think).
>Any ideas?
>TIA
>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform