Click here to Skip to main content
16,005,124 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Display a MessageBox in CDialog::OnActivate() Pin
Chris Ormerod2-Dec-03 18:22
Chris Ormerod2-Dec-03 18:22 
GeneralQuestion regarding inheritance Pin
lsanil2-Dec-03 17:24
lsanil2-Dec-03 17:24 
GeneralRe: Question regarding inheritance Pin
Christian Graus2-Dec-03 17:29
protectorChristian Graus2-Dec-03 17:29 
GeneralRe: Question regarding inheritance Pin
lsanil2-Dec-03 18:57
lsanil2-Dec-03 18:57 
GeneralRe: Question regarding inheritance Pin
lsanil2-Dec-03 19:05
lsanil2-Dec-03 19:05 
QuestionCFormView: adding a CHeaderCtrl? Pin
ckorda2-Dec-03 16:48
ckorda2-Dec-03 16:48 
AnswerRe: CFormView: adding a CHeaderCtrl? Pin
Monty22-Dec-03 19:09
Monty22-Dec-03 19:09 
GeneralRe: CFormView: adding a CHeaderCtrl? Pin
ckorda4-Dec-03 11:43
ckorda4-Dec-03 11:43 
Thank you! The fix almost works, but there's one serious problem. About half the time, when I press Alt-N to create a new document, the view overwrites my header. Would it help if I sent you my test project? At this point it's just a few lines really.

Also I don't understand why my CHeaderCtrl's captions displaying in bold instead of the usual system font? I assume CListCtrl does something that I'm not doing, but I can't figure out what.

~CK

PS here's my OnCreate and OnSize code:

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// create header control
CRect r;
GetClientRect(r);
r.bottom = HEADER_HEIGHT;
m_Hdr.Create(WS_CHILD | WS_VISIBLE, r, this, 0);
HDITEM hdi;
const cols = 3;
LPCSTR str[cols] = {"Volume", "Pan", "Pitch"};
int wid[cols] = {172, 172, 172};
hdi.mask = HDI_TEXT | HDI_WIDTH | HDI_FORMAT;
hdi.fmt = HDF_LEFT | HDF_STRING;
for (int i = 0; i < cols; i++) {
hdi.pszText = (char *)str[i];
hdi.cchTextMax = strlen(str[i]);
hdi.cxy = wid[i];
m_Hdr.InsertItem(i, &hdi);
}

return 0;
}

void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWnd::OnSize(nType, cx, cy);

// shrink view vertically to make room for header
CView *vp = GetActiveView();
if (vp != NULL) { // need this or it crashes
CRect r;
vp->GetWindowRect(r);
ScreenToClient(r);
r.top += HEADER_HEIGHT;
vp->MoveWindow(r);
}
// stretch header horizontally to fill our client area
if (IsWindowVisible()) { // need this or it crashes
CRect r, cr;
GetClientRect(cr);
m_Hdr.GetWindowRect(r);
ScreenToClient(r);
r.right = cr.right;
m_Hdr.MoveWindow(r);
}
}
GeneralRe: CFormView: adding a CHeaderCtrl? Pin
Monty25-Dec-03 20:28
Monty25-Dec-03 20:28 
GeneralArrows keys Pin
Gagnon Claude2-Dec-03 16:00
Gagnon Claude2-Dec-03 16:00 
GeneralRe: Arrows keys Pin
Antti Keskinen3-Dec-03 3:07
Antti Keskinen3-Dec-03 3:07 
Generalabout record voice Pin
yingkou2-Dec-03 15:39
yingkou2-Dec-03 15:39 
GeneralRe: about record voice Pin
Peter Molnar3-Dec-03 14:45
Peter Molnar3-Dec-03 14:45 
Generalproject problem Pin
coda_x2-Dec-03 15:13
coda_x2-Dec-03 15:13 
GeneralRe: project problem Pin
Terry O'Nolley2-Dec-03 15:39
Terry O'Nolley2-Dec-03 15:39 
GeneralRe: project problem Pin
coda_x2-Dec-03 16:46
coda_x2-Dec-03 16:46 
Generalextracting clip from an avi or any other file Pin
hina_askh2-Dec-03 14:55
hina_askh2-Dec-03 14:55 
GeneralMACROS. Pin
WREY2-Dec-03 14:38
WREY2-Dec-03 14:38 
GeneralRe: MACROS. Pin
Christian Graus2-Dec-03 17:33
protectorChristian Graus2-Dec-03 17:33 
GeneralRe: MACROS. Pin
WREY2-Dec-03 18:10
WREY2-Dec-03 18:10 
GeneralRe: MACROS. Pin
Christian Graus3-Dec-03 8:36
protectorChristian Graus3-Dec-03 8:36 
GeneralRe: MACROS. Pin
Bob Stanneveld2-Dec-03 21:09
Bob Stanneveld2-Dec-03 21:09 
GeneralRe: MACROS. Pin
WREY3-Dec-03 6:53
WREY3-Dec-03 6:53 
Questioncan wmi-client access the remote wmi on a machine outside of lan network? Pin
Habbit2-Dec-03 13:21
Habbit2-Dec-03 13:21 
GeneralFile Dialog after dialog creation Pin
act_x2-Dec-03 10:28
act_x2-Dec-03 10:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.