Page 1 of 1
TreeGadget with Checkboxes and images
Posted: Sun Jun 03, 2018 10:38 pm
by wombats
This is a minor issue (if it's really an issue at all

), but when a TreeGadget has images and checkboxes, the checkbox and image are squashed right next to each other with no space between them. Is it possible to add a couple of pixels?
Re: TreeGadget with Checkboxes and images
Posted: Mon Jun 04, 2018 2:30 am
by RASHAD
Hi
Code: Select all
UsePNGImageDecoder()
LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/ToolBar/New.png")
LoadImage(1, #PB_Compiler_Home + "examples/sources/Data/ToolBar/Open.png")
LoadImage(2, #PB_Compiler_Home + "examples/sources/Data/ToolBar/Save.png")
If OpenWindow(0,0,0,500,250,"Window",#PB_Window_SystemMenu |#PB_Window_ScreenCentered)
TreeGadget(0,10,10,480,230,#PB_Tree_CheckBoxes)
CreateImage(10,22,16,32,#PB_Image_Transparent )
NewImageList = ImageList_Create_(22,16, #ILC_COLOR32 | #ILC_MASK, 0, 10)
StartDrawing(ImageOutput(10))
DrawingMode(#PB_2DDrawing_AllChannels)
DrawImage(ImageID(0),6,0,16,16) ; 6 = 22 - 16
StopDrawing()
ImageList_Add_(NewImageList,ImageID(10),0)
StartDrawing(ImageOutput(10))
DrawImage(ImageID(1),6,0,16,16)
StopDrawing()
ImageList_Add_(NewImageList,ImageID(10),0)
StartDrawing(ImageOutput(10))
DrawImage(ImageID(2),6,0,16,16)
StopDrawing()
ImageList_Add_(NewImageList,ImageID(10),0)
FreeImage(10)
AddGadgetItem(0,-1,"Test-Item #1",0,0)
AddGadgetItem(0,-1,"Test-Item #2",ImageID(1),1)
AddGadgetItem(0,-1,"Test-Item #3",ImageID(2),0)
SendMessage_(GadgetID(0), #TVM_SETIMAGELIST, #TVSIL_NORMAL, NewImageList)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: TreeGadget with Checkboxes and images
Posted: Mon Jun 04, 2018 8:03 am
by Kwai chang caine
Hello wombats and RASHAD
Thanks for this code RASHAD

Just for information, if i not enable XP theme, the space between image and checkbox are black

Re: TreeGadget with Checkboxes and images
Posted: Mon Jun 04, 2018 8:40 am
by RASHAD
Hi KCC
Change to
Code: Select all
CreateImage(10,22,16,24,$FFFFFF)
NewImageList = ImageList_Create_(22,16, #ILC_COLOR32 | #ILC_MASK, 0, 10)
StartDrawing(ImageOutput(10))
;DrawingMode(#PB_2DDrawing_AllChannels)
DrawImage(ImageID(0),6,0,16,16) ; 6 = 22 - 16
StopDrawing()
Re: TreeGadget with Checkboxes and images
Posted: Mon Jun 04, 2018 9:20 am
by Dude
RASHAD wrote:Hi
I love how Rashad comes in, says "Hi", posts some code like Santa Claus on Christmas morning, and then leaves.
Bless you, Rashad. You've helped so many coders, so many times. You rock!

Re: TreeGadget with Checkboxes and images
Posted: Mon Jun 04, 2018 6:00 pm
by Kwai chang caine
Re: TreeGadget with Checkboxes and images
Posted: Mon Jun 04, 2018 9:10 pm
by wombats
Thank you, RASHAD! Wonderful code as always.