|
Hi all,
i have SDI type application, i m split it in i row and 2 columns.initially its have size that is i given.
but with help of mouse i m resizing it.
i want to prevent resizing spiltted view.
i want fix the width for both view that is initially i have already mentioned.
please tell me how can i do this.
i waiting for your valuable suggestion and answers.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Check this[^]
I hope it helps..
Regards,
Sandip.
|
|
|
|
|
Thanks its done
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi, if it wouldn't be a great trouble could anyone direct/suggest me to an article of how to add an navigation pane positioned on the left side like an Outlook 2003. I need to use it as a shortcut bar.
I would switch the views on the right side depending on user selection.
Thanks in advance!
Here at CP I found something similar ("OutlookBar: A Simplified Outlook Style Sidebar Control" ) but for .Net, I need to use it with VC6 MFC.
|
|
|
|
|
Could this[^] be it?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Thanks for your suggestion. Of course it helped me, interesting stuff.
|
|
|
|
|
Hello.
I build a class, using internaly a component. But I want that the user of the class never knows which type of component it is.
for exemple :
the include file class.h :
#include <windows.h>
#include <classComponent.h>
class MyClass {
private:
classComponent _Component;
public:
MyClass();
Log( string Message);
};
=======================
If a user of my class includes the file class.h, he need to "access" to classComponent.h in it's compiler directive. But He realy only need the library of the component (classComponent.dll) and not the include, because it is MyClass which process access to functions of classComponent..
How can I "mask" the dependendancies on classComponent for the final user ?
Best regards.
|
|
|
|
|
Use a void* to access the hidden classComponent object.
in class.h:
class MyClass {
void* p;
public:
MyClass();
~MyClass();
void DoStuff();
};
in class.cpp
MyClass::MyClass()
{
p = (void*) new classComponent;
}
MyClass::~MyClass()
{
classComponent* p2 = (classComponent*) p;
delete p2;
}
void MyClass::DoStuff()
{
classComponent* p2 = (classComponent*) p;
p2->DoStuff();
}
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
That's really ugly...
|
|
|
|
|
The whole void* and casting stuff isn't needed. Use a forward reference to the classComponent class instead.
In "Class.h":
class classComponent;
class MyClass
{
public:
MyClass();
~MyClass();
void DoStuff();
private:
classComponent *m_pThis;
};
In "Class.cpp":
#include "classComponent.h"
MyClass::MyClass()
{
m_pThis = new classComponent;
}
MyClass::~MyClass()
{
delete m_pThis;
}
void MyClass::DoStuff()
{
m_pThis->DoStuff();
}
This pattern is often called the Pimpl idiom[^].
Steve
|
|
|
|
|
The OP said:
I build a class, using internaly a component. But I want that the user of the class never knows which type of component it is.
Sorry, I was under the impression from his wording that he wanted not just to remove the dependency from his include file but also to hide the fact that he's using a certain component from users of his code (some sort of code obfuscation).
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I take your point, however, if all the client gets is a forward reference not much is really being given away.
Steve
|
|
|
|
|
What's the exact reason for that ? Will your class be packaged in a dll ? If no, then your user will still need to add the cpp file in his project and he will be able to see your code.
If you're putting your code in a dll and you really really want to hide the members of your class, then extract an interface from your class and makes your class inherit from this interface. Of course, this is a bit more tricky to manipulate because your user will need to 'ask' your dll to create the class, he can't do it himself (he only has the interface).
But once again, I don't really see the point of doing that...
|
|
|
|
|
marcelcerdanjunior wrote: How can I "mask" the dependendancies on classComponent for the final user ?
By *mask* do you mean that you want to make final client application independent of changes made to class classComponent?
Regards,
Sandip.
|
|
|
|
|
I want that the user of MyClass.h doesn't need to have access to all other includes files like classComponent.h
In most libraries, there is not only one, but a lot of include file.
For exemple, I build a simple classLog class using log4cxx from Apache, which used itself a lof of include files.
But the LoggerPtr component will never been used by the final user. My class do the job.
I want that the final user includes only classLog.h and not need a ball of wool of includes he never will use.
best regards.
|
|
|
|
|
marcelcerdanjunior wrote: I want that the user of MyClass.h doesn't need to have access to all other includes files like classComponent.h
That's the only thing you want to do, remove the #include statement at the top of your .h file ? It's completely different than what you said in your first message: you don't need to hide anything at all.
Instead of using an instance of the class, simply use a pointer to the class. This way, you only need to add a forward declaration at the top of your .h file and put the include directive in the .cpp file. A forward declaration is something like this:
class Component;
For more information, google for forward declaration.
EDIT: when thinking a bit about your question, in fact what you want to avoid is that the user of your class do not need to have all those include files on their system when they want to use your class ? Is that your problem ? If yes, then the only way is to provide compiled code (a lib file or a dll) to your user. Because if you move the include into the cpp file, the user will still need to compile the cpp file you provide and this will require the inclusion of the header file.
|
|
|
|
|
Exact,
I only want to deliver the include, the lib and the dll.
Best regards.
|
|
|
|
|
Well, then if you use forward declaration and move the include statement in the cpp file it should be ok.
|
|
|
|
|
|
i don t undersatnd the following code on VC++
(assuming T being any variable type)
*M = new T* [xdim]; **M = new T [xdim*ydim];
if (*M==NULL || **M==NULL) return false;
for(int i=1; i < xdim; i++)
(*M)[i] = (*M)[i-1] + ydim;
would that give me a matrix M[][]?
thanks for your help
|
|
|
|
|
do you mean
T * a = new T [xdim * ydim];
if (! a ) return false;
T ** m = new T * [xdim];
if (! m)
{
delete [] a;
return false;
}
for (i = 0; i < xdim; i++)
{
m[i] = a + i * ydim ;
}
return true;
?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Actually this is the code I have and i am trying to make sense of it
the full code is a template function which create a matrix called like M[][]
template <class T>static bool makematrix(int xdim, int ydim, T ***M){
*M=new T* [xdim]; **M new T[xdim*ydim];
if (*M=NULL ||**M=NULL) return false;
for (int i=1, i<xdim,i++)
(*M)[i]=(*M)[i-1]+ydim;
return true;
but it doesn t make sense to me
is it equivalent to:?
int row, col;
int** mat = new int*[row];
mat[0] = new int[row * col];
for (int i = 1; i < row; ++i)
mat[i] = mat[0] + i * col;
|
|
|
|
|
Member 4655885 wrote: is it equivalent to:?
No.
You've reversed the order of allocation, so it's now guaranteed to crash, instead of possible.
And showing all of the code (as you have now done) makes a big difference.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
See here [^].
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Can you explain me why you posted a link to the previous reply of Iain
I don't get it...
|
|
|
|