Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-09

Brush color on TListView

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alexsander Rosa

I was using a TStringGrid to show some data but I need the "non-linear multi-select" from TListView.
However, the tricks to set Brush color inside of OnCustomDraw or OnAdvancedCustomDraw do not work.
Am I missing something? How is it done?

Atenciosamente, Alexsander da Rosa -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120912/de2261a2/attachment.html>

Reply by email

Kaj Mikkelsen
to Alexsander Rosa

Try using the PrepareCanvas event.

Something loke:

procedure TArpDatForm.SG1PrepareCanvas(sender: TObject; aCol, aRow: Integer;
  aState: TGridDrawState);
Var
  St:String;
begin
  SG1.Canvas.brush.color := clWhite;
  If aCol = 4 Then
  Begin
    St := SG1.Cells[4,arow];
    St := Copy(St,1,pos('.',st)-1);
    If (SG1.Cells[3,aRow]  St) Then
    Begin
      SG1.Canvas.Brush.color := clRed;
    end;
  End;
end;
Earlier message 26 lines
From: Alexsander Rosa [mailto:] Sent: 12. september 2012 22:34 To: Lazarus mailing list Subject: [Lazarus] Brush color on TListView I was using a TStringGrid to show some data but I need the "non-linear multi-select" from TListView. However, the tricks to set Brush color inside of OnCustomDraw or OnAdvancedCustomDraw do not work. Am I missing something? How is it done? -- Atenciosamente, Alexsander da Rosa -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120913/48b6855a/attachment-0001.html>

Reply by email

Benito van der Zander
to Alexsander Rosa: I was using a TStringGrid to show some data but I need the "non-linear multi-select" from…
However, the tricks to set Brush color inside of OnCustomDraw or OnAdvancedCustomDraw do not work. Am I missing something? How is it done?

You cannot do that.
And even if you get it working with one widgetset, it would fail on any other OS, since they all draw it differently.

I ended up writing my own list view
(http://www.benibela.de/components_en.html#treelistview), just to get differently colored rows

Or you can stay with the grid and implement your own selection (http://www.lazarus.freepascal.org/index.php?topic=7981.0)

Benito

Alexsander Rosa wrote 18 lines
I was using a TStringGrid to show some data but I need the "non-linear multi-select" from TListView. However, the tricks to set Brush color inside of OnCustomDraw or OnAdvancedCustomDraw do not work. Am I missing something? How is it done? -- Atenciosamente, Alexsander da Rosa -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120913/e3bbf66c/attachment-0001.html>

Reply by email

Alexsander Rosa
to Benito van der Zander

2012/9/13 Benito van der Zander

Show quoted text 6 lines
I ended up writing my own list view ( http://www.benibela.de/components_en.html#treelistview), just to get differently colored rows

May we use your component on a proprietary software?

Atenciosamente, Alexsander da Rosa -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120913/e209eb52/attachment.html>

Reply by email

Benito van der Zander
to Alexsander Rosa
Alexsander Rosa wrote 11 lines
2012/9/13 Benito van der Zander < <mailto:>> I ended up writing my own list view (http://www.benibela.de/components_en.html#treelistview), just to get differently colored rows May we use your component on a proprietary software?

Good question.

Not unconditonally for all of them, that's why it's gpled

But at least if it benefits humanity, you can just go ahead and use it...

Benito
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120914/6782e58a/attachment.html>

Reply by email

Alexsander Rosa
to Benito van der Zander: You cannot do that. And even if you get it working with one widgetset, it would fail on…

I'm using treelistview from Benibela (GTK2). I have some questions:
- How to set the SelectedFont background color? SelectedFont.Color sets only the "pen" color, not the "brush" color
- How to use the OnCustomRecordItemDraw to set a line's background color depending on its content ?

2012/9/13 Benito van der Zander

Show quoted text 18 lines
However, the tricks to set Brush color inside of OnCustomDraw or OnAdvancedCustomDraw do not work. Am I missing something? How is it done? You cannot do that. And even if you get it working with one widgetset, it would fail on any other OS, since they all draw it differently. I ended up writing my own list view ( http://www.benibela.de/components_en.html#treelistview), just to get differently colored rows Or you can stay with the grid and implement your own selection (http://www.lazarus.freepascal.org/index.php?topic=7981.0)
Atenciosamente, Alexsander da Rosa -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20121016/a97b3b0f/attachment.html>

Reply by email