Take a look at this sample for an alternative:
http://www.wideopenwest.com/~rsizer/powerbuilder/source/imagelist.htm
It shows you how to extract icons and display them in a listview control.
You may also want to take a look at this API function:
ExtractAssociatedIcon
The imagelist example used ExtractIconEx to extract an pointer to an
icon from an executable file. I think ExtractAssociatedIcon may be a
better fit, you'll have to try it.
Good Luck,
Brad
Mark Pare wrote:
> Hi all, does anyone know of any code that can get the icon
> of a file and display it next to a filename in a datawindow
> (similar to Windows Explorer in the attachment) Or any code
> that mimics Windows Explorer in general?
>
> Let me know. Thanks
>
> PB 10.5.1 (6021)
>
>
> ------------------------------------------------------------------------
>
--
Join the Advanced GUI Development project on CodeXchange
https://advanced-gui-development.codexchange.sybase.com/
"Brad Wery[TeamSybase]" <bradweryatagricoreunited.com> wrote in message
news:4604452f$1@forums-1-dub...
You just retrieve a char() column containing the bitmap name i.e.,
'fileicon.bmp', then you select the "display as bitmap" attribute for the
column.
Actually, I prefer relative pathing - much more flexible.
'..\icons\fileicon.bmp'. See why below...
Here's the handy-dandy guide to external resources in PB apps:
1. NO PATHING references. 'fileicon.bmp'
If you use this style for attribute and code references, then the .bmp file
HAS to be in the same physical folder as the PBL containing the object
that's referencing it at COMPILE time. If you have two different objects,
in two different PBLs, in two different folders, referencing the same .BMP,
you need two copies... Ugly and inflexible.
2. ABSOLUTE PATHING references.
'c:\myProject\myPBSource\icons\fileicon.bmp'
The .bmp file HAS to be in THIS VERY folder at compile time. We have
developers that liked to use their D: partition, and they always got the
"red X'. This is the default style that PB gives you... Ugly and
inflexible.
3. RELATIVE PATHING references. '..\icons\fileicon.bmp'
The .bmp file must be located in the \icons folder, which (in this example)
is a sibling of the folder containing the PBL with the object that's
referencing it. The code references (dw_1.dragicon =
'..\icons\dragicon.bmp') and property attributes must be specified this way,
and it's NOT the default. This style provides the BEST flexibility. I can
work from my C: drive, and have 4 different build workspaces in progress,
and Susie can work from her D: drive, and it all works perfectly.
In any of the three styles, you have to create a .PBR file that contains all
these external resource references - and they must match the code/property
references character-for-character. Then associate the .PBR file with the
build in the Project object. If you do this - you will compile the
bitmaps/icons/cursors directly into the EXE (or PBD) and you DON'T need to
deploy the resource files themselves with the build.
Paul Horan[TeamSybase]
<Mark Pare> wrote in message news:46041b50.46b...@sybase.com...
Let me know. Thanks
"Paul Horan[TeamSybase]" <phoran AT sybase DOT com> wrote in message
news:4605487f$1@forums-1-dub...
"Mark Pare" <mark...@videotron.ca> wrote in message
news:4606e12c$1@forums-1-dub...
"Philip Salgannik" <philema...@comcast.net> wrote in message
news:4606f081@forums-1-dub...
Extract them ahead of time into BMPs, and compile them into your
application. How many can there be? A dozen?
Then write an SQL statement something like this:
Select
fileName,
fileType,
CASE fileType
WHEN 'musicfile' THEN '..\icons\itunes.bmp'
WHEN 'worddoc' THEN '..\icons\word.bmp'
WHEN 'excelxls' THEN '..\icons\excel.bmp'
...
ELSE '..\icons\somethingelse.bmp' END
from
myTable ;
Paul Horan[TeamSybase]
I'm basically looking for the functionality described for
the listview available for a datawindow, but the only way to
do that is to extract that icon from a file (text, exe,
etc.) and put it in a column in a grid dw.
This seems like a tall order. It's too bad that PB doesn't
have the ability to have a grid dw that mimics a listview.
Any other ideas? Thanks
You should also take a look at u_lv and u_lvs in the PFC. I've never
used these object before so I'm not exactly sure if they will help you.
If they work anything like the PFC treeview you should be able to link a
datastore to the listview control.
Brad
That's along the lines of what I'm suggesting. My suggestion is just to do
it at development/compile time, rather than runtime.
There are API calls (as Brad pointed out) where you can ask a file "what
icon are you using", but I know of no way to take that string and render the
actual icon unless you already have the image extracted.
Paul Horan[TeamSybase]
<Mark Pare> wrote in message news:4607caf9.456...@sybase.com...
http://www.devx.com/vb2themax/Tip/18931
http://forums.devx.com/archive/index.php/t-36814.html
One other thing I would suggest is that you go to kodigo.sourceforge.net
and checkout the Kodigo framework. I know that Yeyi has done some image
list stuff (I'm not sure he every put the images in a datawindow). There
is a forum on that site that may be of better help.
This is an interesting problem. Please let us know if you find a solution.
Brad
Mark Pare wrote:
> Would you be able to tell me which searches you did so I can
> translate the VB code? Thanks for your help with this.
>
>