|
I have a combo box and there are some data in that. now i have given two variables for this combo box. A CString variable and a control variable (CCombo). now my requirement is that the first data which is there in the list box should appear in the combo box. now its blank. what needs to be done for ths?
|
|
|
|
|
Supposing your control variable (CComboBox* ) name is MyCombo , the following statement should do the trick:
MyCombo->SetCurSel(0);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
got it done... !
|
|
|
|
|
hi,
I want to divide my main frame client rect into 2 parts, one of the parts for one window and the other for example for a view, besides they don’t have overlapped with each.
Thanks
Miss_F
|
|
|
|
|
You mean, something like windows explorer ? If yes, then you have to use a splitter window. You can found some documentation here[^]. There are also some articles[^] on CP about it.
|
|
|
|
|
No, i don't want splitter, i want sth like a tool bar,( but not it)( a window or control bar which is always there (static one at the top of the main frame))
and which has its own client rect and informs main frame the amount of space remains unallocated in the parent window's client area.
Miss_F
|
|
|
|
|
My understanding is that actually you want an application like Visual Studio itself. The answer is very simple. Use a classic MDI application and dock a dialog bar to the left (or right) side. Obviously, if you enjoy doing it, you can dock lots of dialog bars to all the sides (that's the way Visual Studio is made).
|
|
|
|
|
How to change the height of toolbar control in win32.
Thanks
|
|
|
|
|
toolbar control height is determined by the height of the button in it.
if you are using CreateToolbarEx API to create toolbar then dyButton parameter represents the height of button
|
|
|
|
|
|
Hello everyone,
Seems when using __interface to define a C++ interface in Visual Studio, we can provide non-pure virtual function. Previously I think in interface, only pure virtual function is allowed. Seems there is no such restriction now.
Correct?
thanks in advance,
George
|
|
|
|
|
See here[^]. When you use the __interface keyword these details are taken care of automatically: The functions are still pure-virtual , you just don't need to do so explictly.
Steve
|
|
|
|
|
Hi Steve!
I have read the link before asking this question. The link said, "Can only contain public, pure virtual methods". But I have tried that it could contain non-pure virtual methods.
Any ideas?
regards,
George
|
|
|
|
|
The methods are implictly pure-virtual .
Steve
|
|
|
|
|
Hi Steve,
I have tested that we can put non-pure virtual method,
__interface IFoo {
virtual int foo() = 0;
int goo() {return 0;}
};
Any comments?
regards,
George
|
|
|
|
|
Pure-virtual does ***NOT*** mean the function can have no a body!!!:
#include "stdafx.h"
#include <iostream>
using namespace std;
class YouDontSeeThisOften
{
public:
virtual PureButHasBody() = 0
{
cout << "You don't see this often!" << endl;
}
};
int main(int argc, char* argv[])
{
return 0;
}
Steve
|
|
|
|
|
Hi Steve,
Sorry that I may not make myself understood. My point is, if the link from MSDN, looks like in __interface, we could only put pure virtual method.
But I have tried that put non-pure virtual method (which has method body) is also ok.
Any comments?
regards,
George
|
|
|
|
|
In example you gave the function is pure-virtual , just like in the example I gave. Try to instantiate it and see!
Steve
|
|
|
|
|
No Steve,
The function goo is not pure virtual.
int goo() {return 0;}
Could you review my sample again please?
regards,
George
|
|
|
|
|
I'm afraid it is (pure-virtual ). As I stated earlier, when you use the __interface keyword the functions are pure-virtual implicitly, regardless of whether you use the virtual keyword or put in a = 0 .
Steve
|
|
|
|
|
Thanks Steve,
I think you mean even if the function has body in _interface, it is still treated as pure virtual? How to prove it (is pure virtual)? Looks interesting.
regards,
George
|
|
|
|
|
George_George wrote: I think you mean even if the function has body in _interface, it is still treated as pure virtual?
That’s what I mean, and what I said (“when you use the __interface keyword the functions are pure-virtual implicitly, regardless of whether you use the virtual keyword or put in a = 0”). The whole reason for the __interface keyword is to remove the need for all that syntactic clutter.
George_George wrote: How to prove it (is pure virtual)?
You can prove they're pure by attempting to instantiate one - you should get a compiler error (not a linker error).
Steve
modified on Monday, February 04, 2008 12:25:06 AM
|
|
|
|
|
Thanks Steve,
My question is answered.
regards,
George
|
|
|
|
|
George_George wrote: even if the function has body in _interface, it is still treated as pure virtual
Some clarification is in order: a pure-virtual function can have a body, as I showed in my example code in an earlier post in this thread. The fact that it’s pure just means that it can’t be instantiated and classes that derive from it must override the method or they will not be able to instantiated.
Steve
|
|
|
|
|
Thanks Steve,
I think even if you put the body into a pure virtual function, you can not utilize the function (body), right (for example. invoking it)? During compiling process, it is just discarded?
regards,
George
|
|
|
|