Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Begin: ActiveX-TreeView-MScomctl.ocx

Status
Not open for further replies.

xBaseDude

MIS
Jan 31, 2002
357
US
This is my first attempt at using ActiveX and adding a OLE object to my form.

I am attempting to generate something similiar to the FILER.FLL that will be distributable in a stand alone exe.

I'd like to do this behind the scenes and load a cursor.
I can take it from there, but I do head help in working with the MScomctl.ocx and the OLE object construction.

Per the VFP60 HelpFile....
"ActiveX controls are added to a form in an application by using the Visual FoxPro OLE container control."

Fair enough...however I have *nothing* in my Forms Toolbar for a "OLE container control"

I have 3 items that maybe the key....
1.)ActiveX Control(OLE Control)
2.)ActiveX Bound Control(OLE Bound Control)
3.)Container

I thought I had to put (3) Container on the form then drop
(1)ActiveX Control on top of the container...

That did not seem to work...
And produced this err msg when clicked on....

"PKGB050.OCX err msg This file does not have a programs associated with it for performing this action. Create an association in My Computer by clicking View and then clicking Folder Options."

Could I impose on someone to walk me thru this basic lesson.

TIA - Wayne
 
Wayne

1. Go to (in the menu) Tools->Options->Controls and find the Activex you want to use, and click in the checkbox on the left and save as default. Let's assume you picked Microsoft Common Dialog control.

2. Create a new form and in the Form Control Toolbar, at the top (next to the arrow pointer ), thee is a button with books on it (View Classes), click and switch to Activex. Now you see your Microsoft Common Dialog Activex.

3. Drag it to your form. This Activex (as are some others) is a non-visual activex, so it doesn't matter where you put it on the form.

4. On your form create 5 commandbuttons (by switching back on your Form's control toolbar to standard). (The sixth one is for help files)

5. In the different command buttons put respectively:
thisform.olecontrol1.showColor()
thisform.olecontrol1.showFont()
thisform.olecontrol1.showOpen()
thisform.olecontrol1.showPrinter()
thisform.olecontrol1.showSave()

6. Run your form and see what happens

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
for addictional help with these controls.

do a search on your system for cmctl*.chm. these are help files to discribe the methods and properties of some controls.

another methodto help. look at faq184-2215. load the ocx into the browser, select it. now you can view all methods and properties. Attitude is Everything
 
Gentlemen...thank-you for taking the time to reply.

Mike;
I followed your coding example, and everything worked fine.

Danceman;
Thanx for the references to the help files.

Mike, following your initial example, I then tried moving forward by adding the MScomctl.ocx. 2 *new* entries appeared in the drop down Microsoft TreeView, version 6.0 and Microsoft TreeView, version 5.0 (SP2). I selected the 6.0 option and set it to default.

I then created a new form, and was able to drop this ActiveX object onto my form. It appeared as a white box.

Following danceman's suggestion to look at the help files for props of this object, I came across some code that I tried to implement under the click event of a cmdbut. It didn't look like fox code and crashed when I clicked. ie....

Private Sub TreeView1_Expand(ByVal Node As Node)
Select Case Node.Key Like "C*"
Case Is = True
MsgBox Node.Text & " is a child node."
End Select
End Sub

I tried mimicing your coding and example and tried this (in the click event)

thisform.olecontrol1.Style = 0
thisform.olecontrol1.PathSeparator = "\."
thisform.olecontrol1.Sorted = True

Nothing happened but the Fox err msg complaining about "thisform.olecontrol1.Sorted = True" as "True" = ng (no good)

Where do I go from here?

Regards - Wayne
 
xBaseDude

To facilitate your quest on making Treeview work for you, here are two demos on Treeview for you.


These are direct downloads.

You will most likely have to add the ImageList Activex also, since that is what builds your list in the treeview.


P.S. Did you get an explanation from David regarding your lost post of yesterday? Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Mike;

I have dl the zip files that you referenced. Thank-you for the link.

After viewing the files, and taken a cursory view of how they worked, I must ask myself if I am going down the right path with the TreeView solution.

Since my goal is to scan a hard drive, collect all the Directory Names, and Sub Directory Names and stuff them in a cursor, I gotta ask is TreeView the right ActiveX component for me to be looking at?

I am looking to do this programatically, without having the user have to click on an image to expand/contract - plus/minus a TreeView.
iow...User selects a valid drive from a dropdown, and *bam* all the Directory names end-up in the cursor for me to begin processing on.

Sorry if my inexperience has caused you to advise me to go one way, when the reality is I need to go the other way.

Should I be looking at another activex object? My goal is to mimic the foxpro filer object for a distributed app. Although at this point in time I'm thinking renaming the FILER.FLL to BUBBA.DLL and hoping MS never catches me, might be a viable solution too [g].

Regards - Wayne
 
xBasedude

It sounds like it should be a treeview. Do you have trouble with the Treeview or you just don't like it.
But I took a look at FoxPro Filer, and to me it does nothing like what you want, or I'm I wrong.
You seem to want a listing of all directories (and subdirectories) in to an Array or a cursor and display it somehow to the user so he can select a particular directory (to save a file I assume). Is that what you are looking for?

BTW Here is a quote from MSDN Help for VFP7.0:
You can distribute Filer.dll and its companion files, filer.ico, filer.scx, and filer.sct, with your distributed Visual FoxPro runtime applications.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
xBasedude

if the help file is where you got the code, above. that is visual basic. most examples in help files for controls and dll's are in visual basic. you need to chage to suit. look at the examples mike pointed at. Attitude is Everything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top