TreeGadget : optional image parameter ?

Just starting out? Need help? Post your questions and find answers here.
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

TreeGadget : optional image parameter ?

Post by eddy »

OpenWindow(0,0,0,240,210,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"TreeGadget")
CreateGadgetList(WindowID())

#GADGET_Explorer=1
TreeGadget(#GADGET_Explorer,0,0,100,100,#PB_Tree_AlwaysShowSelection)
;First Item
LoadImage(#GADGET_Explorer,"img\new.ico")
AddGadgetItem(#GADGET_Explorer, -1, "Item with image",ImageID())

;Sub Item
OpenTreeGadgetNode(#GADGET_Explorer)
AddGadgetItem(#GADGET_Explorer, -1, "Sub Item")
CloseTreeGadgetNode(#GADGET_Explorer)

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
Why sub-item uses the last loaded image ?
I specified no image.
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Once you add an image, all Items need images, that's the way it works.

Timo
quidquid Latine dictum sit altum videtur
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

is it a global style for all of the tree ?
Denis
Enthusiast
Enthusiast
Posts: 779
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post by Denis »

Hi Eddy,


try to put a negative value for ImageID

AddGadgetItem(#GADGET_Explorer, -1, "Sub Item")

But as Freak said it, Once you add an image, all Items need images, that's the way it works. So, with a negative value under Win98, no image is displayed but the system put space between horizontal line and text.



Denis
A+
Denis
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

Ok I understand.

The problem is that even if I use a tiny image, Win$ stretches it to fit a common size. :roll:
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

This is a Windows thing, not a PB one:

To add an image, there is an ImageList created, and so all Items get an
Image from that list. That's why all must be (or are streched) to the same
size. If you put a negative value (which is an invalid ImageID()), there
is no image to display, but Windows puts these spaces there.

There is no way to change that, sorry.
(It's the same with Checkboxes. You can have either checkboxes on all
items, or on none of them)

Timo
quidquid Latine dictum sit altum videtur
Post Reply