Rogue Wave Edit Box text

109 Views Asked by At

I want to check if the Text box has some text entered by the user but can't. The statement below always returns 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?

2

There are 2 best solutions below

0
On BEST ANSWER

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

strlen(MyLLVTextEdit->getMessage()) == 0

operator== may be used only if you use some string classes like std::string QString or whatever

0
On

What does getMessage() return? Very unlikely char*, as Rogue Wave has own unicode-capable string classes.

If it a kind of a Rogue Wave string-class, check if there is a method for testing the content for emptiness.

Probably you should use something like:

if (MyLLVTextEdit->getMessage().isNull() )

or

if (MyLLVTextEdit->getMessage().isEmpty() )