Page 1 of 1 1
Topic Options
#91242 - 2003-01-28 09:04 PM putting an icon into a listview
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
how do you do this??
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#91243 - 2003-01-28 10:02 PM Re: putting an icon into a listview
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
we just discussed about this.
let me see full details.
_________________________
!

download KiXnet

Top
#91244 - 2003-01-28 10:09 PM Re: putting an icon into a listview
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok, basically you would load an icon/image-list for the listview.
and then assign the image from there by index...

can't remember fully, but something similar to:
$listview.images.add(Filename)

$listview.items(0).icon = 0

well, as can't find the doc or properties from kixforms.org site, this is just IIRC.
well, if you have spare time, you might want to try it out [Wink]
_________________________
!

download KiXnet

Top
#91245 - 2003-01-28 10:20 PM Re: putting an icon into a listview
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I'm looking to put icons into column 1 of this:

probably the red X, green check, ?, and the NOT symbol

for service not exist, service exists, can't connect, and no permissions

 -
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#91246 - 2003-01-28 11:00 PM Re: putting an icon into a listview
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok, had to struggle with this but found out that my IIRC was pretty much correct:

first, create imagelist:
$imagelist=$form.imagelist
$imagelist.images.add(@scriptdir+"\tongue1.bmp")
$imagelist.images.add(@scriptdir+"\tongue2.bmp")
$imagelist.images.add(@scriptdir+"\tongue3.bmp")

then pass that to listview:
$listview.SmallImageList = $imagelist

and after that, you can reference the images by ref...

as example:
$item=$list.items.add("1",0)

would make the row have the tongue1.bmp in front of it.
_________________________
!

download KiXnet

Top
#91247 - 2003-01-28 11:23 PM Re: putting an icon into a listview
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Rad,Joe

Yup you got it ... in order for a ListView to display images, it needs an ImageList plugged into it and there are two properties provided just for this purpose:

$ListView.SmallImageList
$ListView.LargeImageList

You can handjob the ImageList (like above) or you can pluggin an existing ImageList. Coincidentally enough [Wink] the ICON LIBRARY is implemented as a SmallImageList and is referenced through the FORM object. So you can snap the builtin icon library into the ListView like this:

$ListView.SmallImageList = $Form.SmallImageList

Once the ImageList is plugged in, you can set an Item to display an icon in two ways. Once when its first created:

$Item = $ListView.Items.Add("john",23)

or afterwards using the ImageIndex (Index into ImageList) property:

$ListView.Items(0).ImageIndex = 24

Hope this helps.

-Shawn

Top
#91248 - 2003-01-28 11:26 PM Re: putting an icon into a listview
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I got as far as imageindex...
:-)

and it always helps...
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#91249 - 2003-01-28 11:34 PM Re: putting an icon into a listview
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
damn!
it was that imageindex I had no clue about.

can admit, my bad.
just tried to code instead of using typelib-viewer.
_________________________
!

download KiXnet

Top
#91250 - 2003-01-28 11:38 PM Re: putting an icon into a listview
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there is syntax error in your code [Razz]

damn, I got to say that [Big Grin]
_________________________
!

download KiXnet

Top
#91251 - 2003-01-28 11:41 PM Re: putting an icon into a listview
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
got it... updated picture.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 6124 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.04 seconds in which 0.017 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org