From: Lucress Carol on
Hi everyone,

For test purposes I've created an MFC dialog based application in
which
by clicking on a button(Load-Button) I should be able to load an
image.Everything works
fine except the Edit Control on my Dialog.
Before loading an image one should read in the Edit Control:"No Image
loaded"
( m_EditState.ReplaceSel("No image loaded"); m_EditState is the member
variable associated to the Edit Contol)
By clicking on the Load-Button the message "No image loaded" should be
replaced by:
"Loading Image".The problem is that instead of "Loading Image" I'm
having
"No Image loaded Loading Image".I tried to use the member CEdit
functions
Clear() and Undo() and I didn't notice any difference.
Could someone give me a hint how to fix this problem?

Thank you

Lucress
From: M. Shoaib Surya on
If all what you want is to set the text in the Edit Control, use
SetWindowText member function to do it, i.e. the following two distinct
lines of code where you want to set the respective status.

m_EditState.SetWindowText("No image loaded");
m_EditState.SetWindowText("Loading image");

Regards,
Shoaib.

"Lucress Carol" <incognito.me(a)gmx.de> wrote in message
news:fedca408-8fc0-4376-86aa-6167fc3d707b(a)d77g2000hsb.googlegroups.com...
> Hi everyone,
>
> For test purposes I've created an MFC dialog based application in
> which
> by clicking on a button(Load-Button) I should be able to load an
> image.Everything works
> fine except the Edit Control on my Dialog.
> Before loading an image one should read in the Edit Control:"No Image
> loaded"
> ( m_EditState.ReplaceSel("No image loaded"); m_EditState is the member
> variable associated to the Edit Contol)
> By clicking on the Load-Button the message "No image loaded" should be
> replaced by:
> "Loading Image".The problem is that instead of "Loading Image" I'm
> having
> "No Image loaded Loading Image".I tried to use the member CEdit
> functions
> Clear() and Undo() and I didn't notice any difference.
> Could someone give me a hint how to fix this problem?
>
> Thank you
>
> Lucress


From: Giovanni Dicanio on

"M. Shoaib Surya" <shoaibsurya(a)hotmail.com> ha scritto nel messaggio
news:%23%23mRGqCsIHA.1768(a)TK2MSFTNGP03.phx.gbl...

> m_EditState.SetWindowText("No image loaded");
> m_EditState.SetWindowText("Loading image");

Those strings should be decorated with _T():

...SetWindowText( _T("Something...") );

Giovanni



From: Giovanni Dicanio on

"Giovanni Dicanio" <giovanni.dicanio(a)invalid.com> ha scritto nel messaggio
news:%23rD6RuCsIHA.2208(a)TK2MSFTNGP04.phx.gbl...
>
> "M. Shoaib Surya" <shoaibsurya(a)hotmail.com> ha scritto nel messaggio
> news:%23%23mRGqCsIHA.1768(a)TK2MSFTNGP03.phx.gbl...
>
>> m_EditState.SetWindowText("No image loaded");
>> m_EditState.SetWindowText("Loading image");
>
> Those strings should be decorated with _T():
>
> ...SetWindowText( _T("Something...") );

BTW: I would prefer reading these strings from a string table resource.
That works better for localization (instead of having string literals inside
the source code).

Giovanni



From: Lucress Carol on
On 7 Mai, 12:18, "Giovanni Dicanio" <giovanni.dica...(a)invalid.com>
wrote:
> "Giovanni Dicanio" <giovanni.dica...(a)invalid.com> ha scritto nel messaggionews:%23rD6RuCsIHA.2208(a)TK2MSFTNGP04.phx.gbl...
>
>
>
> > "M. Shoaib Surya" <shoaibsu...(a)hotmail.com> ha scritto nel messaggio
> >news:%23%23mRGqCsIHA.1768(a)TK2MSFTNGP03.phx.gbl...
>
> >> m_EditState.SetWindowText("No image loaded");
> >> m_EditState.SetWindowText("Loading image");
>
> > Those strings should be decorated with _T():
>
> > ...SetWindowText( _T("Something...") );
>
> BTW: I would prefer reading these strings from a string table resource.
> That works better for localization (instead of having string literals inside
> the source code).
>
> Giovanni


Thank you Guys for your help and advice.

I also found out that with VC++ 2008 either one uses this _T() or
changes the project configuration to use multibyte strings like this:
Open the properties and navigate to Configuration Properties >
General.
And then switch Character Set to "Use Multi-Byte Character Set".


Lucress