[fpc-pascal] Sets & FPC
Justin Smyth
delphian at smythconsulting.net
Sun Feb 21 07:26:25 CET 2010
I'm still getting the same errors
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>"
heres my code
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;
could it be how State is defined causing me the issue ?
Kind Regards
Justin Smyth
----- Original Message -----
From: "Michael Van Canneyt" <michael at freepascal.org>
To: "FPC-Pascal users discussions" <fpc-pascal at lists.freepascal.org>
Cc: "Justin Smyth" <delphian at smythconsulting.net>
Sent: Saturday, February 20, 2010 11:43 PM
Subject: Re: [fpc-pascal] Sets & FPC
>
>
> On Sat, 20 Feb 2010, Jonas Maebe wrote:
>
>>
>> On 20 Feb 2010, at 13:15, Michael Van Canneyt wrote:
>>
>>> On Sat, 20 Feb 2010, Justin Smyth wrote:
>>>
>>>> procedure TJvCustomListBox.CNDrawItem(var Msg: TWMDrawItem);
>>>> var
>>>> State: TOwnerDrawState;
>>>
>>> Try
>>>
>>> State : Set of TOwnerDrawState;
>>
>> It is already a set:
>>
>> lcltype.pp: TOwnerDrawState = set of TOwnerDrawStateType;
>
> Indeed.
>
> Well, the code as posted compiles fine here if I define
>
> TWMDrawItem = TLMDrawItems;
>
> Michael.
>
>
More information about the fpc-pascal
mailing list