|
Calling CDialog::OnEraseBkgnd() will fill the entire client area with the default background color; i'd assume you are handling the message because you want to do something more interesting, but you need to make sure the effect is the same.
Double-check your method of erasing the background; if you are manually creating a clipping region that excludes child controls, make sure you take into account the visible status of the control before excluding it.
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
I won't be doing anything in OnEraseBkGnd().
I had written that ,because in XP the tab control background was a pattern.so i want to just keep the pattern.so i just return TRUE;
I will get the Background fine.But problem i had mentioned above occures.
Could you pl help me...
Neha
|
|
|
|
|
oh... wait, so is this code for a property page or child dialog? If so then, there may be a better solution. If you don't want the background of the page drawn at all, try giving the page/dialog the WS_TRANSPARENT style; this will force it to be drawn *after* all its parents; then the empty OnEraseBkgnd() might work for you.
[Update]
Before you try that though, try just retrieving a handle to the tab control & Invalidate() ing that after you hide a control. (similar to what CG is suggesting, but for the tab control not the dialog)
Both of these suggestions only make sense for a property sheet/property page deal. If you've just got a tab control on a dialog, setting the Z-order should be sufficient.
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
So nice of you..
It works just fine....
Thanks a lot..
|
|
|
|
|
Hi,
My Code is like this.
CDaoDatabase db;
db.Create ("D:\\Test.mdb",dbLangGeneral );
CDaoTableDef def(&db);
def.Create ("Tab1",dbAttachExclusive,NULL,NULL);
Here database is created.But not creating Table.
What is the Error in it...
Pls Help
|
|
|
|
|
How does the implementation of ASSERT not compile with release mode...?
#ifdef _DEBUG
#define ASSERT(exp) \ Blah blah
#endif
I thought it would be much like the above, which it is, however this doesn't prevent the compiler from complaining
at ever occurance of ASSERT(FALSE)
This has left me to assume that the compiler and not the preprocessor removes any ASSERT macro from your code..?
Am I wrong..? Could i define a similar debug macro and have it dissappear on release compile, or is this a feature of Visual C++...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Yes you can define macros like that in a debug ifdef in the same way as you would any could that in an ifdef, like defaults that may vary in different countries for example.
Happy programming!!
|
|
|
|
|
Yes, but how is it ASSERT calls don't cause compiler errors when in release mode...?
Are they removed by the compiler...?
#ifdef _DEBUG
MyMsg(exp) AfxMessageBox(exp)
#endif
CWinApp::InitInstance()
{
MyMsg("Hello world");
ASSERT(FALSE);
}
In release mode MyMsg casues compiler error. ASSERT does not.
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Yes when the _DEBUG is not defined as in release build the code is not included.
Happy programming!!
|
|
|
|
|
ASSERT is defined differently in debug and releasemode.
In debug (When _DEBUG is defined):
#define ASSERT(f) \
do \
{ \
if (!(f) && AfxAssertFailedLine(THIS_FILE, __LINE__)) \
AfxDebugBreak(); \
} while (0) \ In release (When _DEBUG isn't defined):
#define ASSERT(f) ((void)0)
I.e. In releasemode, the compiler actually ignores the expression, since ASSERT(whatever) is replaced with ((void)0).
Sprudling
|
|
|
|
|
Thanx. Tis the answer i was looking for
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
My CD is damaged for Tom Armstrong's book - "Designing and Using ActiveX Controls".
The sampe code for chapters 8-11 is unreadable. I have had the book for too long to return it. His web site only contains corrections to source not the full source.
Does anybody have this CD? Would you email me the chapters?
lynnphilmcgahan@msn.com
P.S. This book is worth owning.
|
|
|
|
|
There should be a contact email ID on his web site. Try mailing there and request that you'd like to download the entire source or even ask for a CD, they might give you one free.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Thanks. I tried this a week or so ago, but got no response from the webmaster or customer service.
Good idea, thanks anyway.
|
|
|
|
|
My question is 2 parts.
1) I am creating a CDateTimeCtrl to show/get the 24-hour time of day. However, my control hides the hour field behind the left margin of the control. So I see "mm:ss PM" instead of "HH:mm:ss" (for example.)
How can I get my control to show entire time string? "HH:mm:ss"
2) I want to display "HH:mm:ss", but I only know of DTS_TIMEFORMAT.
How can I get my control to display "HH:mm:ss" (24-hour format).
Details:
1) The CDateTimeCtrl's dimensions are large enough to display everything, but somehow, the text is shifted left in my control. I can use the L-R arrows to reveal what is hidden.
2) I am creating a DWORD dwStyle set of attributes, but I don't know how to create a custom time format.
DWORD dwStyle = WS_CHILD | WS_VISIBLE |DTS_UPDOWN | WS_TABSTOP | DTS_TIMEFORMAT;
Your help would be greatly appreciated.
Thanks,
Johnny
|
|
|
|
|
Hi there,
I was wondering what is the most delicate way of including a function that will be available to all files in a visual c mfc project?
You can off course create a header and cpp containing the function and then put the header in stdafx.h and use that all over the place.
You can dynamically cast to the parent windows in a child window and access a function defined there.
You can use include files all over the place refering to the file containing the function.
But is there any nicer way of doing this? since this is just one function call, is there a better way of doing it?
|
|
|
|
|
the easiest way is the first one you list (stdafx). i usually do the third way (include where you need it).
there's not much else you can do, given the way C/C++ works - you have to #include a header somewhere (or define the function separately in each file)
-c
Smaller Animals Software, Inc.
You're the icing - on the cake - on the table - at my wake. Modest Mouse
|
|
|
|
|
You can convert all the global functions to members of your cwinapp derived class. Then you can always use :-
((Cyourapp*)AfxGetApp())->yourfunction()
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
The best way to do this, because global functions are evil, is to define it in your stdafx.h and stdafx.cpp, but wrap it in a namespace. Then it's not global but you can MyNamespace::Myfunction from anywhere in the project.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Cool!
Thanks for the info CG.
I thought you can only have classes and structs in namespaces
I didnt think you could have a function in a namespace
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Nish [BusterBoy] wrote:
Thanks for the info CG.
No worries - it was a bit of a revelation to me when I realised, because there are times you need something visible from anywhere, and I *hate* global functions or variables, because it's only a matter of time before they collide with something.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
I have already asked this question earlier today, but i might not have explained it well;
Can any one tell me how do you make a resizable array.
Our Instructor wants us to start an array of size 1. and just grows as you keep adding stuff to it.(it does not have to shrink).
He also said that we cannot use any libraries so we have to create our own data type i guess.
no includes no call to lib functions!!!
Thanks
|
|
|
|
|
Take a look at
this place .
I'm sure you will find at least one solution for your problem.
Also, you can find CSimpleArray in ATLBASE.H That would solve your problem.
I vote pro drink
|
|
|
|
|
I think he wants you guys to create your own array structure. You can create a struct with a member variable which is an int array. Each time they add a new element you can delete the current array and new a new array. For efficiency you can do it in jumps of a jump factor [say 256]. Have another member variable which has the count of array items.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
""For efficiency you can do it in jumps of a jump factor [say 256]. Have another member variable which has the count of array items.""
what do you mean i can do it in jumps?
|
|
|
|