Erich Hoover : hhctrl.ocx: Use the correct values for current_tab when some tabs are disabled.
Alexandre Julliard
julliard at winehq.org
Wed Sep 28 14:45:46 CDT 2011
Module: wine
Branch: master
Commit: 3228b4d1c3a0edca8ac061dc7882ea0255355684
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3228b4d1c3a0edca8ac061dc7882ea0255355684
Author: Erich Hoover <ehoover at mines.edu>
Date: Tue Sep 27 20:00:10 2011 -0600
hhctrl.ocx: Use the correct values for current_tab when some tabs are disabled.
---
dlls/hhctrl.ocx/help.c | 19 ++++++++++++++++++-
dlls/hhctrl.ocx/hhctrl.h | 1 +
2 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c
index d710d3b..fb9ea08 100644
--- a/dlls/hhctrl.ocx/help.c
+++ b/dlls/hhctrl.ocx/help.c
@@ -448,6 +448,7 @@ static LRESULT Child_OnSize(HWND hwnd)
static LRESULT OnTabChange(HWND hwnd)
{
HHInfo *info = (HHInfo*)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
+ int tab_id, tab_index, i;
TRACE("%p\n", hwnd);
@@ -457,7 +458,23 @@ static LRESULT OnTabChange(HWND hwnd)
if(info->tabs[info->current_tab].hwnd)
ShowWindow(info->tabs[info->current_tab].hwnd, SW_HIDE);
- info->current_tab = SendMessageW(info->hwndTabCtrl, TCM_GETCURSEL, 0, 0);
+ tab_id = (int) SendMessageW(info->hwndTabCtrl, TCM_GETCURSEL, 0, 0);
+ /* convert the ID of the tab to an index in our tab list */
+ tab_index = -1;
+ for (i=0; i<TAB_NUMTABS; i++)
+ {
+ if (info->tabs[i].id == tab_id)
+ {
+ tab_index = i;
+ break;
+ }
+ }
+ if (tab_index == -1)
+ {
+ FIXME("Tab ID %d does not correspond to a valid index in the tab list.\n", tab_id);
+ return 0;
+ }
+ info->current_tab = tab_index;
if(info->tabs[info->current_tab].hwnd)
ShowWindow(info->tabs[info->current_tab].hwnd, SW_SHOW);
diff --git a/dlls/hhctrl.ocx/hhctrl.h b/dlls/hhctrl.ocx/hhctrl.h
index 8e63545..3e496f9 100644
--- a/dlls/hhctrl.ocx/hhctrl.h
+++ b/dlls/hhctrl.ocx/hhctrl.h
@@ -111,6 +111,7 @@ typedef struct CHMInfo
#define TAB_INDEX 1
#define TAB_SEARCH 2
#define TAB_FAVORITES 3
+#define TAB_NUMTABS TAB_FAVORITES
typedef struct {
HWND hwnd;
More information about the wine-cvs
mailing list