Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

List views help

38 views
Skip to first unread message

Jeff Williams

unread,
Apr 24, 2003, 7:09:56 PM4/24/03
to
I would like to change the background colour or a row in a list view.

How can I achieve using a standard listview control - I do not wish to use
bBrowser.


Regards

Jeff


Amilcar A. Camargo

unread,
Apr 24, 2003, 10:20:34 PM4/24/03
to
Hi Jeff,

For a good explanation and samples go to Michael Ferber page:

http://ourworld.compuserve.com/homepages/ferbermichael/

and click on the CA-Visual Objects link, where you will find
'OwnerDraw' and 'CustomDraw'. Follow this link...

HTH,

Amilcar A. Camargo F.
Sand, S. A.
Guatemala, C. A.

(pls remove leading underscore to e-mail)

Geoff Schaller

unread,
Apr 25, 2003, 12:54:34 AM4/25/03
to
> How can I achieve using a standard listview control - I do not wish to use
> bBrowser.

Why not? Its vastly superior. Vastly!


Rob Panosh

unread,
Apr 25, 2003, 9:04:49 AM4/25/03
to
Goeff,

You must have some sort of stock in bBrowser.

Rob

"Geoff Schaller" <geof...@bigpond.net.au> wrote in message
news:ec3qa.9949$8K2....@news-server.bigpond.net.au...

Rob Panosh

unread,
Apr 25, 2003, 9:08:11 AM4/25/03
to
Jeff,

Here is how to set the background color of the listview:

SendMessage( SELF:oDCListView:Handle() , LVM_SETBKCOLOR , 0 , LONG ( _CAST,
RGB( SELF:oBackColor:Red, SELF:oBackColor:Green, SELF:oBackColor:Blue ) ) )

Here is how to set the color of Individual items:

METHOD ControlNotify( oEvent ) CLASS FormPropertyLegends_STD
LOCAL pNMCustomDraw AS _WINNMLVCUSTOMDRAW
//
//s
//
// REP: 02.11.2003 - Created.

SUPER:ControlNotify( oEvent )

IF (oEvent:NotifyCode = NM_CUSTOMDRAW)

// Take the default processing unless we set this to something else below.
SELF:EventReturnValue := CDRF_DODEFAULT


pNMCustomDraw := PTR( _CAST , oEvent:lParam )

// First thing - check the draw stage. If it's the control's prepaint
stage,
// then tell Windows we want messages for every item.

IF (pNMCustomDraw.nmcd.dwDrawStage == CDDS_PREPAINT)

SELF:EventReturnValue := CDRF_NOTIFYITEMDRAW

// ELSEIF (pNMCustomDraw.nmcd.dwDrawStage == CDDS_ITEMPREPAINT )
// This is the notification message for an item. We'll request
// notifications before each subitem's prepaint stage.
// SELF:EventReturnValue := CDRF_NOTIFYITEMDRAW // CDRF_NOTIFYSUBITEMDRAW
// Tone( 500, 1 )


ELSEIF LOGIC( _CAST, _Or( pNMCustomDraw.nmcd.dwDrawStage,
CDDS_ITEMPREPAINT, CDDS_SUBITEM ) )

// This is the prepaint stage for a subitem. Here's where we set
the
// item's text and background colors. Our return value will tell
// Windows to draw the subitem itself, but it will use the new
colors
// we set here.

IF _and( pNMCustomDraw.nmcd.uItemState, CDIS_SELECTED ) <> 0
pNMCustomDraw.clrText := RGB( 0, 0, 0 )
pNMCustomDraw.clrTextBk := RGB( 0, 0, 0 )
ELSE
// Set the column text color.
pNMCustomDraw.clrText := RGB( 255, 0, 0 )

// Set the column background color.
pNMCustomDraw.clrTextBk := RGB( 0, 0, 0 )
ENDIF

// Tell Windows to paint the control itself.
SELF:EventReturnValue := CDRF_NOTIFYITEMDRAW // CDRF_DODEFAULT

ENDIF

ENDIF


RETURN


Hope this helps.

Cheers,
Rob Panosh


"Jeff Williams" <jeff.w...@NO-SPAM.hardsoft.com.au> wrote in message
news:3ea86...@news.iprimus.com.au...

Geoff Schaller

unread,
Apr 26, 2003, 2:23:46 AM4/26/03
to
...yep... and this is one of the reasons I moved to bBrowser. Here is the
bBrowser equivalent:

oBrowser:Background := Color{250,0,120}
...and conditional colouring is just two more lines.

<g>

"Rob Panosh" <rob_p...@asdsoftware.com> wrote in message
news:3ea93fef$1...@news.splitrock.net...

Geoff Schaller

unread,
Apr 26, 2003, 2:24:38 AM4/26/03
to
Nope - just a realist.

When I dealt with ListViews, I called myself a masochist <g>.

"Rob Panosh" <rob_p...@asdsoftware.com> wrote in message

news:3ea93f25$1...@news.splitrock.net...

Igor Kaliniak

unread,
Apr 26, 2003, 5:21:45 AM4/26/03
to
>
> When I dealt with ListViews, I called myself a masochist <g>.
>

My home is not far from house, where Leopold von Sacher-Masoch was born. Now I
know why I'm still using listview.<g>


Geoff Schaller

unread,
Apr 26, 2003, 11:52:45 PM4/26/03
to
<BG>


"Igor Kaliniak" <rem_i...@gal.ukrpack.net> wrote in message
news:3eaa5...@news.ukrpack.net...

Guy Deprez

unread,
Apr 29, 2003, 12:44:43 PM4/29/03
to
The Listview Class (surely in VO 2.6) provides...:
ASSIGN BackgroundColor(oBackgroundColor) CLASS ListView
Guy Deprez.

Geoff Schaller

unread,
Apr 30, 2003, 9:09:36 AM4/30/03
to
No - that doesn't solve the colour of the background of the items <g>.


"Guy Deprez" <DPZ...@attglobal.net> wrote in message
news:3ead6b6f...@32.112.2.68...

Saulo Rodrigues

unread,
Apr 30, 2003, 10:18:16 AM4/30/03
to
Hi,

Backgound color of the ListView text items? so easy! :-)

ListView:TextBackgroundColor Access/Assign

Description:

A Color object used to paint the text background in the list view.

Best Regards,
Saulo
Rio - Brazil


Geoff Schaller

unread,
May 3, 2003, 12:51:35 AM5/3/03
to
ok, so there are no problems and that is why Rob Panosh doesn't really need
all that code he posted and that is why the question wasn't asked in the
first place <g>.

Geoff

(PS ...and we used the same code Rob did for treeviews and listviews)


"Saulo Rodrigues" <saulo...@joaofortes.com.br> wrote in message
news:b8olsn$bedop$1...@ID-149048.news.dfncis.de...

0 new messages