May 08, 2024, 04:09:56 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Forward accelerator keys

Started by Parker, May 21, 2006, 03:05:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Parker

I have an MDI parent window, where accelerators work fine (Ctrl+N=open, Ctrl+O=close, etc), but only when there are no children open. So my question is, how do I forward the accelerators from children to the parent? Should I just add an OnMenuPick that calls parent->OnMenuPick?

Ionic Wind Support Team

Hmm...  Works fine here, are you using the built in message handling?
Ionic Wind Support Team

Parker

Yes, both the parent and children use the OnXxx functions. I did override CodeEditor's (the child window) WndProc to handle WM_SETFOCUS.
CodeEditor::WndProc( unsigned int message, unsigned int wparam, unsigned int lparam )
{
MdiParent *parent;
// This strange code is necessary because my parent is actually the MDI client, whose parent is what we want.
parent = GetWindowLong( GetParent( GetParent( m_hWnd ) ), 0 );
int nindex = 0;
int maxtabs = 0;

if( message == WM_SETFOCUS ) && parent
{
maxtabs = parent->tabs->GetTabCount( );
parent->status->SetPaneText( 0, "Focus: " + buffer.filename );
// Find the tab in the parent that associates with me
while( nindex <= maxtabs )
{
if( parent->tabs->GetItemData( nindex ) == this )
{
parent->tabs->SetSelectedTab( nindex );
break;
}
nindex++;
}
return 0;
}

return MDIChildWnd!!WndProc( message, wparam, lparam );
}


MdiParent has an OnMenuPick method. Could the scintilla control have anything to do with it?

Ionic Wind Support Team

I'll look into it.  Accelarator messages are supposed to be forwarded to the correct window.
Ionic Wind Support Team

Ionic Wind Support Team

OK think I see the problem.  Wait until the next update (rev 3) which I will post this evening.
Ionic Wind Support Team

Parker

Cool, thanks for the speedy fix. Right now it's just my code editor, and it doesn't bother me much. No hurry.