|
Ah! MAny thanks. That worked. Appreciate it!
ns
|
|
|
|
|
I am creating my own class derived from CStatusBar, and will embed an imagecontrol in it, called m_THBImageRainbow. Now in my view class, I need to populate this box with an image through a function defined in the view class. If m_THBImageRainbow had been a view class member I'd have done:
ShowTHBImage(m_rainbow.GetImageSize(), m_rainbow.GetImagePointer(), &m_THBImageRainbow)
but my m_THBImageRainbow is a member of my new statusbar class. How will I access this?
Instead of &m_THBImageRainbow , what will it be?
I'll have MyStatusBar m_wndStatusBar; in the mainframe.
So to get at it in view :
((CMainFrame*)AfxGetMainWnd())->m_wndStatusBar.m_THBImageRainbow) , but where will the & go?
<code>&</code>((CMainFrame*)AfxGetMainWnd())->m_wndStatusBar.m_THBImageRainbow)
or somewhere else in there?
Thanks,
ns
|
|
|
|
|
Hi !
I need some grid control to display data in a table format with the avalability of recognizing clicks no cells and so on.
I rememeber seeing an article here that was perfet for me but I cant find it.
Any help is welcome, just dont recommand the MS FlexGrid, I hate it
Thanks,
Shay Harel
|
|
|
|
|
Best grid control here you can find on the CP homepage - first item in Most Popular section - Chris Maunder's MFC Grid control 2.24;).
Pavel
Sonork 100.15206
|
|
|
|
|
Great, exactly the one I was looking for
|
|
|
|
|
I am trying to come up to a crawl using VC6. I have been using Optima++. Under Optima I could save the current project and create a new one by using the Save Project As button under the file menu and providing a new name Ie.. test1, test2, test3 and so on. I have been unable to figure out how to do the same thing with VC6. What I want to do is save a current project, but create a new one based on the original for modification, so that I don't screw up the original. Is there a way to do this?
Steve Daly
|
|
|
|
|
No .
You can of course copy the project directory. If you want to rename it also, you need to edit dsp and dsw files in text editor.
Pavel
Sonork 100.15206
|
|
|
|
|
ever thought of using sourcesafe? or another CVS? I like the idea of revisioning code. I use it in JBuilder all the time, kinda the same way Word handles revisions.
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|
|
Has anyone come across resources on how to architect FDI models as opposed to MDI. I am starting out a new project and I would like to use an architecture similar to VS.NET. Workspaces in my application will be able to contain any number of document modules (dynamically load a new document type). Just wondering if anyone has found any tutorials or discussions on such a model?
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|
|
Hi.
I would like to know the best way to initialize a constructor in a virtual base base. For example,
[code]
// Base class
class Base()
{
public:
A(int i = 0);
virtual void printA() const = 0;
};
// Derived classes
class X() : public virtual Base
{
public:
X(char a, int j);
virtual void printA();
};
X::X(char a, int j)
{
char temp = a;
A::A(j);
}
class Y() : public virtual Base
{
public:
Y(long x, int k);
virtual void printA();
};
Y::Y(long x, int k)
{
long temp = x;
A::A(k);
}
// Next level down in hierarchy
class Z(); public X, public Y
{
public:
Z(...?...); // What data do I need here to construct X, Y, and Base?
...
};
Z::Z(...?...)
{
// Do you contruct class X, Y, or Base first?
}
// Implementation
Z example(...?...); // You need to construct Base first.
[/code]
I know the question is very basic to polymorphic C++ programming. Nonetheless, it is something that want really want to understand.
Thanks,
Kuphryn
|
|
|
|
|
When deriving from a Base through a virtual intermediate, it is your responsibiliy to construct the object base --none of the constructors supplied by the derived virtual classes is applied. If you don't specify a constructor, default is used.
Apart from this, the syntax you using is incorrect. It should be like:
X::X(char a, int j): A(j)
{
char temp = a;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Okay. Thanks.
Please give an example of how to construct the base from that example.
Kuphryn
|
|
|
|
|
When inheriting from a virtual baseclass, it's always the responsibility of the "most derived" class to invoke the constructor of the virtual baseclass. The way you invoke initialization from a constructor is well documented.
I suggest, and I do this to be nice, you don't try to use virtual baseclasses until you learn and understand at least the syntax and semantics for initialization. To give you a starting point; you initialize anything from a C++ constructor like:
class A
{
A() : v(0) {}
int v;
};
|
|
|
|
|
Okay. I admit the sample had code errors. You could look up syntax in a reference book. I wanted to understand the concept.
Kuphryn
|
|
|
|
|
I have a CStringArray with filenames, and I want to run through these and open a new MDI child for each file.
I can open a file through 'File->Open', but don't get how to achieve this without bringing up the SelectFile Dialog.
Is there a just message I need to send?
TIA,
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
Use CWinApp::OpenDocumentFile method.
Pavel
Sonork 100.15206
|
|
|
|
|
Thanks, still not quite there, though.
I've implemented this:
CDocument* pDoc = AfxGetApp()->OpenDocumentFile(Filename);<br />
if(pDoc != NULL)<br />
pDoc->UpdateAllViews(NULL);
and get an exception error assigning pDoc.
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
Your code worked for me OK using Copy&Paste.
In CMainFrame menu command handler.
Where are you using it in your app hierarchy?
Are the document templates initialized (in InitInstance)?
Pavel
Sonork 100.15206
|
|
|
|
|
Pavel Klocek wrote:
Your code worked for me OK using Copy&Paste
So I'm not completely lost, then.
Pavel Klocek wrote:
Where are you using it in your app hierarchy?
void CMainFrame::PVCSGet(CString Filename)<br />
{<br />
...<br />
CDocument* pDoc = AfxGetApp()->OpenDocumentFile(Filename);<br />
...<br />
}
documents are getting initialized, I can open documents from File->Open.
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
Have you only one type of document?
I suppose, the file extension matches the one defined for the document in resources.
I'm out of imagination.
You tried to go inside of OpenDocumentFile in debugger?
Pavel
Sonork 100.15206
|
|
|
|
|
Pavel Klocek wrote:
Have you only one type of document?
Yes
Maybe a clear head on Monday will make it obvious to me.
Thanks very much for your help!
Enjoy the weekend!!
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
brianwelsch wrote:
Maybe a clear head on Monday will make it obvious to me.
Yes, it often helps.
brianwelsch wrote:
Enjoy the weekend!!
Thanks, you too .
Pavel
Sonork 100.15206
|
|
|
|
|
In a create function of a modeless dlg I have an Images class object (my custom class) which puts a pointer into the member set variable:
image.pZoomSet.insert(this);
Now I have several modeless dlgs spawned, each with a unique image object (which has a <set> member called ZoomSet):
BOOL CZoom::Create(UINT nID, CWnd *pWnd, CString& trioIndex, CImages& image)
I close these 'Czoom' class modeless dlgs like this m_pImage = &image )
void CZoom::OnClose()
{
std::set<CZoom*>::iterator it = m_pImage->pZoomSet.find(this);
m_pImage->pZoomSet.erase(it);
}
If I have say four of these zooms up , three will close (no visible pattern), the fourth wil crash
at the find(this), but sometimes its not even the fourth one - might be the second one - that crashes when I close it. How do I debug this? I cant "see" into the iterators etc
|
|
|
|
|
What you explain so far seems OK. Are you messing around with image somewhere else? I've I understood it right this object is unique --CZoom s only hold a pointer to it in order to acces it in OnClose .If so, where is the object stored?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
you might want to verify that "it" actually represents to a valid object (test that it's not equal to mycollection.end() )
also, since the iterator is just a reference to whatever your set is holding, you can create a variable, assign it to the iterator and look at that:
myobject temp = (*it);
-c
Greenspun's Tenth Rule of Programming:
"Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp."
|
|
|
|