Page 1 of 1

Removing column header for Explorer List Gadget

Posted: Sat Jan 29, 2011 6:08 pm
by AndyMK
Hi all, Just wondering how this can be done. For List View Gadget you can use #LVS_NOCOLUMNHEADER during creation. Is there an equivalent for the Explorer List Gadget? Thanks.

Re: Removing column header for Explorer List Gadget

Posted: Sat Jan 29, 2011 7:55 pm
by RASHAD
Hi

Code: Select all

  If OpenWindow(0, 0, 0, 400, 200, "ExplorerListGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ExplorerListGadget(0, 10, 10, 380, 180, "*.*", #PB_Explorer_GridLines|#PB_Explorer_FullRowSelect )
    SetWindowLongPtr_(GadgetID(0), #GWL_STYLE, GetWindowLongPtr_(GadgetID(0), #GWL_STYLE)|#LVS_NOCOLUMNHEADER)
  Repeat
   Select WaitWindowEvent()
     Case #PB_Event_Gadget
       Select EventGadget()
         Case 0
           Run = Run !1
           If GetGadgetState(0) > 0 And Run = 0
             Debug (GetGadgetText(0) + GetGadgetItemText(0,GetGadgetState(0)))
           EndIf
      EndSelect

    Case #PB_Event_CloseWindow
     Close=1
   EndSelect
  Until Close=1
  EndIf


Re: Removing column header for Explorer List Gadget

Posted: Sat Jan 29, 2011 10:14 pm
by AndyMK
Thanks, works great.

Re: Removing column header for Explorer List Gadget

Posted: Sun Jan 30, 2011 1:15 am
by AndyMK
Maybe someone can help me out here. I am looking at some old code i tried to get working in the past. I basically want to be able to change the color of an item in the explorer list when it is double clicked on. The code below works but if you double click on more than one then scroll down, the color remains only on the last item clicked.

Code: Select all

#CDDS_ITEM = $10000
#CDDS_SUBITEM = $20000
#CDDS_PREPAINT = $1
#CDDS_ITEMPREPAINT = #CDDS_ITEM | #CDDS_PREPAINT
#CDRF_DODEFAULT = $0
#CDRF_NOTIFYITEMDRAW = $20
Global RowCol = -1, RowCol1 = -1

Procedure WinCallbackproc(hwnd, uMsg, wParam, lParam)
  Static result, row
  Static *pnmh.NMHDR, *LVCDHeader.NMLVCUSTOMDRAW
  result = #PB_ProcessPureBasicEvents
  Select uMsg
    Case #WM_NOTIFY
      *pnmh.NMHDR = lParam
      Select *pnmh\code
        Case #NM_CUSTOMDRAW
          *LVCDHeader.NMLVCUSTOMDRAW = lParam
          Select *LVCDHeader\nmcd\dwDrawStage
            Case #CDDS_PREPAINT
              result = #CDRF_NOTIFYITEMDRAW
            Case #CDDS_ITEMPREPAINT
              row = *LVCDHeader\nmcd\dwItemSpec
              
              If row = rowcol
                *LVCDHeader\clrTextBk = #Black
                *LVCDHeader\clrText = #Green ;Text colour
              Else
                *LVCDHeader\clrTextBk = #Black
                *LVCDHeader\clrText = #White
              EndIf
              
              result = #CDRF_DODEFAULT
          EndSelect
      EndSelect
  EndSelect
  ProcedureReturn result
EndProcedure

OpenWindow(0, 0, 0, 640, 300, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SetWindowColor(0, RGB(0, 0, 0))
SetWindowCallback(@WinCallbackproc(), 0)
ExplorerListGadget(0, 0, 0, 640, 300, "*.mp3;*.ogg;*.wav", #PB_Explorer_BorderLess | #PB_Explorer_AutoSort)
SetWindowLongPtr_(GadgetID(0), #GWL_STYLE, GetWindowLongPtr_(GadgetID(0), #GWL_STYLE) | #LVS_NOCOLUMNHEADER)
SetGadgetColor(0, #PB_Gadget_FrontColor, RGB(255, 255, 255))
SetGadgetColor(0, #PB_Gadget_BackColor, RGB(0, 0, 0))
;SetGadgetAttribute(0, #PB_Explorer_DisplayMode, #PB_Explorer_List)
;SetGadgetItemAttribute(0, 0, #PB_Explorer_ColumnWidth, 300)

Repeat
  WindowEvent = WaitWindowEvent()
  
  Select WindowEvent
    Case #PB_Event_Gadget
      If EventGadget() = 0
        If GetGadgetState(0) = -1
          If DoubleClickReported = #False
            ;Debug "Double click on folder " + GetGadgetText(0)
            DoubleClickReported = #True
          Else
            DoubleClickReported = #False
          EndIf
        Else
          If EventType() = #PB_EventType_LeftDoubleClick
            ;Debug "Double click on filename " + GetGadgetItemText(0, GetGadgetState(0))
            RowCol = GetGadgetState(0)
          EndIf
        EndIf
      EndIf
      
  EndSelect
Until WindowEvent = #PB_Event_CloseWindow