Click here to Skip to main content
15,898,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem Allocating the string? Pin
Luc Pattyn1-Jan-09 4:15
sitebuilderLuc Pattyn1-Jan-09 4:15 
Questionerror LNK2019: unresolved external symbol Pin
zhiyuan1631-Dec-08 21:37
zhiyuan1631-Dec-08 21:37 
AnswerRe: error LNK2019: unresolved external symbol Pin
«_Superman_»31-Dec-08 21:41
professional«_Superman_»31-Dec-08 21:41 
GeneralRe: error LNK2019: unresolved external symbol Pin
zhiyuan1631-Dec-08 21:55
zhiyuan1631-Dec-08 21:55 
GeneralRe: error LNK2019: unresolved external symbol Pin
zhiyuan1631-Dec-08 22:14
zhiyuan1631-Dec-08 22:14 
GeneralRe: error LNK2019: unresolved external symbol Pin
«_Superman_»31-Dec-08 22:21
professional«_Superman_»31-Dec-08 22:21 
QuestionExpand and Collpse Tree on Click of Enter key. Pin
Le@rner31-Dec-08 20:41
Le@rner31-Dec-08 20:41 
AnswerRe: Expand and Collpse Tree on Click of Enter key. Pin
Jijo.Raj1-Jan-09 12:27
Jijo.Raj1-Jan-09 12:27 
You can expand/collapse the tree nodes by pressing the +/- keys. So for mimicking the same behavior for Enter key, override the PreTranslateMessage() of your dialog and handle all keydown messages for your tree control. If the current item is expanded assign the keycode as VK_SUBTRACT to collapse and if its collapsed assign the keycode as VK_ADD to expand. Check the code snippet below.

BOOL CRabbitDlgDlg::PreTranslateMessage(MSG* pMsg) 
{
    // Check whether its a keypress.
    if( pMsg->message == WM_KEYDOWN )
    {
        // Check whether its for our tree control.
        UINT CtrlId = ::GetDlgCtrlID( pMsg->hwnd );
	    if( CtrlId == IDC_TREECTRL )
	    {
            // Check whether its enter key.
            if( pMsg->wParam == VK_RETURN)
            {
                // Check whether the currently selected item is 
                HTREEITEM CurrentItem = m_TreeCtrl.GetSelectedItem();
                if( m_TreeCtrl.GetItemState( CurrentItem, TVIS_EXPANDED ) & TVIS_EXPANDED )
                {
                    // Current Item is Expanded. So send - Key code to collapse it.
                    pMsg->wParam = VK_SUBTRACT;
                }
                else
                {
                    // Current Item is Collapsed. So send + Key code to Expand it.
                    pMsg->wParam = VK_ADD;
                }
            }
        }
	}
	
	return CDialog::PreTranslateMessage(pMsg);
}


Regards,
Jijo.

_____________________________________________________

http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

GeneralRe: Expand and Collpse Tree on Click of Enter key. Pin
Le@rner1-Jan-09 17:25
Le@rner1-Jan-09 17:25 
QuestionCan Debugger show the values in binary form? Pin
Joseph Marzbani31-Dec-08 20:04
Joseph Marzbani31-Dec-08 20:04 
AnswerRe: Can Debugger show the values in binary form? Pin
Nibu babu thomas31-Dec-08 23:09
Nibu babu thomas31-Dec-08 23:09 
AnswerRe: Can Debugger show the values in binary form? Pin
Jijo.Raj1-Jan-09 9:26
Jijo.Raj1-Jan-09 9:26 
GeneralRe: Can Debugger show the values in binary form? Pin
CPallini1-Jan-09 9:33
mveCPallini1-Jan-09 9:33 
GeneralRe: Can Debugger show the values in binary form? Pin
Jijo.Raj1-Jan-09 9:59
Jijo.Raj1-Jan-09 9:59 
GeneralRe: Can Debugger show the values in binary form? Pin
CPallini1-Jan-09 10:32
mveCPallini1-Jan-09 10:32 
QuestionApplication working fine but seems like system has hanged Pin
VCProgrammer31-Dec-08 20:01
VCProgrammer31-Dec-08 20:01 
AnswerRe: Application working fine but seems like system has hanged Pin
Joseph Marzbani31-Dec-08 20:14
Joseph Marzbani31-Dec-08 20:14 
AnswerRe: Application working fine but seems like system has hanged Pin
Jijo.Raj1-Jan-09 0:13
Jijo.Raj1-Jan-09 0:13 
Questioncheckbox in List control and image Pin
vicky0000031-Dec-08 18:32
vicky0000031-Dec-08 18:32 
AnswerRe: checkbox in List control and image Pin
Nibu babu thomas31-Dec-08 23:22
Nibu babu thomas31-Dec-08 23:22 
GeneralRe: checkbox in List control and image Pin
vicky000001-Jan-09 17:45
vicky000001-Jan-09 17:45 
QuestionAccess Violation 0xC0000005 Pin
whiteclouds31-Dec-08 18:14
whiteclouds31-Dec-08 18:14 
AnswerRe: Access Violation 0xC0000005 Pin
Nibu babu thomas31-Dec-08 23:16
Nibu babu thomas31-Dec-08 23:16 
GeneralRe: Access Violation 0xC0000005 Pin
whiteclouds1-Jan-09 12:46
whiteclouds1-Jan-09 12:46 
Questionprocessor affinity Pin
RomTibi31-Dec-08 13:49
RomTibi31-Dec-08 13:49 

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.