[Lazarus] Listbox / focusRect (Mac)

Mirko Rizman adc at mail.inet.hr
Fri Oct 30 19:08:39 CET 2015


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-ide.org/pipermail/lazarus/attachments/20151030/b2f98837/attachment-0002.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-ide.org/pipermail/lazarus/attachments/20151030/b2f98837/attachment-0004.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-ide.org/pipermail/lazarus/attachments/20151030/b2f98837/attachment-0005.png>


More information about the Lazarus mailing list