Page 1 of 1

How to attach a datablock to DCACTIVEXCONTROL

Posted: Thu Nov 08, 2012 10:31 am
by jdsoft
Hello,

I am experimenting with a active X Html editor from nBit (http://nbit.net.au/).
I want this to use this for memo-edit.
A regular field edit of my database looks like

Code: Select all

@  1 ,1      DCMULTILINE  oDb:memo SIZE 94,7 
The memo field is linked to the DCMULTILINE . (oDb:memo)
When skipping thru the database, it looks like:

Code: Select all

oDb:DbSkip()
Dc_GetRefresh(GetList)
How can i get a link to a database field in a DCACTIVEXCONTROL ?
There is a property oHtml:DocumentHTML that contains the HTML form.

Code: Select all

@ nLine  ,  1        DCACTIVEXCONTROL oHtml SIZE 120,15 CLSID "rmpHTML.HTMLed" 
I tryed the folowing code, but that obviously does not compile.

Code: Select all

@ nLine  ,  1        DCACTIVEXCONTROL oHtml SIZE 120,15 CLSID "rmpHTML.HTMLed" DATA oDb:Memo DATABLOCK  {|c|iif(ValType(c) = "C",oHtml:DocumentHTML := c,nil),oHtml:DocumentHTML}
I also tryed to subclass, and created GetData-and SetData methods. But i need pushbuttons to activate them.

Code: Select all

@ nLine  ,  1        DCACTIVEXCONTROL oHtml SIZE 120,15 CLSID "rmpHTML.HTMLed" SUBCLASS "MyDCHtmlEdit"  

CLASS MyDCHtmlEdit FROM Dc_XbpActiveXControl
EXPORTED:
METHOD      Create
METHOD      Destroy
METHOD      GetData
METHOD      SetData
ENDCLASS

Method MyDCHtmlEdit:create(oParent,oOwner,aPos,aSize,aPresParam,lVisible)
::Dc_XbpActiveXControl:Create(oParent,oOwner,aPos,aSize,aPresParam,lVisible)
::AlwaysConvertUnicodeCharacters    := TRUE
::ActiveXObject:EditorEnabled       := TRUE
::ActiveXObject:hiddenButtons       := "Spell Check;Image;RemoteImage;Print;Toggle;Table"
Return Self

Method MyDCHtmlEdit:Destroy()
::Dc_XbpActiveXControl:Destroy()
Return SELF

Method MyDCHtmlEdit:GetData(oDb)
::DocumentHTML := oDb:Memo
Return

Method MyDCHtmlEdit:SetData(oDb)
oDb:Memo   := ::DocumentHTML
Return
Suggestions are welcome.
Regards,
Jack Duijf

Re: How to attach a datablock to DCACTIVEXCONTROL

Posted: Thu Nov 08, 2012 11:15 am
by rdonnay
Jack -

It looks like you are on the right track here.
Possibly you have your :setData() and :getData() methods reversed.

I would like to experiment with this control myself.
How do I get a trial version?

Roger

Re: How to attach a datablock to DCACTIVEXCONTROL

Posted: Thu Nov 08, 2012 1:14 pm
by jdsoft
Hello Roger,

Please tel me how to create a datalink to a activexcontrol.

You can download a demo from http://nbit.net.au.
Attached also the code i use to create this window.
sample.jpg
sample.jpg (46.17 KiB) Viewed 13378 times
Jack

Re: How to attach a datablock to DCACTIVEXCONTROL

Posted: Thu Nov 08, 2012 1:21 pm
by jdsoft
OOPS!!

A error in the sourcecode main.prg

Code: Select all

@ nLine  ,  1        DCACTIVEXCONTROL oHtml SIZE 120,15 CLSID "rmpHTML.HTMLed" SUBCLASS "DCHtmlEdit"  WHEN {||oHtml:EditorEnabled := lEdit} DATA {|c|iif(ValType(c) = "C",oHtml:DocumentHTML := c,nil),oHtml:DocumentHTML}
Should be

Code: Select all

@ nLine  ,  1        DCACTIVEXCONTROL oHtml SIZE 120,15 CLSID "rmpHTML.HTMLed" SUBCLASS "DCHtmlEdit"  WHEN {||oHtml:EditorEnabled := lEdit} 
Jack

Re: How to attach a datablock to DCACTIVEXCONTROL

Posted: Tue Nov 13, 2012 6:40 am
by rdonnay
I tried to install the HtmlEdit OCX and it wants to overwrite c:\windows\system32\richtx32.ocx.

Is this supposed to be an improved RTF control for Windows?
I am always suspicious of software that overwrites Windows components.

Re: How to attach a datablock to DCACTIVEXCONTROL

Posted: Tue Nov 13, 2012 6:50 am
by rdonnay
Even though I chose to not have the install program overwrite richtx32.ocx, the test program appears to work. However, it doesn't have any of the methods you discuss in your posting.
Before I go any further with this we need to have another Skype discussion.

Re: How to attach a datablock to DCACTIVEXCONTROL

Posted: Tue Nov 13, 2012 6:58 pm
by Auge_Ohr
hi,

while you talk about "oHtml:DocumentHTML" ... is there a "o:navigate" Method ?

Re: How to attach a datablock to DCACTIVEXCONTROL

Posted: Wed Nov 14, 2012 12:13 pm
by skiman
Hi,

There is a html editor available with standard xbase++.

Code: Select all

*     PROYECTO: HTMLEditor                       *
*  Programador: J.A. Diego Kerejeta              *
*       Creado: 14-03-2011                       *
It is available on the xbase++ newsgroup.

Re: How to attach a datablock to DCACTIVEXCONTROL

Posted: Sun Nov 18, 2012 6:23 am
by unixkd
If you need only simple editor, the RICHTX32.OCX is sufficient. Most of those functionalities such as spellcheck, and FTP can be added to it. FTP functionalities are available in xb2.net and spellcheck sample of express++ can be adapted accordingly. I did something like that, as shown below:
RTF.JPG
RTF.JPG (116.51 KiB) Viewed 13248 times