IonicWind Software

Aurora Compiler => GUI => Topic started by: Parker on May 21, 2006, 03:05:01 PM

Title: Forward accelerator keys
Post by: Parker on May 21, 2006, 03:05:01 PM
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?
Title: Re: Forward accelerator keys
Post by: Ionic Wind Support Team on May 21, 2006, 03:10:27 PM
Hmm...  Works fine here, are you using the built in message handling?
Title: Re: Forward accelerator keys
Post by: Parker on May 21, 2006, 03:18:07 PM
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?
Title: Re: Forward accelerator keys
Post by: Ionic Wind Support Team on May 21, 2006, 03:21:22 PM
I'll look into it.  Accelarator messages are supposed to be forwarded to the correct window.
Title: Re: Forward accelerator keys
Post by: Ionic Wind Support Team on May 21, 2006, 03:26:08 PM
OK think I see the problem.  Wait until the next update (rev 3) which I will post this evening.
Title: Re: Forward accelerator keys
Post by: Parker on May 21, 2006, 03:29:43 PM
Cool, thanks for the speedy fix. Right now it's just my code editor, and it doesn't bother me much. No hurry.