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

Semi-documented: you can put pictures in List/Combos 1

Status
Not open for further replies.

foxdev

Programmer
Feb 11, 2000
1,995
US
Its not very well documented in the VFP help, but you can indeed include pictures (ICO, BMP, GIF, JPG) in combo boxes and list boxes. Each item in the combo/list can have its own picture.

You assign the picture properties by treating the Picture property as a collection. For example, if I want the second item (ListIndex=2) to have the picture puertor.ico displayed for it, I'd do it like this:

[tt]MyListBox.Picture(2) = "puertor.ico"[/tt]

Thanks to colleague BD and Hacker's Guide.

Robert Bradley

 
Hmmmm I have a use for that just now. Excellent timing. Thks!

Pete
blindpete@mail.com

What your mother told you is true! You will go blind! (from moonshine anyway)
 
What? Something not very well documented in VFP help? <bg> Nice Tip! John Durbin
john@johndurbin.com
MCP Visual FoxPro
ICQ VFP ActiveList #73897253
 
LOL!

Its basics of programming in VFP and this feature described in the help files pretty well :)
Look to following:
Programmers Guide, Chapter 10 Using Controls, Choosing the Right Control for the Task, Adding Pictures to Items in a List. There is nice sample picture with listbox with pictures in it for each item and code sample how to make it.
In addition, there are certain characters for list that make particular item in list disabled ('\\', AFAIK). I found this somewhere in the VFP samples.




Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
item in list disabled ('\\', AFAIK).

Actually, you preface the item with a single '\' to disable it. A double '\\' to include a \ in the items value.

Example:

MyList.Additem('\One') && Adds 'One' disabled
MyList.AddItem('\\One') && Adds '\One' enabled

Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,

When All We Want Is Unity. - Creed
 
Jon, you're right, thanks for your correction!

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Let me detail what I mean by &quot;semi-documented&quot;, Vlad.

In the on-line help, choose the topic &quot;Picture&quot; (or type: help picture in the command window). Then click on the Picture Property's Applies to link. You will see that neither combo box nor list box appears.

Further, the Picture Property page does not explain that the Picture property can contain a collection, as it does with combo and list boxes.

Robert Bradley

 
Hi, Robert!

I don't want to offend you.
I just want to agree with you that MS missed this in the context help for picture property.
You can find this help topic in index, however. Go to index tab, type 'PICTURE' (all uppercase), in the list under it choose 'list boxes'. It will go to the same location I referred.
Indeeed need to be very attentive to do not miss such detail. This is MS omission, not yours ;).



Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
No offense taken, Vlad. Generally, I think the VFP on-line help (as well as the SQL Server 7 BOL) is very good. My only real peeve is for functions or commands that still work, but the only OLH documentation is &quot;included for backward compatibility&quot;, forcing me to go to some other source for a refresher on how to use it. An example: @..GET.

Robert Bradley

 
Of course, the best source of help on old commands is Hacker's Guide, right? ;)

Generally, I think the VFP on-line help (as well as the SQL Server 7 BOL) is very good.

I think too, I just said 'MS missed this' ;).
But Help for VB in MS Office is better, just because it distinguish the same property for different objects. When you choose combobox in the help, go to its properties list, click on the Picture property, you will get the same page as for listbox and other controls. In VB Office help you will get separate pages for different objects.


Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
but the only OLH documentation is &quot;included for backward compatibility&quot;,

That one definitely makes my top 3 list of &quot;Things I Hate About the VFP Help Documentation&quot;

Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,

When All We Want Is Unity. - Creed
 
Heh, if the list's RowSourceType is 1 Value, Requery() removes all pictures. Didn't fool with other RowSourceTypes. John Durbin
john@johndurbin.com
MCP Visual FoxPro
ICQ VFP ActiveList #73897253
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top