realbasic-nug.de
[Top] [All Lists]

Re: Cellbackgroundpaint

To: REALbasic NUG German <realbasic-nug dot de at lists dot realsoftware dot com>
Subject: Re: Cellbackgroundpaint
From: "J. Van Loon" <cdr_spock at yahoo dot com>
Date: Thu, 22 Sep 2005 14:44:50 -0700 (PDT)
Delivered-to: realbasic-nug dot de at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=RUZMSaVpXzE3H8XrrfxZd8XmNIeXigXHyXE42sLEOz+m9nsm/WlzI5VbOBI/2UpgKdpxS+Whr1BEptOUTq2D4hmFxOMIRaRcuVpOWOmh/cSNpBtxfPiOVLJDQJjmv6D5PlNfxioH3xptyWILkPAtTCFqGkzxowPSLMo6DNzkQ0o= ;
--- Marco Weinrich <m dot a dot r dot c dot o at quartnet dot de> wrote:

> >
> > Auch ein listbox.refresh sollte helfen. Einfach
> als letztes in den
> > Action-Event des Buttons schreiben.
> >
> > MfG, Metti.
> >
> 
> Ne, klappt leider nicht. Ist für euch wahrscheinlich
> simpel, aber ich  
> möchte einfach vorher per array bestimmen, welche
> Zeilen ich einfärbe  
> und dann per Button auf einmal einfärben. Ich steh
> da irgendwie auf  
> dem Schlauch...

Am einfachsten würde es gehen, wenn du jeweils im
CellBackgroundPaint anhand des Listbox-Inhalts
bestimmst, ob die Zelle gefärbt werden soll, denn
CellBackgroundPaint wird ja für jede Zelle aufgerufen
und bekommt deren "Position" ja auch als Parameter
übermittelt. Das würde auch den Button überflüssig
machen und die Zelle wird automatisch neu gezeichnet,
wenn die Listbox neu gezeichnet werden muss (z.B. beim
Scrollen oder nachdem das Fenster verdeckt war und
wieder aktiviert wird).

z.B. so (Pseudo-Code):
Function CellBackgroundPaint(g as Graphics, Row as
Integer, Column as Integer) As Boolean
    if cell(row, column) = GewuenschterWert then
        g.forecolor = rgb(255,0,0)
        g.fillRect(0,0,g.width,g.height)
    end
End Function

Allerdings muss man beachten, dass ab RB 2005 das
Event nicht nur für die "belegten" oder
"existierenden" Zeilen, sondern für alle Zeilen
ausgelöst wird: 
"Also, as of REALbasic 2005 the CellBackGroundPaint
event will fire for all cells. This change finally
allows you to paint alternating rows even if a listbox
isn't completely full.  In the rare case where you
have used 'cell' or 'celltag' in this event you now
need to check that the row and column are in bounds
before accessing these properties." (Quelle: Important
changes for 5.5 projects.txt)



Grüsse,
Jef
 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

<Prev in Thread] Current Thread [Next in Thread>