Board index » cppbuilder » TImageIndex property

TImageIndex property


2005-06-01 12:31:48 AM
cppbuilder79
Have anyone tried using TImageIndex property ?....
like..
__property TImageIndex ImageIndex;
I supposed that it would do the same thing as does, for example, ImageIndex
property in TMenuItem with some TImagelist assigned to the menu list it
belongs to( like TPopupMenu)
I thought it would be smth like a drop-down list with images but I don't
have any images nor drop down list with image indexes...
Any hints on this?
Thanks in advance
 
 

Re:TImageIndex property

"Danila Vershinin" < XXXX@XXXXX.COM >wrote in message
Quote
I supposed that it would do the same thing as does, for example,
ImageIndex property in TMenuItem with some TImagelist assigned
to the menu list it belongs to( like TPopupMenu)
I thought it would be smth like a drop-down list with images but
I don't have any images nor drop down list with image indexes...
Of course not, because the Object Inspector has no concept of where your
images are actually coming from, or which indexes are available. Only you
know that, so only you know how to retreive them. Which means that you need
to write your own custom property editor to fill in the drop-down list with
the available indexes. TPropertyEditor has a virtual GetValues() method
that you can override to fill in the drop-down list.
As for displaying the actual images, that is a bit more work. Only
BCB/Delphi 5+ have that feature. There are undocumented classes named
TPersistentImageIndexProperty­Editor and TComponentImageIndexPropertyEditor
that reside in the "dclstdXX" package (where "XX" is the version of your
IDE, ie "dclsrd50" or "dclstd60"). In BCB5, they are both declared in the
"StdReg.hpp" header file, but that file cannot be included in your own code
because it includes other headers that Borland does not distribute with the
IDE. In BCB6, the classes still exist but they are not declared in any
header file at all.
TPersistentImageIndexProperty­Editor is for use in any class that is derived
from TPersistent but not TComponent, whereas
TComponentImageIndexProperty­Editor is for use in any class that is derived
from TComponent. In both cases, by default they each look at the registered
class's Parent class to find an "Images" property. If you want to work with
a different property, then they each have a virtual GetImageListAt() method
that you can override to return your own TCustomImageList object instance
from whereever you are actually storing it.
Once the appropriate ImageList is returned, the property editor can then
draw the images for you in the drop-down list.
TPersistentImageIndexProperty­Editor and TComponentImageIndexProperty­Editor
already handle GetValues() for you as well, so GetImageListAt() is the only
method you have to override in your own code.
Gambit
 

Re:TImageIndex property

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
As for displaying the actual images, that is a bit more work. Only
BCB/Delphi 5+ have that feature. There are undocumented classes
named TPersistentImageIndexProperty­Editor and
TComponentImageIndexPropertyEditor that reside in the "dclstdXX"
package (where "XX" is the version of your IDE, ie "dclstd50" or
"dclstd60").
To expand on this, the classes are no longer accessible in BCB/Delphi 6+,
even though they still exist in the "dclstd" package. So you wil be best
off just writing your own property editor from scratch and not use these
classes at all. Starting with BCB/Delphi 5, TPropertyEditor has virtual
methods available for owner-drawing the drop-down list items.
Gambit
 

{smallsort}