Posted Mon, 21 Jul 2014 23:49:30 GMT in reply to
Mike Wey
Reply
On Wed, 07 Aug 2013 21:38:45 GMT, Mike Wey wrote:
On Wed, 07 Aug 2013 20:58:52 GMT, Mike Wey wrote:
On Wed, 07 Aug 2013 01:08:13 GMT, Joel Christensen wrote:
Yay, it works. I can just hit control + S save my work, and not have to move the mouse at all. Though I used a dummy menu item, that was attached to the grid, but not shown. Is there a better way?
As far as i know the AccelGroup need to be associated with an menuItem to function properly.
This might also work: (i wasn't able to test it)
window.addOnKeyPress(&keyPressCallback);
bool keyPressCallback(Event ev, Widget w)
{
if ( ev.key.keyval == GdkKeysyms.GDK_s
&& ev.key.state == GdkModifierType.CONTROL_MASK )
{
//Do stuff.
return true;
}
return false;
}
I haven't been using GtkD for a while.
I think this code crashes:
_grid.attach(new MenuItem((menuItem) { saveNotesCurrent(); },
"_blar", "blar.blar", true, _accelGroup, 's',
GdkModifierType.CONTROL_MASK, GtkAccelFlags.VISIBLE),0,0,1,1);```
What is a better way to call functions with eg Control + S for save?