Page 1 of 1

Posted: Thu Feb 20, 2003 5:30 am
by BackupUser
Restored from previous forum. Originally posted by ricardo.

hI,

I am using the excelent Danilo's code for colored ListView, but when i add #LBS_EXTENDEDSEL for letting the user multiselect the listview dosent repaint properly, the same problem with a image as background of the listview.

Here is the code (Its Danilo's just with the #LBS_EXTENDEDSEL added)

Code: Select all

hWnd = OpenWindow(1,10,10,300,300,#PB_Window_SystemMenu,"TEST")

CreateGadgetList(hWnd)

listview = ListViewGadget(3,10,10,280,280,#LBS_EXTENDEDSEL)

For a = 1 To 10

AddGadgetItem(3,-1,"COOOOOOL")

Next a

ColorBrush = CreateSolidBrush_(RGB($00,$00 ,$00))            ; BACKGROUND
;ColorBrush = CreatePatternBrush_(LoadImage(1,"MY.BMP"))
;---

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_EventCloseWindow

;---

DeleteObject_(ColorBrush)
I tried many ways to avoid it but can't find the solution (i only need this and my app is finished!!!)



Best Regards

Ricardo

Dont cry for me Argentina...

Posted: Thu Feb 20, 2003 7:44 pm
by BackupUser
Restored from previous forum. Originally posted by Denis.

>>> listview = ListViewGadget(3,10,10,280,280,#LBS_EXTENDEDSEL)


Hi Ricardo,

according documentation, listview has only 5 parameters, not 6. :)


Try with GetwindowLong and SetwindowLong API to add style or extended style.


Denis

Posted: Thu Feb 20, 2003 8:31 pm
by BackupUser
Restored from previous forum. Originally posted by ricardo.
according documentation, listview has only 5 parameters, not 6. :)
Try with GetwindowLong and SetwindowLong API to add style or extended style.
Hi Denis,

I know, but when i type it i can see in the status bar of the editor a [,Flags] so i decide to test and it accept it.
Using Get & SetWindowLong_ dosent works.

However, i notice that the problem is with the 'repaint'. I mean, when the ListView adds the items, then the gadget get repainted and for some reason the background color goes to white again so i lost the call to change the background... thats why it fails.

What i need to know is how to repaint it again every time i add new items to ListView.

Thanks



Best Regards

Ricardo

Dont cry for me Argentina...