如何更改 OMNeT++ 中消息的外观?

How do I change the appearance of messages in OMNeT++?

手册中是这样说的:

To customize the appearance of messages in the graphical runtime environment, override the getDisplayString() method of cMessage or cPacket to return a display string.

我不明白这是什么意思。我有自定义图像,我可以在我的简单模块中使用下面的行更改节点的图标。

@display("i=misc/train-stationCopy");

我的消息中包含以下行 class 但它不起作用并生成错误

@display("i=misc/train");

我错过了什么?对不起,我是 omnet++ 和 c++ 的新手。

将此添加到您的 .msg 文件中。这将在 *_msg.h 文件中强制生成 getDisplayString() 函数。

const string displayString @override = "i=misc/train";