I am trying to use this OLE for simple viewing some files, primarily text files, C++ header files, etc.
It works well, although the text appears to be unformatted in the window. The characters are just jammed, no paragraphs or indentations preserved. It may be fine with me for this task. My question is how to implement sting search in the control. Is it possible
If it is not possible, I can do it in the source file and take the coordinates but how to find this pixel in the Editor window
There are a number of methods I do not understand what they do. Not only in this control but in many others:
doVerb, contextMenuAction, activateApplets, displayChanged, execCommand, filterSourceCode, showContextMenu, and finally UIEnable.
if I could understand what they do I perhaps could use them for something. Now it is a totally opaque area for me.
Thanks.

DHTML Edit Control for IE5
rsa3des
StoneTheCrows_
I perhaps goofed up. Simple VFP Edit control can accomplish all those things, it seems. Now I cannot figure out how to bind a source to it:
THISFORM
.EDIT1.ControlSource = "C:\VCPlus_Projects\include\afx.h" - gives me an error.The error seems to say that this should be a "variable reference"
Thanks.
sumit malik
I assume that "afx.h" is a file...
If so, you first need to add a form property to hold the data (with the form open in design mode choose "New Property" from the "FORM" menu. Name it "sourcedata" (or something suitable).
Now in the Init() of your form you can do this:
*** Read the contents of the file to the form property
ThisForm.cData = FILETOSTR( "C:\VCPlus_Projects\include\afx.h" )
*** Bind the edit box to the property
ThisForm.Edit1.ControlSource = "(ThisForm.cData)"
The parentheses tell VFP to evaluate the expression! Of course ou could also pass the file name to the Init() of the form as a parameter or use code like this to pick it at run time:
LPARAMETERS tcFile
IF EMPTY( tcFile ) OR NOT FILE( tcFile )
tcFile = Getfile()
ENDIF
ThisForm.cData = FILETOSTR( "C:\VCPlus_Projects\include\afx.h" )
eigqsung
Thank you, Cetin for a comprehensive answer.
Happy New Year.
Dumdidum
Alex,
DHTML control is a little problematic. If you want to do something with it then read Rick's article on west-wind.com.
For your purpose VFP editbox control is just fine I think.
Public oForm
oForm = CreateObject('myEditor', "C:\VCPlus_Projects\include\afx.h")
oForm.Show
Define Class myEditor As Form
Height = 400
Width = 600
Add Object edtEditor As EditBox With ;
Left = 5,Top = 5, Height=350, Width=590
Add Object cmdSave As CommandButton With ;
Caption='Save', Left =5, Top=360
Procedure Init
Lparameters tcFileToEdit
* save filename to a property
This.AddProperty('_FileName', m.tcFileToEdit)
This.edtEditor.Value = Filetostr(m.tcFileToEdit)
Endproc
Procedure cmdSave.Click
* Save text in editbox to file
Strtofile(Thisform.edtEditor.Value, Thisform._FileName)
Endproc
Enddefine
I tried to cover this with your previous parameter passing question. Note that the form is a class here for the sake of posting sample in text. You might instead create this with form designer and call with:
do form myEditor.scx with "C:\VCPlus_Projects\include\afx.h"
2 add object commands in class adds an editbox and a commandbutton and sets their properties like left,top,caption which you'd normally do using the form controls toolbar and PEM sheet. Following code snippets are again which you'd write in designer. Notice that one of them is just "Procedure init" - it refers to class' init code in this case form's. Other is "Procedure cmdSave.Click" - it refers to command button's click (add object cmdSave ... - implicitly sets that object's name property to cmdSave, and I'm lazy to add name='cmdSave' when it does that already). Though it seems to be self explanatory I'm taking my time for you to understand mapping between designer and manual coding.
Next in init procedure we accept a parameter 'tcFileName'. In code normally we should include error checking code to test if really a filename is passed, file exist etc but for simplicity left them out. However if you create a generic class/form to do this don't forget to include those type of checking.
We immediately add a property to form to keep filename (AddProperty(...)). Remember we do that because tcFileName parameter is local to init method and no other method of the form has access to it. Since we need it later in cmdSave.Click saving it to a property.
Instead of ControlSource we use Value property. Upon code init FileToStr() reads file content as a string and assigns it to editbox's Value. Upon save editbox's Value is saved to file with StrToFile(). These 2 little functions can handle large files (according to documentation 16Mb but in practice more, I don't know the real limit) and perfectly fit for this job.
Now why Value and not ControlSource. ControlSource as you saw with error message are for variable references. A typical variable reference is a table field. ie: If you did it this way:
create cursor _temp (FileContent m)
insert into _temp (FileContent) values ;
( FileToStr("C:\VCPlus_Projects\include\afx.h") )
Then for editbox you'd use ControlSource:
thisform.edtEditor.ControlSource = "_temp.FileContent"
As you edit it'd be memo content changing. However what we have is a simple constant string instead and we use Value. In other words you need to set ControlSource when you need data binding.
Happy new year.