[fpc-pascal] Message methods with string identifier

Leonardo Cecchi leonardoce at interfree.it
Wed Aug 13 08:45:36 CEST 2008


Hi,

I've some problems with message methods with string identifiers: the
DispatchStr method in the TObject class seems not to be working.
For example I have:

TMsg = record
 messageName:String[200];
 messageValue:integer;
end;

TTestMessages = class(TObject)
 ...
 procedure OnClick(var msg:TMsg); message 'OnClick';
 ...
end;

But when I do:

procedure TTestMessages.TestStr();
var
 msg:TMsg;
begin
 msg.messageName:='OnClick';
 ...
 DispatchStr(msg);
end;

The "OnClick" procedure it's not being called. With cardinal
identifiers it's all working. I've tried with FPC 2.2.0, 2.2.2 and
attached an example program.
Reading and trying the implementation of the DispatchStr method I've
found that the "name" field of the MsgStrTable seems not to be filled.
Probably I haven't understood the behaviour of something.
Where I'm wrong?
Thanks in advance,

Leonardo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testmessaggi.pas
Type: application/octet-stream
Size: 628 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20080813/7fab63aa/attachment.obj>


More information about the fpc-pascal mailing list