Hola gente
Finalmente me entero de como dibujar un rectangulo sobre el item.
El tema es que, no funcionaba porque customDrawBlock, solo se activa cuando
esta en estado CDDS_PREPAINT.
Cual sería la forma correcta de implementar CDDS_POSTPAINT en el ListView ?
Podría hacer una subclase ? algo así:
CustomListView>>nmCustomDraw: pNMHDR
"Private - Handle a NM_CUSTOMDRAW notification message."
"Implementation
Note: Defer creating the header struct as long as possible to avoid impacting
draw speed too much as this message can be sent several times per sub-item."
| context drawStage res |
context := self customDrawContextClass fromAddress: pNMHDR.
drawStage := context dwDrawStage.
((drawStage allMask: 2) and: [drawStage < 65536 "NOT CDDS_ITEM"])
ifTrue:
[
"Aca pongo algo que haga lo que quiero !"
self ensureSelectionAlwaysVisible: context
].
^CDRF_DODEFAULT]. "CDDS_POSTPAINT"
res := super nmCustomDraw: pNMHDR.
"Request postdraw notification for the above"
^((drawStage
allMask: CDDS_PREPAINT) and: [drawStage < 65536 "NOT CDDS_ITEM"])
ifTrue: [res | 16r10 "CDRF_NOTIFYPOSTPAINT"]
ifFalse: [res]
Esto anda . Pero tengo otro problema más extraño.
Este es el código para manejar lo que quiero :
CustomListView>> ensureSelectionAlwaysVisible: aContext
"Ensure the selection always visible in the receiver"
| aRectangle aCanvas index aBitmap |
self hasFocus
ifFalse:
[self hasSelection
ifTrue:
[index := self selectionByIndex.
aRectangle := (self itemRect: index) subtract: (self
itemRect: index textOnly: true).
aCanvas := aContext canvas.
aBitmap := Bitmap compatible: aCanvas extent: self
largeIconExtent.
aBitmap canvas fillRectangle: aRectangle color: Color
highlight.
aBitmap
alphaBlendOn: aCanvas at: aRectangle origin + 2;
free]]
El problema es que solo pinta del color #highlight el primer item.
Luego pinta de negro los demas items !!.
El tema es que el aBitmap, luego de hacer #fillRectangle:color: , siempre queda
de color negro !!!
No importa el color que le quiera setear, siempre es negro luego del primer
item !
Alguna idea de que puede pasar ?
saludos kiko
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
http://www.clubSmalltalk.org