|
What article or articles you need to see?
|
|
|
|
|
I downloaded a sample program in codeproject.com last year. I can’t find the article along with it.The demo project is named “TreePropSheetDemo”. Can you help me find it or tell me how to find it?
There is a will,there is a way!
|
|
|
|
|
(Sorry my system is having problem pasting URLs.)
Tree property sheet
http://www.codeproject.com/KB/tabs/treepropsheet.aspx
Tree property sheet Ex
http://www.codeproject.com/KB/tabs/treepropsheetex.aspx
Maxwell Chen
|
|
|
|
|
Thanks a lot!
There is a will,there is a way!
|
|
|
|
|
I have on Claas that whitin one of the methods/function references
a public method/function of another Class
Does referenced class method have to be static
Truth is I want only one instance of the Referenced Class
I guess its not possible to use the static attribute before the Class Keyword
The only to make The Entire Class Static is to make every member/fuction static
|
|
|
|
|
Do you mean this?
class Object
{
public:
Object() { }
type Test() { }
};
static Object obj;
#include "some.h"
extern static Object obj;
class Invoker
{
public:
type UseStaticObj() { return ::obj.Test(); }
};
Maxwell Chen
|
|
|
|
|
I understand the only way to implement the Class as static is When actually declare it as a Object
I was getting compile errors when I was writting the code for the Class
Referencing a Method Class b from a e.g.
CLass A
{
private:
int c;
char d;
public:
int e()
{
return c;
}
}
Class b
{
private:
public:
int f;
f = getc() // compile error because the compiler wouldn't
{ // know what instance of e I want unless I declare it
e(); // static right ????
}
}
|
|
|
|
|
Fornow I dont understand the question completely, but fornow I can say you something.
First be clear on your design.
You want the referenced class to be single instanced all across the world?
If so , it has to be a singleton.
Or, if you just want the referenced class to be single instanced with the referencing class. It can simply be a static object inside the referencing class.
Note: To use it as a static object, you dont need to use "static" key with the referenced class. Grrrr. It just needs to be prefixed with the object in the referencing class.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
Hope this code better explains what my I am trying to do
CLass A
{
private:
int c;
char d;
public:
int e()
{
return c;
}
}
Class b
{
private:
public:
int f;
f = getc() // compile error because the compiler wouldn't
{ // know what instance of e I want unless I declare it
e(); // static right ????
}
}
|
|
|
|
|
Hey!! What are you trying to do??
Class b
{
private:
public:
int f;
f = getc() // compile error because the compiler wouldn't
{ // know what instance of e I want unless I declare it
e(); // static right ????
}
}
f = getc();
e();
And finally, take a good c++ book it's all there in the third page.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
Thank you
I understand as you can tell I Am just starting to code in OO
|
|
|
|
|
ok no probs! But what I suggested was that you should start from basics then look at complex stuff otherwise you'll waste a lot of time getting puzzled.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
I think I am begining to understand
A class is really a typedef not real storage only when you declare that object then storage is allocated
If you have a object you want to modify e,g, add you derive that Class
you can access private data members in the derived class by writting your own constructer for it
When you derive it as you stated and use a function/data from derived object the compiler is not confused which instance it the this-> instance
I think I have a better understanding
|
|
|
|
|
VA_ wrote: And finally, take a good c++ book it's all there in the third page.
"The third page" ?!
Maxwell Chen
|
|
|
|
|
Yeah the first two being the "Contents" and "Preface"
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
By chance you are talking about something like :
#include <iostream>
using namespace std;
class one
{
private:
int x;
public:
one(int x_in)
{
cout<<"\n Created only once";
x = x_in;
}
void print()
{
cout<<"\n"<<x;
}
};
class two
{
int y;
public:
two()
{
y=10;
}
void printTest()
{
for(int i=0;i<=10;i++)
{
static one oneObj(y);
y++;
oneObj.print();
}
}
};
int main(int argc, char* argv[])
{
two twoObj;
twoObj.printTest();
return 0;
}
Otherwise you just need a singleton.
ReadHere[^]
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
Hello Gurus
I've stack in my try to convert this:
CDialog *m_Dialog[2];
Into this:
CArray<CDialog *, CDialog *> dlgArray;
I just want to be more flexible.But when I use it by this way:
for(int nCount=0; nCount < m_nPageCount; nCount++)<br />
dlgArray.GetAt(nCount)->Create(m_DialogPages[nCount],GetParent());
I receive an exeption. I think that my mistake is in the template, but I can't solve it. Thanks.
|
|
|
|
|
I don't know if the mistake is in the template. It is not apparent in the posted code. I suggest you to post the exception received and other relevant code (for instance CArray elements assignment.
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]
|
|
|
|
|
For debugging this kinda code , First do like :
<br />
for(int nCount=0; nCount < m_nPageCount; nCount++)<br />
{<br />
dlgArray.GetAt(nCount);<br />
}<br />
This confirms that you can iterate through the container without any problem. If it runs fine, then try :
<br />
for(int nCount=0; nCount < m_nPageCount; nCount++)<br />
{<br />
dlgArray.GetAt(nCount)->Create(m_DialogPages[nCount],GetParent());<br />
}<br />
Then post the actual error message.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
Because the info you provided is not enough, I can not be sure that you are doing correctly. Here is the check list for you.
1) One must add data elements into an array container, then he can enumerate the elements in the container. Getting elements from an empty container would result in access violation.
2) Before invoking CDialog::Create , the pointer of type CDialog* needs to be new -ed.
3) The for loop shall check the actual size of the array by calling CArray::GetCount . That is,
for(int nCount=0; nCount < dlgArray.GetCount(); nCount++)
Maxwell Chen
|
|
|
|
|
First Thank you all for replays. I'm still stack. So I will give you additional information . Please excuse my English I still learning. First I create the Array in my header file with template, like this:
CArray<CDialog *, CDialog *> dlgArray;
Then in my .cpp file I add some data:
dlgArray.Add(new CDlgSettings());
And I want to use this data by this way:
m_nPageCount = 1;<br />
for(int nCount=0; nCount < m_nPageCount; nCount++)<br />
dlgArray.GetAt(nCount)->Create(m_DialogPages[nCount],GetParent());
My idea is to use the above code to insert dialog into Tab Control. The project is compiling without error, but when i try to open the dialog which contains the Tab Control I receive the folowing error.
Asseration Failed!<br />
MyProgram: File afxwin2.inl, Line 262
modified on Sunday, January 06, 2008 3:12:48 AM
|
|
|
|
|
babamara wrote: dlgArray.GetAt(nCount)->Create(m_DialogPages[nCount],GetParent());
1) Make sure that m_DialogPages[nCount] refers to a valid dialogbox resource ID.
2) Let's say, dialogbox A has a tab control. In the implementation of A, it creates some child dialogboxes. I think that the second argument for CDialog::Create should be this , not GetParent .
3) Make sure the dialogboxes to be held in the tab control have the property "child window ".
Maxwell Chen
|
|
|
|
|
Thank you. I change GetParent with this and this solves the probelm. Now I am going to check why the dialog are not shown in my Tab Control.
|
|
|
|
|
babamara wrote: Now I am going to check why the dialog are not shown in my Tab Control.
Try CDialog::ShowWindow(SW_SHOW) .
Maxwell Chen
|
|
|
|
|
I use this function
void CPropertyTabControl::ActivateTabDialogs()<br />
{<br />
int nSel = GetCurSel();<br />
if(dlgArray[nSel]->m_hWnd)<br />
dlgArray[nSel]->ShowWindow(SW_HIDE);<br />
<br />
CRect l_rectClient;<br />
CRect l_rectWnd;<br />
<br />
GetClientRect(l_rectClient);<br />
AdjustRect(FALSE,l_rectClient);<br />
GetWindowRect(l_rectWnd);<br />
GetParent()->ScreenToClient(l_rectWnd);<br />
l_rectClient.OffsetRect(l_rectWnd.left,l_rectWnd.top);<br />
for(int nCount=0; nCount < m_nPageCount; nCount++)<br />
{<br />
dlgArray[nCount]->SetWindowPos(&wndTop+21, l_rectClient.left,<br />
l_rectClient.top, l_rectClient.Width(), l_rectClient.Height(),<br />
SWP_HIDEWINDOW);<br />
}<br />
dlgArray[nSel]->SetWindowPos(&wndTop+21, l_rectClient.left,<br />
l_rectClient.top, l_rectClient.Width(), l_rectClient.Height(), SWP_SHOWWINDOW);<br />
<br />
dlgArray[nSel]->ShowWindow(SW_SHOW);<br />
<br />
}
|
|
|
|