|
Sampath579 wrote: I have gone through some examples and understood that, "this" in below call created issues.
tab.AddTab(this, _T("tab1"),101)
instead of this, we need to provide the control we are going to add to that tab control
Did you try to provide the same View for all created tabs?
|
|
|
|
|
I tried with CEdit as per the example in msdn. But instead of CEdit i need CView. If i declare
CView m_windView; //throwing error since it contains virtual functions and we need to implement them.
|
|
|
|
|
Which class should i take in order to display my drawings in the view. I tried with CView and CScrollView. Both the classes contains virtual functions and it showing error. I need a view where mouse down , mouse up, mouse wheel should work on it.
Any suggestions please.
|
|
|
|
|
How to load a CView in tab which is created using CMFCTabCtrl.
|
|
|
|
|
Then i created CMFCTabCtl and created a tab control. Next, how to add a CView to tabs? I saw samples like how to add a CEdit control to tab but dint get any clue on how to add CView to tabs?
If i can add a Cview to tabs then my problem would be solved. I can add same CView to all the tabs and finally i will end up with one view and mutliple tabs which is my requirement.
|
|
|
|
|
Victor,
May i know how can know whether user selected different tabs? I mean my function should know when user selects different tabs, based on that i can refresh my single view. ?
|
|
|
|
|
|
Hi.
In my MFC application, i created a class which is derived from CTabView and created few tabs(views) using AddView(). Now i want to change the color of the tab views. May i know how to change the background color of those views?
Thanks in Advance.
|
|
|
|
|
|
I want the first one i.e., changing the background color of the CView. I tried with below call
SetClassLong(GetActiveView()->GetSafeHwnd(), 0, RGB(255, 0, 0)); but it dint work.
|
|
|
|
|
Sampath579 wrote: I tried with below call
SetClassLong(GetActiveView()->GetSafeHwnd(), 0, RGB(255, 0, 0)); but it dint work.
And how should it "work"? Where did you find this strange code? Did you read the SetClassLong function (Windows) documentation in MSDN?
I posted you a link to the Forum where you can find a working code. Why did you ignore it?
|
|
|
|
|
Thanks. Its working fine.
|
|
|
|
|
|
Hi.
I created a class which is derived from CTabView. In OnCretae() function it created a window with a tab control on window. Later i created few views by calling AddView(). I created 5 view.
Now, when i click on the arrow buttons on the tab control below, my control is not switching the tabs.
May i know which function should i call to switch the tabs on my window?
And also let me know how to disable it?
modified 11-Mar-18 5:13am.
|
|
|
|
|
here in the code below i am trying to print the increment every time the same object is called, but it's giving error.
#include <iostream>
using namespace std;
class Names{
int m;
static int count;
public:
void setcode(void){
m = ++count;
cout<<m<<endl;
}
};
int main(){
Names x;
for(int i=1; i<5; i++){
x.setcode();
}
return 0;
}
Error:
Quote: /tmp/ccDcxr5a.o: In function Names::setcode()': savinglistOfNames.cpp text._ZN5Names7setcodeEv[_ZN5Names7setcodeEv]+0xe): undefined reference toNames::count'
savinglistOfNames.cpp text._ZN5Names7setcodeEv[_ZN5Names7setcodeEv]+0x17): undefined reference to Names::count' savinglistOfNames.cpp text._ZN5Names7setcodeEv[_ZN5Names7setcodeEv]+0x1d): undefined reference toNames::count'
collect2: error: ld returned 1 exit status
Thank you
modified 10-Mar-18 7:44am.
|
|
|
|
|
Tarun Jha wrote: but it's giving error. And we must guess what that error is, and where it occurs?
|
|
|
|
|
|
You have declared the variable count in your Names class, but never defined it in your code. Add the following line after the class declaration:
int Names::count;
|
|
|
|
|
|
1>ModifyDlg.obj : error LNK2001: 无法解析的外部符号 "public: virtual int __thiscall CModifyDlg::OnInitDialog(void)" (?OnInitDialog@CModifyDlg@@UAEHXZ)
1>WorkDlg.obj : error LNK2001: 无法解析的外部符号 "protected: virtual int __thiscall CWorkDlg::OnInitDialog(void)" (?OnInitDialog@CWorkDlg@@MAEHXZ)
|
|
|
|
|
|
Here's what i have tried.
#include <iostream>
#include <cstring>
#define MAX 100
using namespace std;
int m=0;
class Names{
char name[5][30];
public:
void getdata(){
cout<<"Entre name :\t";
cin.ignore(1000, '\n');
cin>>name[m];
m++;
}
void display(void){
for(int i=0; i<m; i++){
cout<<name[i]<<endl;
}
}
};
int main(){
Names x;
for(int i=0; i<5; i++){
x.getdata();
}
x.display();
return 0;
}
i tried getline(), but it was giving error. How do i take a string as a input ?
modified 10-Mar-18 0:37am.
|
|
|
|
|
Please test it and let me know whether it solved your requirement.
#include <iostream>
#include <string>
#define MAX 100
using namespace std;
class Names {
string name[3];
public:
void getdata()
{
for (int i = 0; i < 3; i++)
{
cout << "Enter Names:" << endl;
getline(cin,name[i]);
}
}
void display(void) {
for (int i = 0; i<3; i++) {
cout << name[i] << endl;
}
}
};
void main()
{
Names n;
n.getdata();
n.display();
getchar();
}
|
|
|
|
|
Tarun Jha wrote:
i tried getline(), but it was giving error. Can you make your font size larger? I cannot see the error from here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
i will try .
and thank you
|
|
|
|