[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Accessing html help while an XRC dialog is active
From: |
Vaclav Slavik |
Subject: |
Re: [lmi] Accessing html help while an XRC dialog is active |
Date: |
Tue, 18 Mar 2008 19:38:10 +0100 |
User-agent: |
KMail/1.9.9 |
Greg Chicares wrote:
> Would this work for wxGTK? (We need to make sure lmi works at
> least as well on a free OS as on msw--it's FSF policy.) The wx
> documentation says "on GTK, only menu commands are supported"
> by wxAcceleratorTable, but I'm not sure exactly what that means
> here.
It means that the accelerator emits the same event that is send
when a menu item is selected and not the event sent when a button
is clicked. This turned out to be very easy to fix in wxGTK.
Moreover, I realized that you don't, in fact, need to handle
EVT_BUTTON(wxID_HELP) in MvcController, because wxID_HELP handler
is in Skeleton, so it just has to handle wxID_HELP button events too:
Index: main_wx.cpp
===================================================================
RCS file: /sources/lmi/lmi/main_wx.cpp,v
retrieving revision 1.101
diff -u -u -r1.101 main_wx.cpp
--- main_wx.cpp 2 Mar 2008 03:07:23 -0000 1.101
+++ main_wx.cpp 18 Mar 2008 16:11:13 -0000
@@ -123,6 +127,7 @@
EVT_DROP_FILES( Skeleton::UponDropFiles
)
EVT_MENU(wxID_ABOUT ,Skeleton::UponAbout
)
EVT_MENU(wxID_HELP ,Skeleton::UponHelp
)
+ EVT_BUTTON(wxID_HELP ,Skeleton::UponHelp
)
EVT_MENU(XRCID("edit_default_cell"
),Skeleton::UponEditDefaultCell )
EVT_MENU(XRCID("preferences"
),Skeleton::UponPreferences )
EVT_MENU(XRCID("test_app_status_alert"
),Skeleton::UponTestAppStatus )
Index: mvc_controller.cpp
===================================================================
RCS file: /sources/lmi/lmi/mvc_controller.cpp,v
retrieving revision 1.19
diff -u -u -r1.19 mvc_controller.cpp
--- mvc_controller.cpp 28 Feb 2008 03:39:26 -0000 1.19
+++ mvc_controller.cpp 18 Mar 2008 16:11:14 -0000
@@ -129,6 +129,11 @@
,wxEVT_INIT_DIALOG
,&MvcController::UponInitDialog
);
+
+ // bind F1 to the Help button:
+ wxAcceleratorTable accel;
+ accel.Add(wxAcceleratorEntry(wxACCEL_NORMAL, WXK_F1, wxID_HELP));
+ SetAcceleratorTable(accel);
}
MvcController::~MvcController()
Vaclav
--
PGP key: 0x465264C9, available from http://pgp.mit.edu/