Sign in Join

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

Mailing lists / lazarus / 2015-10

Listbox / focusRect (Mac)

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

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

Mirko Rizman

Hi folks,

I have a listbox with multicolor (background) for items. That is fine and working. Also when itemIndex is changed i draw a rect (FillRect) and selected item receives a focus, that is fine also. What isn't is that there is also a hollow rectangle on selected item and that is the one i would like to remove or paint in Fillrect color if possible so it isn't visible.

look at attached picture, that gray rectangle is what i would like to remove somehow.

... i looked at some Delphi questions for the same thing and it mentioned that the value for that particular focus rect is XORed on original FillRect color, if i understood articles correctly. But i can't figure out how to turn it off in Lazarus.

i tried this also, and it doesn?t work as it should:

procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
  ARect: TRect; State: TOwnerDrawState);
begin
  with ListBox1.Canvas do begin
    if odFocused in State then
      Brush.Color := clHighlight else
      Brush.Color := clWindow;
    FillRect(ARect);
    TextOut(ARect.left, ARect.Top, Listbox1.Items[Index]);
    if odFocused in State then
      DrawFocusRect(ARect);
  end
end;

this is a result, no joy:

ListBox.Style is set lbOwnerDrawVariable

If you could land a hand please?

M.

I am running Lazarus #:1.4.4 FPC 2.6.4 i386-darwin-carbon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151030/b2f98837/attachment-0001.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: example.png
Type: image/png
Size: 20947 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151030/b2f98837/attachment-0002.png> -------------- next part --------------
A non-text attachment was scrubbed...
Name: example2.png
Type: image/png
Size: 5371 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151030/b2f98837/attachment-0003.png>

Reply by email