Why mfc dialogs are changed suddenly when I clicked any lines in grid

41 Views Asked by At

I developing MFC programs which has main grid and many dialogs what are placed right and right-bottom side.

when I clicked any lines in main grid sometime right-bottom position's dialogs are changed suddenly though I never click any button what connected with dialogs. that dialogs are located in same position exactly and there are buttons on the dialogs it working for changing dialogs. that's working like tab but that's not tab.

I wrote code using SetWindowPos for show/hide dialogs like under lines

SetWindowPos(GetParent() , x.left, x.top, width, height, SWP_SHOWWINDOW | SWP_NOZORDER );

GetDlgItem(IDC_BTS_EDIT)->EnableWindow(m_bActive);
GetDlgItem(IDC_BTS_INSERT)->EnableWindow(m_bActive);
GetDlgItem(IDC_BTS_DELETE)->EnableWindow(m_bActive);

When I use SetWindowPos, that issue was appeared. someday, I thought If GetParent() is changed NULL and replace ShowWindow, maybe that problem will be solved. so I changed SetWindowPos like

SetWindowPos(NULL, x.left, x.top, width,  height, true); 

GetDlgItem(IDC_BTS_EDIT)->EnableWindow(m_bActive);
GetDlgItem(IDC_BTS_INSERT)->EnableWindow(m_bActive);
GetDlgItem(IDC_BTS_DELETE)->EnableWindow(m_bActive);

m_page.ShowWindow(SW_SHOW)

that issue was solved. but I am really curious why dialogs are changed when I clicked lines in grid. Even though I solved this problem but I don't know root cause until now.

already explain issues

0

There are 0 best solutions below