Unknown directive: 'message'

Giganews Newsgroups
Subject: Unknown directive: 'message'
Posted by:  Graham A Welsh (graham.wel…@targeted-software-solutions.limited.uk)
Date: 30 Mar 2006

I don't seem to be able to get a shared unit to work properly. I would
like to share procedures, functions, variables etc between projects and
the unit will not compile giving the error "Unknown directive:
'message'". Compilation aborts on the procedure line immediately after
declaration of the const.

Everything works as expected when used in a Form based unit. I have
already tried copying the entire uses clause from the working Form
based unit to the shared unit, but, it still won't compile.

I'll be obliged for any ideas as to what I'm doing wrong here.

unit tssglbl;

interface

uses
  Messages, cxEdit;

const
  CM_NEEDVALIDATE = WM_USER + 1002;

    procedure CMNeedValidate(var Msg: TMessage); message
CM_NEEDVALIDATE;

// var

implementation

type TcxCustomEditAccess = class(TcxCustomEdit);

procedure CMNeedValidate(var Msg: TMessage);
begin
  if TObject(Msg.WParam) is TcxCustomEdit then
    with TcxCustomEditAccess(Msg.WParam) do
    begin
      DoEditing;
      ModifiedAfterEnter := True;
    end;
end;

end.

--
Graham A Welsh
Targeted Software Solutions Ltd
To reply change 'limited' to 'ltd' in email address

Replies