Message methods with a string identifier work fine. Message methods with a string identifier appear not to work. The array of TMsgStrTable records have name variables which point to something other than the string identifier. The DispatchStr call does not call the message handler.
Mailing lists / fpc-devel / 2009-07
Message method with a string identifier
6 messages · 3 people · –
- DDon Whitbeck 3
- MMichael Schnell 2
- MMichael Van Canneyt 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Don Whitbeck wroteMessage methods with a string identifier work fine. Message methods with a string identifier appear not to work.
?????
-Michael
//Defining msg
Type
TMsg = record
MsgStr: string[20]; //Doesn't work
//MSGID: integer; // Works
Data: pointer;
end;TCustomSocket = Class(TObject)
...
Procedure MsgHandler(Var Msg: TMsg); Message 'OnAccept';
ASocket:=TCustomSocket.Create;
var
msg: TMsg;
....
msg.MsgStr := 'OnAccept';
msg.Data := PS; // Pointer to data
ASocket.dispatchStr(msg);Defining a message handler identified with an integer and calling with dispatch works.
For some reason I am not successful in defining a message handler identified with a string and calling it with dispatchstr.
am Michael Schnell wrote 9 lines
MsgStr: string[20]; //Doesn't work
I suppose the string reference counting deletes the string before the receiver gets the message.
-Michael
am Michael Schnell wrote 9 lines
Looking at the results of the StringMessageTable function and looking at the contents of the TMsgStrTable record, the name member seems to point to the wrong data, sometimes it contains the name of a declared procedure, sometimes it appears to be be binary data. I am assuming that these records are not being constructed properly by the compiler.
from objpash.inc
type TMsgStrTable = record
name: PShortString;
Message name
method: pointer;
Method to call
end;//Defining msg Type TMsg = record MsgStr: string[20]; //Doesn't work //MSGID: integer; …
Don Whitbeck wrote 26 lines
There is a bug, obviously the string dispatch table is not written to the assembler file. I created a bugreport.
Michael.
