TreeGadget with Checkboxes and images

Windows specific forum
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

TreeGadget with Checkboxes and images

Post by wombats »

This is a minor issue (if it's really an issue at all :lol:), 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?
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

Re: TreeGadget with Checkboxes and images

Post 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
Egypt my love
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: TreeGadget with Checkboxes and images

Post by Kwai chang caine »

Hello wombats and RASHAD :D

Thanks for this code RASHAD 8)
Just for information, if i not enable XP theme, the space between image and checkbox are black :|
ImageThe happiness is a road...
Not a destination
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

Re: TreeGadget with Checkboxes and images

Post 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()
Egypt my love
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: TreeGadget with Checkboxes and images

Post 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. :D

Bless you, Rashad. You've helped so many coders, so many times. You rock! 8)
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: TreeGadget with Checkboxes and images

Post by Kwai chang caine »

SupeRashMan wrote:Hi KCC
Change to
Yeeees !!!!! PERFECT !!!!
Dude wrote:Bless you, Rashad. You've helped so many coders, so many times. You rock!
It's the reason why RASHAD is one of my heroes, since a long time !!!!

Image

RASHAD is the first egyptian, also big than the pyramids 8)

ImageImageImage
ImageThe happiness is a road...
Not a destination
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

Re: TreeGadget with Checkboxes and images

Post by wombats »

Thank you, RASHAD! Wonderful code as always.
Post Reply