WindowsAPI ListIconGadget

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

WindowsAPI ListIconGadget

Post by Distorted Pixel »

Is there such thing as a WinAPI ListIconGadget command? I have searched the Windows API index online to all end and haven't found it if it does exist.

If it does, maybe I'm not looking in the right place
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
spikey
Enthusiast
Enthusiast
Posts: 778
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: WindowsAPI ListIconGadget

Post by spikey »

(On Windows) the ListIconGadget uses the List View control. You can find its API documentation at https://learn.microsoft.com/en-us/windo ... -reference
Last edited by spikey on Fri Dec 15, 2023 8:45 pm, edited 1 time in total.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4996
Joined: Sun Apr 12, 2009 6:27 am

Re: WindowsAPI ListIconGadget

Post by RASHAD »

Hi

Code: Select all

#HDS_CHECKBOXES          = $0400
#HDF_CHECKBOX            = $0040
#HDF_CHECKED             = $0080

Global oldproc,header, header_h

colinfo.LV_COLUMN 
colinfo\mask = #LVCF_TEXT|#LVCF_WIDTH|#LVCF_FMT 
colinfo\fmt = #LVCFMT_LEFT 
colinfo\cx = 160

Procedure Hheight(hWnd, uMsg, wParam, lParam)
  result = CallWindowProc_(oldproc, hWnd, uMsg, wParam, lParam)
  Select uMsg
    Case #HDM_LAYOUT
      *hdlayout.HD_LAYOUT = lParam
      If *hdlayout\prc <> 0
        *rect.RECT = *hdlayout\prc
        *rect\top = header_h
      EndIf
      If *hdlayout\pwpos <> 0
        *windowpos.WINDOWPOS = *hdlayout\pwpos
        *windowpos\cy = header_h
      EndIf          
  EndSelect
  ProcedureReturn result
EndProcedure

hwnd = OpenWindow(0,0,0,800,600, "API Listview",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
lv = CreateWindowEx_(#WS_EX_STATICEDGE , "SysListView32", "API ListView", #LVS_REPORT | #WS_CHILD | #WS_VISIBLE | #WS_HSCROLL | #WS_VSCROLL , 10,10,780,570,hwnd,0,0,0) 
flags = #LVS_EX_FULLROWSELECT|#LVS_EX_CHECKBOXES|#LVS_EX_GRIDLINES
SendMessage_(lv,#LVM_SETEXTENDEDLISTVIEWSTYLE,flags,flags)
SendMessage_(lv,#LVM_SETTEXTCOLOR,0,$FFFFFF)
SendMessage_(lv,#LVM_SETTEXTBKCOLOR,0,$0)
SendMessage_(lv,#LVM_SETBKCOLOR,0,$D4D4D4)

header_h = 45
Header = SendMessage_(lv, #LVM_GETHEADER, 0, 0)
SetWindowLongPtr_(Header, #GWL_STYLE, GetWindowLongPtr_(Header, #GWL_STYLE) | #HDS_CHECKBOXES)
oldproc = SetWindowLongPtr_(Header, #GWL_WNDPROC, @Hheight())

For x = 0 To 6
  header$= "Column Header "+Str(x)
  colinfo\pszText = @header$
  SendMessage_(lv, #LVM_INSERTCOLUMN, x, @colinfo) 
Next

line.LV_ITEM 
line\Mask     = #LVIF_TEXT 
For i=0 To 100
  linetxt.s = "text entry "
  line\iitem = i
  line\pszText  = @linetxt
  SendMessage_(lv, #LVM_INSERTITEM, 0, @line)
  For c = 1 To 10
    col.LV_ITEM 
    coltext.s = "text entry " + Str(i) + " " +Str(c)
    col\Mask     = #LVIF_TEXT 
    col\iitem = i
    col\iSubItem = c
    col\pszText  = @coltext
    SendMessage_(lv, #LVM_SETITEM, 0, @col)
  Next
Next

Repeat 
  Select WaitWindowEvent() 
    Case #PB_Event_CloseWindow
      Quit = 1
      
  EndSelect
Until Quit = 1

End
Egypt my love
User avatar
jacdelad
Addict
Addict
Posts: 2035
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: WindowsAPI ListIconGadget

Post by jacdelad »

What exactly do you need?
TileView plus groups and some other stuff: https://www.purebasic.fr/english/viewtopic.php?t=78230
Sorting on header click: https://www.purebasic.fr/english/viewtopic.php?t=55085
And much more...
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 321
Joined: Sun Aug 29, 2021 4:34 am

Re: WindowsAPI ListIconGadget

Post by Distorted Pixel »

spikey wrote: Fri Dec 15, 2023 8:13 pm (On Windows) the ListIconGadget uses the List View control. You can find its API documentation at https://learn.microsoft.com/en-us/windo ... -reference
While I was looking throught the API index online and couldn't find ListIconGadget any where, I started to think that it might have something to do with List View, but I wasn't sold on the idea. Thank you for the link. I will study it.


RASHAD wrote: Fri Dec 15, 2023 8:23 pm Hi

Code: Select all

#HDS_CHECKBOXES          = $0400
#HDF_CHECKBOX            = $0040
#HDF_CHECKED             = $0080

Global oldproc,header, header_h

colinfo.LV_COLUMN 
colinfo\mask = #LVCF_TEXT|#LVCF_WIDTH|#LVCF_FMT 
colinfo\fmt = #LVCFMT_LEFT 
colinfo\cx = 160

Procedure Hheight(hWnd, uMsg, wParam, lParam)
  result = CallWindowProc_(oldproc, hWnd, uMsg, wParam, lParam)
  Select uMsg
    Case #HDM_LAYOUT
      *hdlayout.HD_LAYOUT = lParam
      If *hdlayout\prc <> 0
        *rect.RECT = *hdlayout\prc
        *rect\top = header_h
      EndIf
      If *hdlayout\pwpos <> 0
        *windowpos.WINDOWPOS = *hdlayout\pwpos
        *windowpos\cy = header_h
      EndIf          
  EndSelect
  ProcedureReturn result
EndProcedure

hwnd = OpenWindow(0,0,0,800,600, "API Listview",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
lv = CreateWindowEx_(#WS_EX_STATICEDGE , "SysListView32", "API ListView", #LVS_REPORT | #WS_CHILD | #WS_VISIBLE | #WS_HSCROLL | #WS_VSCROLL , 10,10,780,570,hwnd,0,0,0) 
flags = #LVS_EX_FULLROWSELECT|#LVS_EX_CHECKBOXES|#LVS_EX_GRIDLINES
SendMessage_(lv,#LVM_SETEXTENDEDLISTVIEWSTYLE,flags,flags)
SendMessage_(lv,#LVM_SETTEXTCOLOR,0,$FFFFFF)
SendMessage_(lv,#LVM_SETTEXTBKCOLOR,0,$0)
SendMessage_(lv,#LVM_SETBKCOLOR,0,$D4D4D4)

header_h = 45
Header = SendMessage_(lv, #LVM_GETHEADER, 0, 0)
SetWindowLongPtr_(Header, #GWL_STYLE, GetWindowLongPtr_(Header, #GWL_STYLE) | #HDS_CHECKBOXES)
oldproc = SetWindowLongPtr_(Header, #GWL_WNDPROC, @Hheight())

For x = 0 To 6
  header$= "Column Header "+Str(x)
  colinfo\pszText = @header$
  SendMessage_(lv, #LVM_INSERTCOLUMN, x, @colinfo) 
Next

line.LV_ITEM 
line\Mask     = #LVIF_TEXT 
For i=0 To 100
  linetxt.s = "text entry "
  line\iitem = i
  line\pszText  = @linetxt
  SendMessage_(lv, #LVM_INSERTITEM, 0, @line)
  For c = 1 To 10
    col.LV_ITEM 
    coltext.s = "text entry " + Str(i) + " " +Str(c)
    col\Mask     = #LVIF_TEXT 
    col\iitem = i
    col\iSubItem = c
    col\pszText  = @coltext
    SendMessage_(lv, #LVM_SETITEM, 0, @col)
  Next
Next

Repeat 
  Select WaitWindowEvent() 
    Case #PB_Event_CloseWindow
      Quit = 1
      
  EndSelect
Until Quit = 1

End
So, basically a WinAPI ListIconGadget is nothing but multiple WinAPI ListViewGadgets connected together?

Thank you very much for the snippet RASHAD. I will study it and try to learn how it is put together.
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
mk-soft
Always Here
Always Here
Posts: 6331
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: WindowsAPI ListIconGadget

Post by mk-soft »

So, basically a WinAPI ListIconGadget is nothing but multiple WinAPI ListViewGadgets connected together?
No,

ListViewGadget -> Windows ListBox
ListIconGadget -> Windows ListView
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 321
Joined: Sun Aug 29, 2021 4:34 am

Re: WindowsAPI ListIconGadget

Post by Distorted Pixel »

jacdelad wrote: Fri Dec 15, 2023 10:19 pm What exactly do you need?
I have the same project going in both AppGameKit and PureBasic. They both have their advantages and disadvantages toward each other. I find it easier to program in AGK when it pertains to 2D and 3D graphics, but when it comes to things like displaying information on screen with the ability to scroll through it and select things and editing and so on, PureBasic is easier to use because of the gadgets like ListViewGadget and ListIconGadget for example. AGK doesn't have anything that makes it easy to do that.

So, with that being said I was thinking about creating a dll with a WinAPI ListView thing among some other things in it including a data manipulation procedures. Since we can't just wrap commands to use with 3rd party programming language, using WinAPI is a work around to not run into a licensing issue with Fred. I totally forgot that there is a lot more involved in creating anything with WinAPI. I don't have that much experience with WinAPI, after all I am a beginner at Windows API. So...I guess that idea is out.

[Edit:]
I also thought I could start a Tier 2 project in AGK and use WinAPI to create the ListView stuff that way and not use a dll

I use the 64 bit version and I updated to 6.04 LTS and my code broke. I have multiple windows within this program and one stays open the whole time, but hides when not in use. I had a linked list finally working the way I wanted. I didn't touch the code at all and just updated to 6.04 and it claims now that the list doesn't exist when I know it does. This is why I went back to AGK for now. Why it broke I couldn't tell you


mk-soft wrote: Sat Dec 16, 2023 2:53 am
So, basically a WinAPI ListIconGadget is nothing but multiple WinAPI ListViewGadgets connected together?
No,

ListViewGadget -> Windows ListBox
ListIconGadget -> Windows ListView
As soon as I posted that, I thought... how stupid of me to think that even for a second, let alone post it. I knew better LOL
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
jacdelad
Addict
Addict
Posts: 2035
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: WindowsAPI ListIconGadget

Post by jacdelad »

Everything that's possible with PureBasic you can do with API too, but some things are a piece of work, like colouring items. Also, for many simple tasks, like changing the text of a single cell, needs a bit more than just a single line. It's not hard, but you'd have to do a lot of "pre" work. With that being said, it's up to you, whether that's worth it or not.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 321
Joined: Sun Aug 29, 2021 4:34 am

Re: WindowsAPI ListIconGadget

Post by Distorted Pixel »

jacdelad wrote: Sun Dec 17, 2023 2:34 am Everything that's possible with PureBasic you can do with API too, but some things are a piece of work, like colouring items. Also, for many simple tasks, like changing the text of a single cell, needs a bit more than just a single line. It's not hard, but you'd have to do a lot of "pre" work. With that being said, it's up to you, whether that's worth it or not.
I have learned some so far, but nothing to make a whole gadget myself yet. So far I have just used a constant here and there to change a native command gadget (ListIconGadget()) in a way I have needed it to be like no headers (#LVS_NOCOLUMNHEADER). I have also used other people's example code of creating a ListIconGadget and study it and experiment with it to learn what I can from it. I have a long way to go with API, but I do think in some cases it is well worth it.

Thank you for the link AZJIO, this will be quit helpfull and yes I search online a lot when I run into things I don't know what are or if I need to understand something better than what the documentation says of anything I am working with. In most cases it helps a lot to do that. My brother calls me "Mr. Search and Find", if it is out there I will find it LOL
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