Change TreeGadget Icon

Share your advanced PureBasic knowledge/code with the community.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

You're welcome. :)

(Actually, I will soon be needing this myself anyhow!)
I may look like a mule, but I'm not a complete ass.
Denis
Enthusiast
Enthusiast
Posts: 778
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post by Denis »

I've written some functions for Treegadget, PanelGadget and Listicongadget to put/remove images, to custom checkboxes etc

commands :

Code: Select all

 GetColumnAlignment()
 GetHeaderImage()
 GetHeaderImageAlignment()
 GetitemImage()
 GetItemIndentation()
 ListIconGadgetDisplayMode()
 FreeGadgetImages()
 RemoveHeaderImage()
 RemoveItemImage()
 SetColumnAlignment()
 SetCustomCheckBoxes()
 SetHeaderImage()
 SetHeaderImageAlignment()
 SetitemImage()
 SetItemIndentation()
 ShiftSubItem()
The code is a little bit long and is almost no commented (Sorry, all comments are in French and only for myself)

The chm file is only in french, may be i will translate it if i have enough time.

The code, examples and icons are in a zip file here

You can use the code as you want, you can modify it as you want etc.

You can use images loaded with PB commands, you can set transparency for them or changes transparency. All images are converted by the code in icon format. Original ones are not modified but you do not free them. For listicon, systems arrows are supported. Image parameter is the static id, not the ImageID()!

Before using the commands, you have to put the command

Code: Select all

ItemImage_init()
and when you quit

Code: Select all

Free_ItemImage_End()
If you free a gadget, use the command

Code: Select all

FreeGadgetImages(Gadget.l)
before using Freegadget().

FreeGadgetImages(Gadget.l) doesn't Free the gadget !

Shell32.dll must be at least version 4.71 (no problem since Win98)
The code tests this dll and if the version is < 4.71, the app will close (take a closer look at the procedure ItemImage_init()

In some case, Listicongadget crash with #PB_ListIcon_SmallIcon or #PB_ListIcon_LargeIcon display modes. I've reported this bug on french forum.

if you find some bugs, report them here

Image
Last edited by Denis on Mon Aug 21, 2006 10:10 pm, edited 2 times in total.
A+
Denis
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Hi , Denis, it is very interesting.
Thanks!
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Denis
Enthusiast
Enthusiast
Posts: 778
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post by Denis »

Psychophanta wrote:Hi , Denis, it is very interesting.
Thanks!
What about make a help and a lib (or simple .pbi include file)?
Hi Psychophanta

i will translate chm help file in english

for the lib, done it if you want but i won't done a lib. The code is free, you can also modify it as you want.
I don't use pbi file format, only pb :roll: , may be for next version (i want to write another commands)
A+
Denis
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Yes, should be good to see the help in english.
About the lib, i think it is good as normal source.

By the way, but sorry i deleted part of my above post because i just saw that you really included the help file :wink:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Very nice set of functions !

But some of them are XP only, I think : in the listicon functions you are using #HDF_SORTUP / #HDF_SORTDOWN. IIRC, these only work with XP and v6 manifest.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Denis
Enthusiast
Enthusiast
Posts: 778
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post by Denis »

gnozal wrote:Very nice set of functions !

But some of them are XP only, I think : in the listicon functions you are using #HDF_SORTUP / #HDF_SORTDOWN. IIRC, these only work with XP and v6 manifest.
Thanks Gnozal,

yes, system arrows are XP only (Comctl32.dll version >= 6.0) or #PB_OS_Windows_Server_2003 And Comctl32.dll version >= 5.1

The commands test if themes are supported (procedure Themes_Disponibles() ) to avoid trouble version. If themes are available, it return #true else it rteturns #false. Trying to to put arrows if you does'nt have themes wont be crash, the function return -1.

To avoid problem with your lib PureColor, i've written this set without callback. I've added a second transparency parameter to be able to draw correctly the image when background color are set in ownerdrawn style, but if the item are selected, the transparency color are still system one if i remember my tests.

Better way will be to have a callback to draw correctly all images in all styles (native commands set will be the must).

I will update chm french help file (somes small errors (copy/paste :mrgreen: ) and english one is almost done.
A+
Denis
Denis
Enthusiast
Enthusiast
Posts: 778
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post by Denis »

Zip file updated here

- Added english chm help file
- Corrected french chm help file
- Corrected 3 procedure (added a test for XP themes) in commands set
A+
Denis
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Thanks a lot! :D
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

@srod: that SetTreeIcon Proc helps me a lot ... thank you very much!

@Denis: thx for sharing, it's very usefull
Post Reply