Page 1 of 3

Images in ListIcon headers?

Posted: Sun Dec 28, 2003 7:39 pm
by Karbon
Is it possible to have an image in a listicon header? I know it is possible in the results but I'd like to show something in the header to indicate how the results are ordered..

Thanks!

Posted: Mon Dec 29, 2003 2:11 pm
by Denis
Mitch,

you must send an HDM_SETITEM message to you ListIconGadget, but first you must feel up a var based on HDITEM structure.

It's seems there are 2 ways to put an image (i haven't done tests).

Directly with the handle of image (put image handle to hbm of the stucture) and the other one with an image list.


Denis

Posted: Mon Dec 29, 2003 2:23 pm
by Karbon
Excellent! Thanks for the push in the right direction!

Posted: Mon Dec 29, 2003 2:39 pm
by Karbon
At the risk of looking pretty dumb I'll go ahead and post this :-)

Like this? (isn't working, btw) :

Code: Select all

header_message.HD_ITEM\mask = #HDI_IMAGE
header_message.HD_ITEM\hbm = UseImage(#Image_order_up)
SendMessage_(GadgetID(#My_Listicon),#HDM_SETITEM,1,*header_message)

Posted: Mon Dec 29, 2003 4:09 pm
by Denis
May be you must put

mask = #HDI_BITMAP | #HDI_FORMAT
fmt = #HDF_BITMAP_ON_RIGHT ; or another value
hbm = UseImage(#Image_order_up)

mask = #HDI_IMAGE means that iImage of the structure is valid and in that case you must use an image list to display an image, not with hbm.

I done some tries many weeks ago with this way (with hbm) but without succes :cry:

Denis

Posted: Mon Dec 29, 2003 4:14 pm
by Karbon
Hmm, no luck there either.. I'll keep trying!

Thanks!

Posted: Mon Dec 29, 2003 4:24 pm
by Denis
Right syntax in your example to send message must be


SendMessage_(GadgetID(#My_Listicon),#HDM_SETITEM,1, @header_message)

not

SendMessage_(GadgetID(#My_Listicon),#HDM_SETITEM,1,*header_message)

Denis

Posted: Mon Dec 29, 2003 6:19 pm
by Denis
Mitch,

i found the solution
Here is the code with the Icon included as Datas

Denis

Code: Select all

; constantes des Gadgets

Enumeration
  #MainWindow
  #ListIconGadget1
  #Image
EndEnumeration

#HDF_SORTDOWN = $200
#HDF_SORTUP   = $400


Structure LVCOLUMN 
  mask.l 
  fmt.l 
  cx.l 
  pszText.l
  cchTextMax.l 
  iSubItem.l 
  iImage.l 
  iOrder.l 
EndStructure 

; ;========================================================================================
; ;========================================================================================

If OpenWindow(#MainWindow, 0, 0, 420, 300, #PB_Window_ScreenCentered | #PB_Window_SystemMenu, " Header image")
  If CreateGadgetList(WindowID()) And ListIconGadget(#ListIconGadget1, 10, 55, 400, 236, "Colonne 1", 398 / 4, #PB_ListIcon_MultiSelect)
    AddGadgetColumn(#ListIconGadget1, 1, "Column 2", 398 / 4)
    AddGadgetColumn(#ListIconGadget1, 2, "Colonne 3", 398 / 4)
    AddGadgetColumn(#ListIconGadget1, 3, "Column 4", 398 / 4)
    
    
    For i.b = 1 To 10
      AddGadgetItem(#ListIconGadget1, -1, "111" + Chr(10) + "222" + Chr(10) + "333" + Chr(10) + "444" )
    Next i
    
    ItemImage = CatchImage(#Image, ?CroixIco) ; get the image Handle

    
    ; get headerID, it's the control, not the GadgetID(#ListIconGadget1)
    HwndHeader = sendmessage_(GadgetID(#ListIconGadget1), #LVM_GETHEADER, 0, 0)


;;============== first column  Image to the right ========================
      ; get text of 1st header col
       TextColumn.s = Space(255) 
       ColumnNumber = 0 
       Var.LVCOLUMN 
       Var\mask  = #LVCF_TEXT 
       Var\pszText      = @TextColumn
       Var\cchTextMax   = 255

       SendMessage_(GadgetID(#ListIconGadget1), #LVM_GETCOLUMN, ColumnNumber,@Var) 
       
  
      ; icone 1st column to the right
      ; variable on HDITEM
       VarHeader.HDITEM
       VarHeader\mask         = #HDI_BITMAP | #HDI_TEXT | #HDI_FORMAT 
       VarHeader\fmt          = #HDF_BITMAP | #HDF_BITMAP_ON_RIGHT | #HDF_STRING
       VarHeader\hbm          = ItemImage
       VarHeader\pszText      = @TextColumn
       VarHeader\cchTextMax   = Len(TextColumn)
       
      SendMessage_(HwndHeader, #HDM_SETITEM, ColumnNumber , @VarHeader)
;; ========================================================================

;;============== 2nd  column Image to the left ===========================
      ; get text of 2nd header col
       TextColumn.s = Space(255) 
       ColumnNumber = 1
       Var.LVCOLUMN 
       Var\mask  = #LVCF_TEXT 
       Var\pszText      = @TextColumn
       Var\cchTextMax   = 255

       SendMessage_(GadgetID(#ListIconGadget1), #LVM_GETCOLUMN, ColumnNumber,@Var) 
       
  
      ; icone 2nd column to the right
       VarHeader\mask         = #HDI_BITMAP | #HDI_TEXT | #HDI_FORMAT 
       VarHeader\fmt          = #HDF_BITMAP  | #HDF_STRING  ; here it change
       VarHeader\hbm          = ItemImage
       VarHeader\pszText      = @TextColumn
       VarHeader\cchTextMax   = Len(TextColumn)
       
      SendMessage_(HwndHeader, #HDM_SETITEM, ColumnNumber , @VarHeader)
;; =======================================================================

; fmt could specify  HDF_SORTDOWN with Version 6.00 of IE --> Draws a down-arrow on this item. This is typically used To indicate that information in the current window is sorted on this column in descending order.

; fmt could specify  HDF_SORTUP   with Version 6.00 of IE --> Draws an up-arrow on this item. This is typically used To indicate that information in the current window is sorted on this column in ascending order.



  EndIf
EndIf

Repeat
  
  Select WaitWindowEvent()
    Case #PB_EventCloseWindow
      Quit + 1
  EndSelect
  
Until Quit

End


DataSection   ; icon values 
  
  CroixIco :
    Data.l $03364D42, $00000000, $00360000, $00280000, $00100000, $00100000
    Data.l $00010000, $00000018, $03000000, $0EC30000, $0EC30000, $00000000
    Data.l $00000000, $C0C00000, $CECECEC0, $B6B6B6B6, $B6B6B6B6, $B6B6B6B6
    Data.l $B6B6B6B6, $B6B6B6B6, $B6B6B6B6, $B6B6B6B6, $B6B6B6B6, $B6B6B6B6
    Data.l $C0CECECE, $C0C0C0C0, $FFDFFFC0, $FFFFFFFF, $FFFFFFFF, $FFFFFFFF
    Data.l $FFFFFFFF, $FFFFFFFF, $FFFFFFFF, $FFFFFFFF, $FFFFFFFF, $FFDFFFFF
    Data.l $CEB6B6B6, $DFFFCECE, $E97E65FF, $13BD3713, $3F1DBD37, $BF3F1DBF
    Data.l $18C03C18, $3812C03C, $C0350DC2, $05C12E05, $2C02C12E, $E8765BC0
    Data.l $B6FFDFFF, $FFFFB6B6, $DE4119FF, $25DE4E25, $5835DE4E, $E25835E2
    Data.l $2CE25431, $5223E455, $E94B13E6, $0AE8430A, $3904E843, $C02C02E0
    Data.l $B6FFFFFF, $FFFFB6B6, $E24E26FF, $FFE35B3A, $FFFFFFFF, $E25835FF
    Data.l $2CE25431, $5223E455, $E94B13E6, $FFFFFFFF, $430AFFFF, $C12E05E8
    Data.l $B6FFFFFF, $FFFFB6B6, $E24E26FF, $FFE35B3A, $FFFFFFFF, $FFFFFFFF
    Data.l $37E76640, $5D2CE863, $FFFFFFE9, $FFFFFFFF, $430AFFFF, $C12E05E8
    Data.l $B6FFFFFF, $FFFFB6B6, $E25431FF, $46E56546, $FFFFE565, $FFFFFFFF
    Data.l $37FFFFFF, $FFFFE863, $FFFFFFFF, $0EFFFFFF, $480EE948, $C0350DE9
    Data.l $B6FFFFFF, $FFFFB6B6, $E45F3FFF, $50E66D50, $7054E66D, $FFFFFFE7
    Data.l $FFFFFFFF, $FFFFFFFF, $FFFFFFFF, $1CE65223, $4B1CE04B, $C03C18E0
    Data.l $B6FFFFFF, $FFFFB6B6, $E5684BFF, $5AE8755A, $7356E875, $E66C4FE7
    Data.l $FFFFFFFF, $FFFFFFFF, $E45024FF, $24DF4C1F, $5024E450, $BF3F1DE4
    Data.l $B6FFFFFF, $FFFFB6B6, $E77054FF, $62E97C62, $755AE97C, $FFFFFFE8
    Data.l $FFFFFFFF, $FFFFFFFF, $FFFFFFFF, $2CE24E26, $502CE150, $BE4223E1
    Data.l $B6FFFFFF, $FFFFB6B6, $E8785DFF, $6CEB866C, $FFFFEB86, $FFFFFFFF
    Data.l $3FFFFFFF, $FFFFE45F, $FFFFFFFF, $2CFFFFFF, $512CE151, $BE4223E1
    Data.l $B6FFFFFF, $FFFFB6B6, $E9836AFF, $FFED947E, $FFFFFFFF, $FFFFFFFF
    Data.l $48E76F53, $5F3FE567, $FFFFFFE4, $FFFFFFFF, $5431FFFF, $BE4223E2
    Data.l $B6FFFFFF, $FFFFB6B6, $E9836AFF, $FFED947E, $FFFFFFFF, $EB866CFF
    Data.l $5EE97E65, $765BE879, $E77054E8, $FFFFFFFF, $5431FFFF, $BE4223E2
    Data.l $B6FFFFFF, $FFFFB6B6, $EE9883FF, $7EF0A895, $947EED94, $EB866CED
    Data.l $5EE97E65, $765BE879, $E77054E8, $48E56848, $5937E568, $BF4121E3
    Data.l $B6FFFFFF, $DFFFB6B6, $F2B5A6FF, $65ED947E, $7E65E97E, $E8785DE9
    Data.l $53E77356, $6D50E76F, $E56748E6, $3FE45F3F, $512CE45F, $EA8670E1
    Data.l $CEFFDFFF, $C0C0CECE, $FFDFFFC0, $FFFFFFFF, $FFFFFFFF, $FFFFFFFF
    Data.l $FFFFFFFF, $FFFFFFFF, $FFFFFFFF, $FFFFFFFF, $FFFFFFFF, $FFDFFFFF
    Data.b - 64, -64, -64, -64, -64, -64
  
EndDataSection

Posted: Mon Dec 29, 2003 7:57 pm
by Karbon
WORKS!

Posted: Mon Dec 29, 2003 9:30 pm
by Denis
WORKS!
:lol:

I write something wrong with HDF_SORTDOWN & HDF_SORTUP.
It's not IE version 6 but Comctl32.dll version 6 i think

From MS Doc

Note Comctl32.dll version 6 is not redistributable but it is included in Microsoft® Windows® XP or later. To use Comctl32.dll version 6, specify it in a manifest. For more information on manifests, see Using Windows XP Visual Styles.

Posted: Mon Dec 29, 2003 10:14 pm
by Karbon
One more and I'll leave you alone!

What am I doing wrong here to check what image is currently in the header?

Code: Select all

            HwndHeader = SendMessage_(GadgetID(#My_ListIcon), #LVM_GETHEADER, 0, 0)
            
            header_info.HDITEM

            header_info\mask = #HDI_BITMAP
             
            SendMessage_(HwndHeader, #HDM_GETITEM, Column , @header_info)
            
            image_id= UseImage(#Image_order_down)

            If header_info\hbm = image_id
               dosomething()
            EndIf

Posted: Mon Dec 29, 2003 11:38 pm
by Denis
Try with this 2 values before sending msg #HDM_GETITEM
It should work

mask = #HDI_BITMAP | #HDI_FORMAT
fmt = #HDF_BITMAP

Denis

Posted: Tue Dec 30, 2003 12:09 am
by Karbon
Yeah, I tried that already with no luck (I just tried it again)..

hbm does have a value but it's not what useimage() is returning.

Posted: Tue Dec 30, 2003 3:14 pm
by Denis
Mitch,

could you put more code here or at my e-mail ?

Denis

Posted: Tue Dec 30, 2003 3:57 pm
by Karbon
Sure! Here is the exact code..

Code: Select all

            HwndHeader = SendMessage_(GadgetID(#Gadget_main_lst_c_search_results), #LVM_GETHEADER, 0, 0)
            
            header_info.HDITEM
            header_info\mask = #HDI_BITMAP | #HDI_FORMAT
            header_info\fmt = #HDF_BITMAP
             
            SendMessage_(HwndHeader, #HDM_GETITEM, Column , @header_info)
Then I compare header_info\hbm against useimage(#My_Image) but they never match up correctly even though I set the image just above where I do that check.