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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listview Active X Control, no thumbnails

Status
Not open for further replies.

trevr1

Programmer
Feb 4, 2003
23
US
Hello,

I have Fox 7.0 and dropped the listview control on my form and noticed the views does not contain thumbnails. Does anybody know how to add this or know a new control I can get my hands on. I need to see thumbnail images inside of a active x web browser control.

Thanks in advance.

Trevr
 
Trevr,

When you say 'thumbnails' , I assume you mean icons. If so, I could explain how to make them visible, but it would be very much easier if you glance at my article, "Taming the Microsoft ListView control", which is at:


If you still need help, come back.

Mike


Mike Lewis
Edinburgh, Scotland
 
Thanks Mike for your help.

I'm making a program to help my family members organize their digital photos. On the form, I dropped in the web browser active x control and combo box which is bound to it from a sample form from VFP 7 (...\Samples\Solution\Ffc\webvwr.scx). When you run the form, you can type in file//c:/myphotos in the combo box and your files from this folder are displayed in the web browser control. Now I can right click inside the web browser and change the view to list, details, thumbnails, etc. I need thumbnails so I can see all my pictures. Icons won't display my pictures. I know the thumbnails option won't be available to all Operating Sys., but I'm not worried about that.

Is there a way to have the program display thumbnails right from the start?

If not, is there a way to add a listview command that will allow the user to change the view from a button (like in windows explorer) to thumbnails without right clicking inside of the web browser control?

I would appreciate any ideas you may have.



 
Trevr,

Sounds like a nice little application.

Now I understand what you mean by thumbnail. You mean the small picture that appears in the left margin of the page when it is viewed "as web page". I was thinking you meant the small pictures that appear in small icon, large icon, etc. views.

Unfortunately, neither the native ListView nor my SimpleList control support that. However, I think it would be easy to simulate. Just add an image control to the overall form. When an image file is selected in the list view, change the Picture property of that control to match the selected file name. In SimpleList, you could do that in the InteractiveChange event -- just a couple of lines of code.

Mike


Mike Lewis
Edinburgh, Scotland
 
trevr1

You could also display the thumbnails using an Image control in a grid which would simulate the Kodak Imaging application.

By clicking on the grid, the image would be selected and displayed in a separate image control on the form as large as necessary.

FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Thanks guys for all your help. I appreciate it. Unfortunately I'm going to keep going with what I have. If you try to load images in a grid, it takes too long because of fox resizing each picture. When pictures are displayed as thumbnails inside a web browser, they pop up almost instantly because of the browser retreiving the exif info. The only downfall is my family members will have to right click in the web browser control everytime to change the view to thumbnails.

Thanks again for your help,

Trevr
 
Trevr,

. If you try to load images in a grid, it takes too long because of fox resizing each picture.

I didn't say anything about loading a picture in a grid. My suggestion was to put it straight on the form, and to change the Picture property as the user scrolls through the listview. I think you'll find that pretty fast.

Mike


Mike Lewis
Edinburgh, Scotland
 
Trevr

'If you try to load images in a grid, it takes too long because of fox resizing each picture.'

The .DynamicCurrentControl property of a column in a grid can call an object method which will set the .Picture property of the .Image control to a field in a table containing the path\filename.ext of a graphics file.

The important thing to remember about the .DynamicCurrentControl property of a grid column that only the visible images in a grid are rendered - so if all you can see is 10 images at any one time, that's all VFP is going to render.

If you use .ControlSource for the images and you have 10,000 images in your table, VFP will render all 10,000! [dazed]

So, if you combine additional size for size images as thumbnails together with the .DynamicCurrentControl property of a grid column calling an object method as described, you will find you have a thumbnail browser with an acceptable performance.


FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
I just popped in on this thread a little while ago, and I must say it took me a second or two to visualize the problem and the proposed solutions. Here is my first attempt (I still have to figure out how to bring back the selected file's path). It uses Drag-N-Drop from the thumbnails to an image control on the right. If you Drag multiple picture files over it will do kind of a slide show with a 4 seconds pause between them. It still needs some work, but good enough for a post I thought. Cut-n-paste the code below into a prg file and run from within VFP.

Code:
PUBLIC oForm
oForm = CREATEOBJECT("clsThumbnails")
oForm.show()

DEFINE CLASS clsthumbnails AS form
	Top = 0
	Left = 0
	Height = 455
	Width = 756
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"

	ADD OBJECT olecontrol1 AS olecontrol WITH ;
		Top = 12, ;
		Left = 12, ;
		Height = 432, ;
		Width = 120, ;
		Visible = .T., ;
		Enabled = .T., ;
		Name = "Olecontrol1", ;
		OleClass = "Shell.Explorer.2"

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 12, ;
		Left = 648, ;
		Height = 23, ;
		Width = 84, ;
		Caption = "Go", ;
		Name = "Command1"

	ADD OBJECT edit1 AS editbox WITH ;
		Height = 24, ;
		Left = 144, ;
		Top = 12, ;
		Width = 492, ;
		Name = "Edit1"

	ADD OBJECT image1 AS image WITH ;
		OLEDropMode = 1, ;
		Height = 396, ;
		Left = 144, ;
		Top = 48, ;
		Width = 588, ;
		Name = "Image1"

	PROCEDURE olecontrol1.Refresh
		NODEFAULT
	ENDPROC

	PROCEDURE command1.Click
		IF DIRECTORY(thisform.edit1.value)
			thisform.olecontrol1.navigate(thisform.edit1.value)
		ELSE
			MESSAGEBOX("Please enter the path to the directory in which your pictures reside.",16,"INVALID ENTRY")
			thisform.edit1.setfocus()
		ENDIF
	ENDPROC

	PROCEDURE edit1.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		IF nKeyCode = 13
			thisform.command1.Click()
		ENDIF
	ENDPROC

	PROCEDURE image1.OLEDragDrop
		Lparameters oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord

		Local cfilename, afiles[ 1 ]
		If oDataObject.GetFormat( 15 )
			oDataObject.GetData( 15, @afiles )
			For Each cfilename In afiles
				Thisform.image1.Picture = cfilename
				=INKEY(4) &&View each picture dragged over for 4 seconds
			Next
		Endif
	ENDPROC

	PROCEDURE image1.OLEDragOver
		LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState
		DO CASE
		CASE nstate = 0 && Drag Enter
		   IF odataobject.GETFORMAT(15)
		         THIS.OLEDROPHASDATA = 1
		         THIS.OLEDROPEFFECTS = 4
		         neffect = 4
		      ENDIF
		   CASE nstate = 1 && DRAG_LEAVE
		   
		   CASE nstate = 2 && DRAG_OVER
		ENDCASE
	ENDPROC

ENDDEFINE

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Given my code above does anyone know how to get the name of the image file(s) selected in the webbrowser control on the left?

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
slighthaze

In a suitable .OleDragDrop() event put :-

CREA CURS TABLENAME (filename C(254))

IF ALEN(aFiles) > 0
[tab]ASORT(aFiles)
[tab]FOR i = 1 to ALEN(aFiles)
[tab][tab]INSERT INTO TABLENAME (filename) VALUES (UPPE(SUBS(aFiles(i),1,1)) ;
[tab][tab][tab]+ LOWE(SUBS(aFiles(i),2)))
[tab]ENDF
ENDI


FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Chris,

I've already got drag and drop code in the code I posted above. That's not my problem. The problem is that i can't find what files are selected in the Webbrowser control. Let's say the user just clicks and highlights one of the files in the webbrowser control...how in code do I find out what the name of the selected file is? Maybe I am missing something in your proposed solution (I seem to do that a lot with you) and it applies to this somehow?

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
slighthaze

I misunderstood what you were after - I read it that you needed to know what files had been dropped onto the control which is what the code posted does.

Unless I am seeing it incorrectly, the oleControl does not display a thumbnail?

I also assume that if you could determine the file selected in the oleControl, that file could then be the .Picture property of the .Image control?

FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Chris,

Yes, the olecontrol does show thumbnails at least when I run it from VFP 7 on Windows XP. Yes, if I could determine what was selected I could automatically show the picture in the image control and not require that the user drag-n-drop the files, which is what I believe trevr1 was looking for.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Ok, well my question still remains, how can I get the filename of the user selected file(s) in code? Anyone have an idea?

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
I am mystified by this. Windows or the ActiveX certainly knows which files are selected. Why can't I get the name of those files selected? Still looking for help with this.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
slighthaze

You may find them in the registry.

FI, HKEY_CURRENT_USER\Software\Microsoft\CurrentVersion\Explorer\ComDlg32\LastVisitedMRU lists the last 25 files accessed by the Windows Common Dialog.

There may be a corresponding entry for the ActiveX control?

FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top