[fpc-pascal] Sets & FPC

Justin Smyth delphian at smythconsulting.net
Sat Feb 20 12:59:43 CET 2010


procedure TJvCustomListBox.CNDrawItem(var Msg: TWMDrawItem);
var
  State: TOwnerDrawState;
begin
  with Msg.DrawItemStruct^ do
  begin
    State := TOwnerDrawState(word(itemState and $FFFF));
    Canvas.Handle := hDC;
    Canvas.Font := Font;
    Canvas.Brush := Brush;
    if Integer(itemID) >= 0 then
    begin
      if (odSelected in state) then
      begin
        Canvas.Brush.Color := FSelectedColor;
        Canvas.Font.Color := FSelectedTextColor;
      end;
      if (([odDisabled, odGrayed] * State) <> []) or not Enabled then
        Canvas.Font.Color := FDisabledTextColor;
    end;
    if Integer(itemID) >= 0 then
      DrawItem(itemID, rcItem, State)
    else
    begin
      if Background.DoDraw then
      begin
        Perform(WM_ERASEBKGND, Canvas.Handle, 0);
        if (odFocused in State) then
          DrawFocusRect(hDC, rcItem);
      end
      else
      begin
        Canvas.FillRect(rcItem);
        if odFocused in State then
          DrawFocusRect(hDC, rcItem);
      end;
    end;
    Canvas.Handle := 0;
  end;
end;

----- Original Message ----- 
From: "Jonas Maebe" <jonas.maebe at elis.ugent.be>
To: "Justin Smyth" <delphian at smythconsulting.net>; "FPC-Pascal users 
discussions" <fpc-pascal at lists.freepascal.org>
Sent: Saturday, February 20, 2010 10:39 PM
Subject: Re: [fpc-pascal] Sets & FPC



On 20 Feb 2010, at 12:32, Justin Smyth wrote:

> Opps re reading the code it was actually
>
> if (odSelected in State)  then
>
> and state is defined as TOwnerDrawState which points back 
> to -TBaseOwnerDrawState which is a set of TOwnerDrawStateType

Please post sample code that should compile and that demonstrates the 
problem.


Jonas





More information about the fpc-pascal mailing list