Cycling through the controls

Started by
1 comment, last by Xeee 21 years, 11 months ago
I want to know how to cycle through the controls using tab !! i''ve tried everything , WS_TABSTOP (for the controls) , WS_EX_CONTROLPARENT (for the controls parent) , WS_GROUP (for the parent) and nothin'' worked , should i do it manually with SetFocus!! what is the proper way to do it ? i''m programming in Win32(NO MFC) with VC++ 6.0 , on XP oh btw , i remembered something , does AnimateWindow() operate on windows XP?? thanks for your help ... ...Xeee
xee..
Advertisement
Given that you have N controls with values arranged such that base_number + ( random_number % N ) yields one of the controls' id:
// subclass control with this procedure:LRESULT CALLBACK SubclassProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ){  if( msg == WM_CHAR && wparam == VK_TAB )  {    SetFocus( GetDlgItem( GetParent(hwnd),                          base_number + ( (GetWindowLong(GWL_ID) + 1) % N ) );  }  return 0;  return CallWindowProc( DefaultProc, hwnd, msg, wparam, lparam );}  


[Edit: Left out base_number.]

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!


[edited by - Oluseyi on April 29, 2002 6:04:08 PM]
isn''t there another way , i thought that it can b done automatically , if there isn''t another way , what are WS_TABSTOP and WS_EX_CONTROLPARENT flags for?
i understand your way of doing it , but i just want to know if there''s another way , and y not use it



...Xeee
xee..

This topic is closed to new replies.

Advertisement