[英]Rogue Wave Edit Box text
I want to check if the Text box has some text entered by the user but can't. 我想检查“文本”框中是否有用户输入的某些文本,但不能输入。 The statement below always returns false 以下语句始终返回false
if (MyLLVTextEdit->getMessage() == NULL)
{
MessageBox(NULL,"No Text", "no Text",NULL);
}
also tried 也尝试过
if (MyLLVTextEdit->getMessage() == "")
{
MessageBox(NULL,"No Text", "no Text",NULL);
}
if (MyLLVTextEdit->getValue() == NULL)
{
MessageBox(NULL,"No Text", "no Text",NULL);
}
if (MyLLVTextEdit->getValue() == "")
{
MessageBox(NULL,"No Text", "no Text",NULL);
}
Any ideas please? 有什么想法吗?
Don't familiar with your library, but you should use strcmp
function to compare strings (char*), to check if string is empty, you may call strlen
不熟悉您的库,但是您应该使用strcmp
函数比较字符串(char *),检查字符串是否为空,您可以调用strlen
strlen(MyLLVTextEdit->getMessage()) == 0
operator==
may be used only if you use some string classes like std::string
QString
or whatever 仅当您使用诸如std::string
QString
类的某些字符串类时,才可以使用operator==
What does getMessage() return? getMessage()返回什么? Very unlikely char*, as Rogue Wave has own unicode-capable string classes. char *不太可能使用,因为Rogue Wave具有自己的支持Unicode的字符串类。
If it a kind of a Rogue Wave string-class, check if there is a method for testing the content for emptiness. 如果是Rogue Wave字符串类,请检查是否有一种方法可以测试内容是否为空。
Probably you should use something like: 可能您应该使用类似:
if (MyLLVTextEdit->getMessage().isNull() )
or 要么
if (MyLLVTextEdit->getMessage().isEmpty() )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.