[fpc-pascal] Sets & FPC

Justin Smyth delphian at smythconsulting.net
Sun Feb 21 13:20:09 CET 2010


The orginal code comes from JVCL , which wont complile under FPC , the 
actual unit is jvlistbox.pas

I have since looked at CustomListBox.inc and made a few change , basically 
not copying ItemState to a variable but directly doing the checking agaist 
it

procedure TJvCustomListBox.CNDrawItem(var Msg: TLMDrawListItem);
begin
  with Msg.DrawListItemStruct^ do
  begin
    Canvas.Handle := hDC;
    Canvas.Font := Font;
    Canvas.Brush := Brush;
    if Integer(itemID) >= 0 then
    begin
      if odSelected in ItemState then
      begin
        Canvas.Brush.Color := FSelectedColor;
        Canvas.Font.Color := FSelectedTextColor;
      end;
      if (([odDisabled, odGrayed] * ItemState) <> []) or not Enabled then
        Canvas.Font.Color := FDisabledTextColor;
    end;
    if Integer(itemID) >= 0 then
      DrawItem(ItemID, Area, ItemState)
    else
    begin
      if Background.DoDraw then
      begin
        Perform(WM_ERASEBKGND, Canvas.Handle, 0);
        if odFocused in ItemState then
          DrawFocusRect(hDC, Area);
      end
      else
      begin
        Canvas.FillRect(Area);
        if odFocused in ItemState then
          DrawFocusRect(hDC, Area);
      end;
    end;
    Canvas.Handle := 0;
  end;
end;


On DrawItem i get this error

Error: Incompatible type for arg no. 3: Got "TBaseOwnerDrawState", expected 
"TOwnerDrawState"

I'm Using FPC 2.2.4 & Lazarus X64 9.28.2 ( this is the only one i can debug 
with in X64).








Kind Regards




----- 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: Sunday, February 21, 2010 8:11 PM
Subject: Re: [fpc-pascal] Sets & FPC



On 21 Feb 2010, at 07:26, Justin Smyth wrote:

> I've done the bit Micheal suggest now which i highlight TWMDrawItem it 
> says its comes from TLMDrawItems.
>
> i still get Error: Incompatible types: got "TOwnerDrawStateType" expected 
> "<enumeration type>"

Can you post the full program somewhere? (or the full sources to another, 
smaller, program that demonstrates the same problem)


Jonas





More information about the fpc-pascal mailing list