"Chris Uppal" <
[hidden email]> wrote in message
news:4492ce5b$1$659$
[hidden email]...
> The following works in D5 but not in D6.
>
> m := ListModel on: ( #( nil ) , (1 to: 10) ).
> lp := ListPresenter show: 'Enhanced list view' on: m.
> c := lp view columnAtIndex: 1.
> c getTextBlock: [:it | it ifNil: ['this is nil']].
>
> The special text for the nil case is not displayed. Also in D5 the
> "radioactive" icon is displayed for the nil item, in D6 it is left blank.
>
Yes, I see the problem. Thanks for the report Chris.
#2157, patch below.
Regards
Blair
-----------------
ListView classPool at: 'UnknownItem' put: Object new!
!ListView methodsFor!
onDisplayDetailsRequired: lvitem
"Private - Get the display info for the receiver's row identified by the
<LVITEM>, lvitem."
"N.B. This is a callback request from the ListView's paint handler so
setting an
unconditional breakpoint in here may bring your image to its knees as the
LV repeatedly
attempts to paint a damaged region."
"Implementation Note: If in report mode then the task of supplying the
text/images is
delegated to the particular column, otherwise the valuables local to the
receiver are used.
This may seem inconsistent, but it allows different text/images to be
displayed for the
primary column if the application requires that the view be dynamically
switchable between
#report mode and the other modes."
| rowObject mask column columnIdx |
rowObject := self objectFromHandle: lvitem handle ifAbsent: [UnknownItem].
"List sometimes asks for lvitem we no longer have, answer nil to accept
default processing"
rowObject == UnknownItem ifTrue: [^nil].
self isReportMode
ifTrue:
[columnIdx := lvitem iSubItem + 1.
column := self columnAtIndex: columnIdx].
mask := lvitem mask.
"Image Request?"
(mask allMask: LVIF_IMAGE)
ifTrue:
[| imgIdx |
imgIdx := ((column notNil and: [self hasColumnImages]) ifTrue: [column]
ifFalse: [self])
imageFromRow: rowObject.
imgIdx notNil ifTrue: [lvitem image: imgIdx - 1]].
"Text request?"
(mask allMask: LVIF_TEXT)
ifTrue:
["If in report mode the column's get text block is used unless the
request
is for the primary column and its text block is nil, in which case the
view
level block is used"
lvitem
textInBuffer: (((column notNil and: [columnIdx > 1 or: [column
getTextBlock notNil]])
ifTrue: [column]
ifFalse: [self]) textFromRow: rowObject)].
(mask allMask: LVIF_INDENT)
ifTrue:
["Indenting is only supported for the whole row, not on a per-column
basis"
lvitem indent: (self indentFromRow: rowObject)].
^0 "suppress default processing"! !
!ListView categoriesFor: #onDisplayDetailsRequired:!event handling!private!
!