Click here to Skip to main content
15,926,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ZOrder Pin
The_Server24-Dec-01 20:36
The_Server24-Dec-01 20:36 
GeneralRe: ZOrder Pin
Fazlul Kabir25-Dec-01 2:41
Fazlul Kabir25-Dec-01 2:41 
GeneralRe: ZOrder Pin
The_Server26-Dec-01 0:30
The_Server26-Dec-01 0:30 
GeneralRe: ZOrder Pin
Fazlul Kabir26-Dec-01 2:01
Fazlul Kabir26-Dec-01 2:01 
GeneralRe: ZOrder Pin
The_Server26-Dec-01 2:41
The_Server26-Dec-01 2:41 
GeneralRe: ZOrder Pin
Fazlul Kabir26-Dec-01 3:39
Fazlul Kabir26-Dec-01 3:39 
GeneralRe: ZOrder Pin
The_Server26-Dec-01 4:04
The_Server26-Dec-01 4:04 
GeneralRe: ZOrder Pin
Fazlul Kabir26-Dec-01 6:16
Fazlul Kabir26-Dec-01 6:16 
In fact the tab order method does work if you create your button on the dialog using VC++ resource editor (instead of creating them dynamically using CButton::Create(..) method). To make your button to appear on the top, make its Z-order as 1.

I see the problem when you create the control dynamically. As a workaround, you can override WM_CTLCOLOR message of the dialog and call a RedrawWindow() method for the new button. So the complete code will look like this..

void CDlg::OnButton1() 
{
	m_Button.Create("ASD", WS_CHILD | WS_VISIBLE | WS_TABSTOP, CRect(20,20,200,200), this, 12345);
	m_Button.BringWindowToTop();
}

HBRUSH CDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	if(m_Button.GetSafeHwnd())
		m_Button.RedrawWindow();
	return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
}

Though the solution will do what you need, I will try to find a better solution. Let me know if this is okay with you, at least for now.

// Fazlul


Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com

GeneralRe: ZOrder Pin
The_Server27-Dec-01 8:41
The_Server27-Dec-01 8:41 
GeneralRe: ZOrder Pin
Fazlul Kabir28-Dec-01 2:22
Fazlul Kabir28-Dec-01 2:22 
GeneralRe: ZOrder Pin
The_Server29-Dec-01 23:20
The_Server29-Dec-01 23:20 
GeneralRe: ZOrder Pin
The_Server24-Dec-01 20:40
The_Server24-Dec-01 20:40 
GeneralMySql with VC++ Pin
Sonu Kapoor20-Dec-01 0:52
Sonu Kapoor20-Dec-01 0:52 
GeneralRe: MySql with VC++ Pin
markkuk20-Dec-01 1:33
markkuk20-Dec-01 1:33 
GeneralRe: MySql with VC++ Pin
Sonu Kapoor20-Dec-01 1:53
Sonu Kapoor20-Dec-01 1:53 
GeneralRe: MySql with VC++ Pin
markkuk20-Dec-01 2:17
markkuk20-Dec-01 2:17 
GeneralRe: MySql with VC++ Pin
Leifen20-Dec-01 2:13
Leifen20-Dec-01 2:13 
GeneralRe: MySql with VC++ Pin
Carlos Antollini20-Dec-01 3:06
Carlos Antollini20-Dec-01 3:06 
General3 simple questions Pin
Chambers20-Dec-01 0:34
Chambers20-Dec-01 0:34 
GeneralRe: 3 simple questions Pin
Bernhard20-Dec-01 1:49
Bernhard20-Dec-01 1:49 
GeneralRe: 3 simple questions Pin
Chambers20-Dec-01 4:04
Chambers20-Dec-01 4:04 
GeneralRe: 3 simple questions Pin
Ravi Bhavnani20-Dec-01 8:09
professionalRavi Bhavnani20-Dec-01 8:09 
GeneralFind the File properties Pin
Sonu Kapoor19-Dec-01 23:58
Sonu Kapoor19-Dec-01 23:58 
GeneralRe: Find the File properties Pin
Nish Nishant20-Dec-01 0:31
sitebuilderNish Nishant20-Dec-01 0:31 
GeneralRe: Find the File properties Pin
Ravi Bhavnani20-Dec-01 8:13
professionalRavi Bhavnani20-Dec-01 8:13 

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.