Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-08

Message methods with string identifier

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Leonardo Cecchi

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