|
try this
call
Invalidate( TRUE );
after moving your image
by this function the dialog box will repaint so problem will be solve.
plz reply if anything goes wrong.
Thank You.
hiren thakkar
|
|
|
|
|
Thanks for reply,
Invalidate( TRUE );
Will invalidate the Dialog. and that causes flickering. So thats why i am calling Invalidate() of CStatic(image is on this CStatic).
Hi this is SHivraj
|
|
|
|
|
shivrajbhosale wrote: Will invalidate the Dialog. and that causes flickering.
The dialog - especially the part of the dialog known as "the place where the Static control used to be" - is the bit that needs to be repainted. Invalidating the Static control isn't gonna do anything for it... since, as you may have noticed, the Static control isn't there anymore.
You can probably get by with calling InvalidateRect() on the dialog, specifying the area formerly occupied by the control. If you set the WS_CLIPCHILDREN style on the dialog, it'll even avoid drawing over the overlapping parts of the Static control (which is fine, unless that control or others use the WS_TRANSPARENT style...).
Frankly, i doubt there's much value in using a Static control for this purpose - it's one thing if you're just trying to display an icon or something as a fixed part of the dialog, but if you're gonna be doing anything non-trivial you might as well go all-out and render onto the dialog directly. Or create a custom control.
every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- C hris L osinger, Online Poker Players?
|
|
|
|
|
I am creating 3 tabs and each tab will have identical controls, but will show different information in the controls. Actually the only controls on each tab is a list control and a button.
I would like to use the same class on all three tabs. This class is based on a dialog resource in the resource editor. Is this even possible? Or does each tab need to be a different dialog class? When I attempt to use the same class, the tabs initially show up ok, but when I switch between tabs, the list control is hidden. It actually flickers for a second when I switch to the tab as though it will appear and then it is hidden again. I know there are probably not very many instances where you would want the same class on multiple tabs, but since the controls and behavior are the same -- just the data that is shown is different, it makes some sense in this case. Has anyone tried to do this before? I can't find anything on any searches.
I'm using VC6, and I'm actually using the CodeJock third party tab control, but I don't think that control is the problem. And if it works with the regular MFC tab control, I would just use it.
Thanks,
Izk
|
|
|
|
|
You could use 3 instances of the same dialog.
CYourDialog m_Tab1Dialog;
CYourDialog m_Tab2Dialog;
CYourDialog m_Tab3Dialog;
and switch between them
|
|
|
|
|
That's what I'm trying to do, but it doesn't seem to work. Instead when I switch tabs, the dialog goes blank. I think the problem might be that both tabs point to the IDD_INVITATION_LIST_VIEW resource, so when the tab control tries to hide/show the items, it can't hide/show the right ones (because they're the same resource). Does that sound at all correct, or way off?
Header File:
VInvitationListView m_historyListView;
VInvitationListView m_patientListView;
CPP File:
if (m_historyListView.Create(IDD_INVITATION_LIST_VIEW, &m_TabControl) == FALSE)
{
//Log Error and return
}
m_historyListView.ShowWindow(SW_SHOW);
CString str("History List");
m_TabControl.InsertItem(0, str, m_historyListView.GetSafeHwnd());
CXTPTabManagerItem* tab = m_TabControl.GetItem(0);
tab->SetData(eInvitationsTab);
m_TabControl.SetSelectedItem(tab);
m_TabControl.Reposition();
Elsewhere in same CPP File (I only add the second tab in certain scenarios):
if (m_patientListView.Create(IDD_INVITATION_LIST_VIEW, &m_TabControl) == FALSE)
{
//Log Error and return
}
m_patientListView.ShowWindow(SW_SHOW);
m_TabControl.InsertItem(1, sFullFormattedName, m_patientListView.GetSafeHwnd());
CXTPTabManagerItem* tab = m_TabControl.GetItem(1);
tab->SetData(ePatientSpecificTab);
m_TabControl.SetSelectedItem(tab);
m_TabControl.Reposition();
Izk
|
|
|
|
|
Just wanted to follow up and say that I think the problem was the code jock (3rd party) tab control being used after all. I ended up using the CXTTabCtrl instead of the CXTPTabControl. Instead of using the "InsertItem" method, I used "AddControl" and now the tabs seem to work just fine even though they both show the same class (separate instances).
Izk
|
|
|
|
|
Upon further review, CXTPTabControl works just fine. The solution to using the same dialog resource multiple times is to do the following on the create:
m_historyListView.Create(VInvitationListView::IDD, &m_TabControl)
m_patientListView.Create(VInvitationListView::IDD, &m_TabControl)
instead of:
m_historyListView.Create(IDD_INVITATION_LIST_VIEW, &m_TabControl)
m_patientListView.Create(IDD_INVITATION_LIST_VIEW, &m_TabControl)
I don't know the reasoning here, but I think using ::IDD allows the enum to give the windows different resource IDs or control IDs or something. Anyway, lesson learned for me and hopefully it helps someone else. I still think this is at least somewhat related to MFC/VC++ and not just the third party control. Although I never tried it with the standard CTabCtrl to be sure.
Izk
|
|
|
|
|
I'm working on a C project, but all my experience is with C++. Any recommendations for a good C website? Preferably with a good, active community like CodeProject's for questions I might have.
Thanks
|
|
|
|
|
Mark J. Miller wrote: Any recommendations for a good C website?
I'm a pretty avid C programmer myself and I tend to find a lot of use out of CP still. Granted. I can never use much code from most articles as is (not that I would anyway), but the concepts are generally translatable.
What in particular are you after? The C way of life? Differences between C and C++ (like how myFunc(void) is interpreted differently between the two for instance), etc.?
Actually, if you're used to C++ I think it'll benefit you in a procedural world. I think employing some OOP concepts in C (within reason) is a better way of going about things than most traditional procedural texts bother to teach (they never focus on design IMO).
|
|
|
|
|
I have a school project which includes part of the code already written in C. I either need to translate what has been written into C++ or I need a good reference which can tell me how to do in C what I already know in C++.
|
|
|
|
|
I have found on several occasions that doing even a simplistic ( one file == one class ) port of C code to C++ has helped me to understand the code much better than any amount of time spent simply reading it. There are also numerous potential advantages in porting the code from spotting bugs to taking advantage of newer technologies. There's always the risk of introducing new bugs of course but most of this can be offset by being able to test in direct comparison to the original code. If it was me I'd probably C++ the code as straight forwardly as possible, make it work, and then look at ways to improve it if the schedule allowed.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Mark J. Miller wrote: I either need to translate what has been written into C++ or I need a good reference which can tell me how to do in C what I already know in C++.
Actually, you're in luck, one of the design goals of C++ was to be able to compile C code. However, if the program wasn't written with some OOP principles (like treating a file.c as a class, etc.) then a direct port may be an issue.
For the most part you'll feel at home in C, but there are a few gotchas along the way. Here's one link for example:
http://people.cs.uchicago.edu/~iancooke/osstuff/ccc.html[^]
|
|
|
|
|
I am surprised no one pointed this out. If you want to include C code into a C++ project then wrap the C headers in an extern “C” {headers here} block or place the block in the header files themselves (Hint: See the C header file included with C++).
As an alternative you can change the names of the C sources files from “.c” to “.cpp” and they will be compiled as C++. Since C++ is a superset of C, they should compile without any problems. There are some differences you need to look out for, but if you do not need to modify the C code it should be ok. If you need to modify the C code, then either use the block method or learn the minor differences (Hint: sizeof works differently in C).
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Mark J. Miller wrote: Any recommendations for a good C website?
What's wrong with this one? If you are already familar with C++, then there's very little about C that will surprise you.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
May be we should ask Chris to rename the forum as C/C++/VC++
Jemmy : Deadline? Pfft, a real programmer eats deadlines for breakfast. :P
Mark: I thought real programmers ignored deadlines
Best wishes to Rexx[^]
|
|
|
|
|
As always I got what I needed. You guys at CP are the best.
|
|
|
|
|
You've got any questions with Assemblers?
Jemmy : Deadline? Pfft, a real programmer eats deadlines for breakfast. :P
Mark: I thought real programmers ignored deadlines
Best wishes to Rexx[^]
|
|
|
|
|
|
Is there a way to serialize an enumerated type using CArchive?
// I have an enumerated type in my header file and a member of that type,
typedef enum
{
ONE,
TWO,
THREE
} SomeType;
SomeType m_someVariable;
When I try to serialize it in the classes serialize method, I get...
error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'CSomething::SomeType' (or there is no acceptable conversion)
|
|
|
|
|
easiest way is to cast the enum to an int when saving, and cast the int to an enum when loading.
|
|
|
|
|
That's not working for me here. Are you on 6.0 or 2003.
I'm going to try this on a VC++ 6.0 project to see what happens as my current project is in VC++ 2003.
Thanks for the advice either way.
|
|
|
|
|
bob16972 wrote: Are you on 6.0 or 2003
doesn't matter. this is a pretty basic C++ issue, the kind of thing you run into everywhere.
int t;
ar >> t;
enumVal = (enumType)t;
ar << (int)enumVal;
|
|
|
|
|
My apologies.
I would never have suspected that was necessary but I live and learn.
Thank you very much for helping me over that hurdle.
|
|
|
|
|
Do you have something similar to:
class CSomething
{
public:
enum
{
ONE,
TWO,
THREE
} SomeType;
void Serialize( CArchive &ar )
{
if (ar.IsStoring())
ar << (int) SomeType;
else
ar >> (int) SomeType;
}
};
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|