[Solved]ListIconGadget() active

Just starting out? Need help? Post your questions and find answers here.
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 303
Joined: Sun Aug 29, 2021 4:34 am

Re: Make ListIconGadget() active

Post by Distorted Pixel »

I'm going to proceed with the non-transparent example for now, but I will keep working on the real transparent code over time

Last night I was trying to create another window with listicongadget and move things around to suit my needs to no avail. But I think I don't need another window, just another listicongadget for it to work they way I want.
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 303
Joined: Sun Aug 29, 2021 4:34 am

Re: Make ListIconGadget() active

Post by Distorted Pixel »

RASHAD wrote: Tue Oct 11, 2022 4:53 am Hi Distorted Pixel
Use ResizeWindow(1,new x,new y ,new Width,new Height)
And be sure that the new Height or (new Width) will contain the 2 ListIcons
Thank you, I'll work on doing that after work today

https://mega.nz/file/dp1W2IYZ#7W6qRU5ES ... jXL8ggNz2Y
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 303
Joined: Sun Aug 29, 2021 4:34 am

Re: Make ListIconGadget() active

Post by Distorted Pixel »

This is an old thread I started, but what I need pertains to the transparency talk part of this thread.

Is it possible to have 2 ListIconGadgets transparent on one window? Even if it is the fake transparency instead of the real, it is acceptable.

I have tried to get the fake transparency to work with 2 ListIconGadgets on 1 window, but the best I can do is the correct part of the image is behind each ListIconGadget, but the background image of the window in the ImageGadget is not showing.
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4954
Joined: Sun Apr 12, 2009 6:27 am

Re: Make ListIconGadget() active

Post by RASHAD »

Code: Select all

#LVBKIF_SOURCE_NONE = 0
#LVBKIF_SOURCE_HBITMAP = 1
#LVBKIF_SOURCE_URL = 2
#LVBKIF_SOURCE_MASK = 3
#LVBKIF_STYLE_NORMAL = 0
#LVBKIF_STYLE_TILE = $10
#LVBKIF_STYLE_MASK = $10
#LVBKIF_TYPE_WATERMARK = $10000000

Structure LVBKIMAGE Align #PB_Structure_AlignC
  ulFlags.l
  hbm.i
  pszImage.i
  cchImageMax.l
  xOffsetPercent.l
  yOffsetPercent.l
EndStructure

LoadImage(0,"g:\mmedia\pictures\Image17.bmp")   ;Use your own image
ResizeImage(0,ImageWidth(0)*2,ImageHeight(0)*2)
CopyImage(0,1)

LoadFont(1, "Comic Sans Ms",12)
SetGadgetFont(#PB_Default, FontID(1))
If OpenWindow(0, 0, 0, ImageWidth(0)*2+30,ImageHeight(0)+20, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ListIconGadget(0, 10, 10, ImageWidth(0),ImageHeight(0), "1st.ListIcon", 0,#PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect )
  ListIconGadget(1, 20+ImageWidth(0), 10, ImageWidth(0),ImageHeight(0), "2nd.ListIcon", 0,#PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect )
  
  For li = 0 To 1
    AddGadgetColumn(li, 0, "COL 1", 213)
    AddGadgetColumn(li, 1, "COL 2", 213)
    AddGadgetColumn(li, 2, "COL 3", 213)
    For i = 0 To 19
      AddGadgetItem(li, -1, "1" + Chr(10) + "2" + Chr(10) + "3")
      AddGadgetItem(li, -1, "4" + Chr(10) + "5" + Chr(10) + "6")
      AddGadgetItem(li, -1, "7" + Chr(10) + "8" + Chr(10) + "9")
    Next
  Next
  
  SetActiveGadget(0)
  
  lbk.LVBKIMAGE
  lbk\ulFlags =   #LVBKIF_STYLE_TILE| #LVBKIF_SOURCE_HBITMAP
  lbk\hbm = ImageID(0)
  SendMessage_(GadgetID(0), #LVM_SETBKIMAGE, 0, @lbk)
  
  lbk2.LVBKIMAGE  
  lbk2\ulFlags =   #LVBKIF_STYLE_TILE| #LVBKIF_SOURCE_HBITMAP
  lbk2\hbm = ImageID(1)                   ;You can use different image
  SendMessage_(GadgetID(1), #LVM_SETBKIMAGE, 0, @lbk2)
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Quit = 1
        
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 0
            Debug GetGadgetState(0)
            
        EndSelect
    EndSelect
  Until Quit = 1
EndIf
Egypt my love
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 303
Joined: Sun Aug 29, 2021 4:34 am

Re: Make ListIconGadget() active

Post by Distorted Pixel »

Thank you RASHAD,

I forgot to mention that the window is full screen borderless and the background image is the size of my desktop 1920x1080. I tried working with your code example and if I set my image to it, it says Image is not initialized. I also tried changing necessary things to hopefully meet my needs as far as I thought your code needed to be changed to, but all I got is white screen with 2 ListIconGadgets in place, but no image/s showing up.

Below is my ListIconGadget sizes and locations I need. The bottom one has no column header

Code: Select all

  ListIconGadget(0, 58, 66, 1600, 587, "1st.ListIcon", 0,#PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect )
  ListIconGadget(1, 58, 690, 1600, 352, "2nd.ListIcon", 0,#PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect | #LVS_NOCOLUMNHEADER )
[Edit] - I just tried creating my own image with CreateImage(), I worked, but no image in the window, just shows up in the gadgets. I might tried drawing the image to the image created and setting a ImageGadget the size of the window and see what happens.

I got an image to show up in the window behind, but now I need to set the parts of the background image to each IconGadgets plus get the full image set into the ImageGadget for the window
Last edited by Distorted Pixel on Mon May 26, 2025 9:53 pm, edited 1 time in total.
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4954
Joined: Sun Apr 12, 2009 6:27 am

Re: Make ListIconGadget() active

Post by RASHAD »

Use your own image

Code: Select all

#LVBKIF_SOURCE_NONE = 0
#LVBKIF_SOURCE_HBITMAP = 1
#LVBKIF_SOURCE_URL = 2
#LVBKIF_SOURCE_MASK = 3
#LVBKIF_STYLE_NORMAL = 0
#LVBKIF_STYLE_TILE = $10
#LVBKIF_STYLE_MASK = $10
#LVBKIF_TYPE_WATERMARK = $10000000

Structure LVBKIMAGE Align #PB_Structure_AlignC
  ulFlags.l
  hbm.i
  pszImage.i
  cchImageMax.l
  xOffsetPercent.l
  yOffsetPercent.l
EndStructure

Procedure liCB()
  InvalidateRect_(GadgetID(0),0,1)
  InvalidateRect_(GadgetID(1),0,1)
EndProcedure

LoadImage(0,"g:\mmedia\pictures\Image17.bmp")   ;Use your own image
CopyImage(0,1)
ResizeImage(0,1600, 587)
ResizeImage(1,1600, 352)

LoadFont(1, "Comic Sans Ms",12)
SetGadgetFont(#PB_Default, FontID(1))
If OpenWindow(0, 0, 0, 1920,1080, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ListIconGadget(0, 58, 66, 1600, 587, "1st.ListIcon", 0,#PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect )
  ListIconGadget(1, 58, 690, 1600, 352, "2nd.ListIcon", 0,#PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect | #LVS_NOCOLUMNHEADER )
  
  For li = 0 To 1
    AddGadgetColumn(li, 0, "COL 1", 213)
    AddGadgetColumn(li, 1, "COL 2", 213)
    AddGadgetColumn(li, 2, "COL 3", 213)
    For i = 0 To 19
      AddGadgetItem(li, -1, "1" + Chr(10) + "2" + Chr(10) + "3")
      AddGadgetItem(li, -1, "4" + Chr(10) + "5" + Chr(10) + "6")
      AddGadgetItem(li, -1, "7" + Chr(10) + "8" + Chr(10) + "9")
    Next
  Next
  
  SetActiveGadget(0)
  
  lbk.LVBKIMAGE
  lbk\ulFlags =   #LVBKIF_STYLE_TILE| #LVBKIF_SOURCE_HBITMAP
  lbk\hbm = ImageID(0)
  SendMessage_(GadgetID(0), #LVM_SETBKIMAGE, 0, @lbk)
  
  lbk2.LVBKIMAGE  
  lbk2\ulFlags =   #LVBKIF_STYLE_TILE| #LVBKIF_SOURCE_HBITMAP
  lbk2\hbm = ImageID(1)                   ;You can use different image
  SendMessage_(GadgetID(1), #LVM_SETBKIMAGE, 0, @lbk2)
  
  BindGadgetEvent(0,@liCB())
  BindGadgetEvent(1,@liCB())
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Quit = 1
        
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 0,1
            Debug GetGadgetState(0)
            
        EndSelect
    EndSelect
  Until Quit = 1
EndIf

Egypt my love
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 303
Joined: Sun Aug 29, 2021 4:34 am

Re: Make ListIconGadget() active

Post by Distorted Pixel »

Thank you RASHAD, I finally got it, but I think the bottom ListIconGadget Image needs to be moved ever so slightly to the left. I'm not sure if the top ListIconGadget image needs to move left or right any.

[Edit:] I took a close look and the bottom gadget image does need to be moved slightly to the left.

Code:

Code: Select all

UsePNGImageDecoder()
#LVBKIF_SOURCE_NONE = 0
#LVBKIF_SOURCE_HBITMAP = 1
#LVBKIF_SOURCE_URL = 2
#LVBKIF_SOURCE_MASK = 3
#LVBKIF_STYLE_NORMAL = 0
#LVBKIF_STYLE_TILE = $10
#LVBKIF_STYLE_MASK = $10
#LVBKIF_TYPE_WATERMARK = $10000000

Structure LVBKIMAGE Align #PB_Structure_AlignC
  ulFlags.l
  hbm.i
  pszImage.i
  cchImageMax.l
  xOffsetPercent.l
  yOffsetPercent.l
EndStructure

Procedure liCB()
  InvalidateRect_(GadgetID(0),0,1)
  InvalidateRect_(GadgetID(1),0,1)
EndProcedure

LoadImage(0, "Images\TeamRoster.png")   ;[color=#FF0000]Use your own image[/color]
;CopyImage(0,1)
;ResizeImage(0,1600, 587)
;ResizeImage(1,1600, 352)

LoadFont(1, "Comic Sans Ms",12)
SetGadgetFont(#PB_Default, FontID(1))
If OpenWindow(0, 0, 0, 1920,1080, "ListIcon Example", #PB_Window_BorderLess);#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ImageGadget(3, 0, 0, 1920, 1080, ImageID(0))
  DisableGadget(3, #True)
  
  ListIconGadget(0, 58, 66, 1600, 587, "1st.ListIcon", 0,#PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect )
  IconImage1 = GrabImage(0, 1, 58, 96, 1600, 587)
  ListIconGadget(1, 58, 690, 1600, 352, "2nd.ListIcon", 0,#PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect | #LVS_NOCOLUMNHEADER )
  IconImage2 = GrabImage(0, 2, 58, 690, 1600, 352)
  For li = 0 To 1
    AddGadgetColumn(li, 0, "COL 1", 213)
    AddGadgetColumn(li, 1, "COL 2", 213)
    AddGadgetColumn(li, 2, "COL 3", 213)
    For i = 0 To 19
      AddGadgetItem(li, -1, "1" + Chr(10) + "2" + Chr(10) + "3")
      AddGadgetItem(li, -1, "4" + Chr(10) + "5" + Chr(10) + "6")
      AddGadgetItem(li, -1, "7" + Chr(10) + "8" + Chr(10) + "9")
    Next
  Next
  
  SetActiveGadget(0)
  
  lbk.LVBKIMAGE
  lbk\ulFlags =   #LVBKIF_STYLE_TILE| #LVBKIF_SOURCE_HBITMAP
  lbk\hbm = ImageID(1)
  SendMessage_(GadgetID(0), #LVM_SETBKIMAGE, 0, @lbk)
  
  lbk2.LVBKIMAGE  
  lbk2\ulFlags =   #LVBKIF_STYLE_TILE| #LVBKIF_SOURCE_HBITMAP
  lbk2\hbm = ImageID(2)                   ;You can use different image
  SendMessage_(GadgetID(1), #LVM_SETBKIMAGE, 0, @lbk2)
  
  BindGadgetEvent(0,@liCB())
  BindGadgetEvent(1,@liCB())
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Quit = 1
        
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 0,1
            Debug GetGadgetState(0)
            
        EndSelect
    EndSelect
  Until Quit = 1
EndIf

To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
Post Reply