|
SetWindowText() is a class member of CWnd and so will work for any window, including dialogs & propertysheets.
|
|
|
|
|
|
Do you mean it wont compile or nothing happens when the code executes?
Can you show your code fragment.
SetWindowText() is the correct method to use, there must be something else wrong.
|
|
|
|
|
It gives me an Unhandled exception....see code below and remember that my environment is net 7.1, MFC.
void SystemAlign::OnBnClickedOk()
{
GetDlgItem(IDD_SYSTEM_ALIGN)->SetWindowText("Junk One");
//CPropertySheet mySheet;
//mySheet.SetTitle("System: Signal-To-Noise", 0);
//mySheet.DoModal();
}
|
|
|
|
|
C++NewBe wrote:
GetDlgItem(IDD_SYSTEM_ALIGN)->SetWindowText("Junk One");
Going this route, you'd need to call SetWindowText() in the sheet's OnInitDialog() method.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I get the same Unhandle exception by placing it in OnInitDialog(). I think it is a different method call in net 7.1......I am wasting so much time digging for such a simple problem.....
|
|
|
|
|
C++NewBe wrote:
I get the same Unhandle exception by placing it in OnInitDialog().
But how are you calling the SetWindowText() in there?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I'm calling it like this
GetDlgItem(IDD_SYSTEM_ALIGN)->SetWindowText("Junk One");
|
|
|
|
|
Which is incorrect. Remove the call to GetDlgItem() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
David,
It works on both ends, referencing the GetDlgItem was my problem.
Thanks a lot....
|
|
|
|
|
C++NewBe wrote:
It works on both ends...
Both ends of what?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
|
This works fine in v6. It must be something specific to v7.x, or you have other code in place that is masking the problem.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
SetWindowText(...) will work i suppose.
God is Real, unless declared Integer.
|
|
|
|
|
Can someone please verify that if a derived class redefines a protected virtual function from the base class it must be redfined as a public member in the derived class. So for instance,
class Core {
protected:
virtual double grade(double) const;
};
class Grad: public Core {
public:
double grade(double) const; // OK, it's public.
protected:
double grade(double) const; // NOT OK!
};
If true, can you please provide the logic behind this? Otherwise, why is VC++ 6.0 complaining?
THANKS!! Much obliged!
Matthew
|
|
|
|
|
It's not true. Otherwise, what would be the point of a protected virtual function if you had to make it public?
If you remove the public version from Core it should compile.
|
|
|
|
|
There is no public version in Core, only a protected version. The example shows a redefined function in Grad: one version is public and one protected. They are mutually exclusive. I only put them both there for the example.
Matthew
|
|
|
|
|
This compiles
class Core {
protected:
virtual double grade(double) const;
};
class Grad: public Core {
protected:
double grade(double) const;
};
Nevertheless its better to keep in the declaration
virtual double grade(double) const;
cos maybe ull have another level of derivation
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks! I found the problem (but don't quite understand it). It's related to a clone function that I had in my derived class. When I remove the private clone function I get a clean compile. From Accelerated C++:
The return type for the clone function in class Grad must be changed to be a Core* rather than a Grad* as written in the book:
#ifdef _MSC_VER
Core* clone() const { return new Grad(*this); }
#else
Grad* clone() const { return new Grad(*this); }
#endif
because VC++ 6.0 does not yet allow a virtual function returning a pointer (or reference) to a base class to be defined in a derived class to return a pointer (or reference) to the derived type.
Matthew
|
|
|
|
|
helloo all gr8 programar i ahve little problem
i want to change via programming ip address,hostname,dns name,default gateway of computer
i tried using registry but failed it no helping, ineed a solid programmin code that help me.
it my challenge to all gr8 vc++ programmer
Alok Gupta
visit me at http://alok.stormpages.com
|
|
|
|
|
I have a dialog application with a list control and a edit control. I am trying to write float values to the controls, or to at least one of them, at run time. I dont know how to do this. Can someone help me out?
Jerry
|
|
|
|
|
double d = 12.34;
char s[32];
sprintf(s, "%f", d);
edit.SetWindowText(s);
list.AddString(s);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
|
U can use
SetWindowText for this
example
float b=.343;
CString o;
o.format("%f",b);
johnsb2->SetWindowText(o); //where johnsb2 is CEdit
Bye
Hopes this help u.
krishnadk
|
|
|
|
|
Hai guys
I have a new idea for compressing files.. it work as follows
Example:
samlpe text : "something is better than nothing"
first s is placed first letter as usual now i will find the difference between s and o and only that difference is placed and so on..
How is this idea
pls respond if u understand what i said(my language is poor .
i know it).
bye
krishnadevan
krishnadevan@ushustech.com
mail to me if u interested...
any new ideas also welcome..
krishnadk
|
|
|
|