Page 1 of 1

Colored ListView

Posted: Wed Jun 26, 2002 4:55 pm
by BackupUser
Code updated for 5.20+

Restored from previous forum. Originally posted by Danilo.

I like it this way... with black background and yellow font.

Code: Select all

OpenWindow(1,10,10,300,300,"TEST",#PB_Window_SystemMenu)
listview = ListViewGadget(3,10,10,280,280)
For a = 1 To 10
  AddGadgetItem(3,-1,"COOOOOOL")
Next a
ColorBrush = CreateSolidBrush_(RGB($00,$00 ,$00))            ; BACKGROUND

;---
Procedure mycallback(hWnd, Message, wParam, lParam)
  Shared ColorBrush
  RetValue = #PB_ProcessPureBasicEvents
  Select Message
    Case #WM_CTLCOLORLISTBOX
      SetTextColor_(wParam,RGB($FF,$FF,$00))                ; FOREGROUND
      SetBkMode_(wParam, #TRANSPARENT)
      RetValue = ColorBrush
  EndSelect
  ProcedureReturn RetValue
EndProcedure
SetWindowCallback(@mycallback())
;---

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

;---
DeleteObject_(ColorBrush)
Just change the 2 RGB values to fit your needs.

cya,
...Danilo

(registered PureBasic user)

Posted: Wed Jun 26, 2002 5:51 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.

And if you change the line

Code: Select all

   ColorBrush = CreateSolidBrush_(RGB($00,$00 ,$00))
to

Code: Select all

   ColorBrush = CreatePatternBrush_(LoadImage(1,"MY.BMP"))
you can use images for the ListViewGadget Background.

Have fun,
...Danilo

(registered PureBasic user)

Posted: Wed Jun 26, 2002 7:42 pm
by BackupUser
Restored from previous forum. Originally posted by tranquil.

Very nice x-ample Danilo! Thanks a lot!

Mike

Tranquilizer/ Secretly!
Registred PureBasic User

Posted: Wed Jun 26, 2002 11:41 pm
by BackupUser
Restored from previous forum. Originally posted by MrVainSCL.
Danilo wrote
I like it this way... with black background and yellow font.
Hi Danilo
As i said to you on the #purebasic channel its easy, hehe... I have posted the documentation about that stuff to this forum too, so everybody can read about that stuff :wink:



PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten

Posted: Thu Jun 27, 2002 5:51 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.

LOL @ MrVain - the PB-Hero

Posted: Thu Jun 27, 2002 3:03 pm
by BackupUser
Restored from previous forum. Originally posted by TronDoc.
MrVainSCL
As i said to you on the #purebasic channel its easy, hehe... I have posted the documentation about that stuff to this forum too, so everybody can read about that stuff :wink:
where did you post the docs?

elecTRONics DOCtor
{registeredPB}P150 32Mb w98/DOS/Linux NO DirX NO IE :wink: