How to attach a datablock to DCACTIVEXCONTROL

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
jdsoft
Posts: 113
Joined: Thu Jan 28, 2010 1:13 pm
Location: Overberg
Contact:

How to attach a datablock to DCACTIVEXCONTROL

#1 Post 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
Regards,
Jack Duijf

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: How to attach a datablock to DCACTIVEXCONTROL

#2 Post 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
The eXpress train is coming - and it has more cars.

User avatar
jdsoft
Posts: 113
Joined: Thu Jan 28, 2010 1:13 pm
Location: Overberg
Contact:

Re: How to attach a datablock to DCACTIVEXCONTROL

#3 Post 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 12335 times
Jack
Attachments
HtmlEdit.zip
Source code to create this window.
(2.02 KiB) Downloaded 655 times
Regards,
Jack Duijf

User avatar
jdsoft
Posts: 113
Joined: Thu Jan 28, 2010 1:13 pm
Location: Overberg
Contact:

Re: How to attach a datablock to DCACTIVEXCONTROL

#4 Post 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
Regards,
Jack Duijf

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: How to attach a datablock to DCACTIVEXCONTROL

#5 Post 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.
The eXpress train is coming - and it has more cars.

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: How to attach a datablock to DCACTIVEXCONTROL

#6 Post 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.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: How to attach a datablock to DCACTIVEXCONTROL

#7 Post by Auge_Ohr »

hi,

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

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: How to attach a datablock to DCACTIVEXCONTROL

#8 Post 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.
Best regards,

Chris.
www.aboservice.be

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: How to attach a datablock to DCACTIVEXCONTROL

#9 Post 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 12205 times

Post Reply