[BUG_FIXED] (Author: Pekka Pöyry) Fix focus order by TAB key in preference dialog.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1004 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-01-08 01:35:09 +00:00
parent 18737c7ccd
commit 37bac16aff
5 changed files with 67 additions and 41 deletions

View File

@ -31,7 +31,7 @@
IDD_REGEXT_BOX DIALOGEX 0, 0, 370, 180 IDD_REGEXT_BOX DIALOGEX 0, 0, 370, 180
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | DS_CONTROL
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1 FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
BEGIN BEGIN
LTEXT "Supported exts :",IDC_SUPPORTEDEXTS_STATIC,113,18,77,8 LTEXT "Supported exts :",IDC_SUPPORTEDEXTS_STATIC,113,18,77,8

View File

@ -166,6 +166,8 @@ void URLCtrl::create(HWND itemHandle, TCHAR * link, COLORREF linkColor)
// associate the URL structure with the static control // associate the URL structure with the static control
::SetWindowLongPtr(itemHandle, GWLP_USERDATA, (LONG_PTR)this); ::SetWindowLongPtr(itemHandle, GWLP_USERDATA, (LONG_PTR)this);
// save hwnd
_hSelf = itemHandle;
} }
void URLCtrl::create(HWND itemHandle, int cmd, HWND msgDest) void URLCtrl::create(HWND itemHandle, int cmd, HWND msgDest)
{ {
@ -183,6 +185,9 @@ void URLCtrl::create(HWND itemHandle, int cmd, HWND msgDest)
// associate the URL structure with the static control // associate the URL structure with the static control
::SetWindowLongPtr(itemHandle, GWLP_USERDATA, (LONG_PTR)this); ::SetWindowLongPtr(itemHandle, GWLP_USERDATA, (LONG_PTR)this);
// save hwnd
_hSelf = itemHandle;
} }
void URLCtrl::destroy() void URLCtrl::destroy()
@ -192,6 +197,32 @@ void URLCtrl::destroy()
if(_hCursor) if(_hCursor)
::DestroyCursor(_hCursor); ::DestroyCursor(_hCursor);
} }
void URLCtrl::action()
{
if (_cmdID)
{
::SendMessage(_msgDest?_msgDest:_hParent, WM_COMMAND, _cmdID, 0);
}
else
{
_linkColor = _visitedColor;
::InvalidateRect(_hSelf, 0, 0);
::UpdateWindow(_hSelf);
// Open a browser
if(_URL != TEXT(""))
{
::ShellExecute(NULL, TEXT("open"), _URL.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
else
{
TCHAR szWinText[MAX_PATH];
::GetWindowText(_hSelf, szWinText, MAX_PATH);
::ShellExecute(NULL, TEXT("open"), szWinText, NULL, NULL, SW_SHOWNORMAL);
}
}
}
LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{ {
@ -278,33 +309,27 @@ LRESULT URLCtrl::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
if(_clicking) if(_clicking)
{ {
_clicking = false; _clicking = false;
if (_cmdID)
{
::SendMessage(_msgDest?_msgDest:_hParent, WM_COMMAND, _cmdID, 0);
}
else
{
_linkColor = _visitedColor;
::InvalidateRect(hwnd, 0, 0);
::UpdateWindow(hwnd);
// Open a browser action();
if(_URL != TEXT(""))
{
::ShellExecute(NULL, TEXT("open"), _URL.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
else
{
TCHAR szWinText[MAX_PATH];
::GetWindowText(hwnd, szWinText, MAX_PATH);
::ShellExecute(NULL, TEXT("open"), szWinText, NULL, NULL, SW_SHOWNORMAL);
}
}
} }
break; break;
//Support using space to activate this object
case WM_KEYDOWN:
if(wParam == VK_SPACE)
_clicking = true;
break;
case WM_KEYUP:
if(wParam == VK_SPACE && _clicking)
{
_clicking = false;
action();
}
break;
// A standard static control returns HTTRANSPARENT here, which // A standard static control returns HTTRANSPARENT here, which
// prevents us from receiving any mouse messages. So, return // prevents us from receiving any mouse messages. So, return
// HTCLIENT instead. // HTCLIENT instead.

View File

@ -37,7 +37,8 @@ public:
void create(HWND itemHandle, TCHAR * link, COLORREF linkColor = RGB(0,0,255)); void create(HWND itemHandle, TCHAR * link, COLORREF linkColor = RGB(0,0,255));
void create(HWND itemHandle, int cmd, HWND msgDest = NULL); void create(HWND itemHandle, int cmd, HWND msgDest = NULL);
void destroy(); void destroy();
private:
void action();
protected : protected :
generic_string _URL; generic_string _URL;
HFONT _hfUnderlined; HFONT _hfUnderlined;

View File

@ -43,11 +43,11 @@ BEGIN
END END
IDD_PREFERENCE_BAR_BOX DIALOGEX 0, 0, 455, 185 IDD_PREFERENCE_BAR_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | DS_CONTROL
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
GROUPBOX "Toolbar",IDC_TOOLBAR_GB_STATIC,57,45,147,68,BS_CENTER GROUPBOX "Toolbar",IDC_TOOLBAR_GB_STATIC,57,45,147,68,BS_CENTER
CONTROL "Hide",IDC_CHECK_HIDE,"Button",BS_AUTOCHECKBOX,64,55,94,10 CONTROL "Hide",IDC_CHECK_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,64,55,94,10
CONTROL "Small icons",IDC_RADIO_SMALLICON,"Button",BS_AUTORADIOBUTTON,64,69,114,10 CONTROL "Small icons",IDC_RADIO_SMALLICON,"Button",BS_AUTORADIOBUTTON,64,69,114,10
CONTROL "Big icons",IDC_RADIO_BIGICON,"Button",BS_AUTORADIOBUTTON,64,83,109,10 CONTROL "Big icons",IDC_RADIO_BIGICON,"Button",BS_AUTORADIOBUTTON,64,83,109,10
CONTROL "Standard icons",IDC_RADIO_STANDARD,"Button",BS_AUTORADIOBUTTON,64,97,119,10 CONTROL "Standard icons",IDC_RADIO_STANDARD,"Button",BS_AUTORADIOBUTTON,64,97,119,10
@ -67,15 +67,15 @@ BEGIN
CONTROL "Show status bar",IDC_CHECK_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,58,163,130,10 CONTROL "Show status bar",IDC_CHECK_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,58,163,130,10
GROUPBOX "Menu Bar",IDC_MENUBAR_GB_STATIC,57,117,147,40,BS_CENTER GROUPBOX "Menu Bar",IDC_MENUBAR_GB_STATIC,57,117,147,40,BS_CENTER
CONTROL "Hide (use Alt or F10 key to toggle)",IDC_CHECK_HIDEMENUBAR, CONTROL "Hide (use Alt or F10 key to toggle)",IDC_CHECK_HIDEMENUBAR,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE,64,127,135,25 "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,64,127,135,25
GROUPBOX "Localization",IDC_LOCALIZATION_GB_STATIC,57,6,147,35,BS_CENTER GROUPBOX "Localization",IDC_LOCALIZATION_GB_STATIC,57,6,147,35,BS_CENTER
COMBOBOX IDC_COMBO_LOCALIZATION,68,20,119,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_LOCALIZATION,68,20,119,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Document List Panel",IDC_DOCSWITCH_GB_STATIC,223,6,176,27,BS_CENTER GROUPBOX "Document List Panel",IDC_DOCSWITCH_GB_STATIC,223,6,176,27,BS_CENTER
CONTROL "Show",IDC_CHECK_DOCSWITCH,"Button",BS_AUTOCHECKBOX | BS_MULTILINE,230,15,89,14 CONTROL "Show",IDC_CHECK_DOCSWITCH,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,230,15,89,14
END END
IDD_PREFERENCE_MARGEIN_BOX DIALOGEX 0, 0, 455, 185 IDD_PREFERENCE_MARGEIN_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | DS_CONTROL
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
GROUPBOX "Folder Margin Style",IDC_FMS_GB_STATIC,44,48,83,89,BS_CENTER GROUPBOX "Folder Margin Style",IDC_FMS_GB_STATIC,44,48,83,89,BS_CENTER
@ -89,7 +89,7 @@ BEGIN
CONTROL "Enable current line highlighting",IDC_CHECK_CURRENTLINEHILITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,296,137,129,10 CONTROL "Enable current line highlighting",IDC_CHECK_CURRENTLINEHILITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,296,137,129,10
CONTROL "Show vertical edge",IDC_CHECK_SHOWVERTICALEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,151,60,122,10 CONTROL "Show vertical edge",IDC_CHECK_SHOWVERTICALEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,151,60,122,10
RTEXT "Number of columns :",IDC_NBCOLONE_STATIC,146,108,83,8 RTEXT "Number of columns :",IDC_NBCOLONE_STATIC,146,108,83,8
LTEXT "0",IDC_COLONENUMBER_STATIC,236,107,18,8 LTEXT "0",IDC_COLONENUMBER_STATIC,236,107,18,8,SS_LEFT | WS_TABSTOP
GROUPBOX "Vertical Edge Settings",IDC_VES_GB_STATIC,140,48,148,77,BS_CENTER GROUPBOX "Vertical Edge Settings",IDC_VES_GB_STATIC,140,48,148,77,BS_CENTER
CONTROL "Line mode",IDC_RADIO_LNMODE,"Button",BS_AUTORADIOBUTTON,154,76,91,10 CONTROL "Line mode",IDC_RADIO_LNMODE,"Button",BS_AUTORADIOBUTTON,154,76,91,10
CONTROL "Background mode",IDC_RADIO_BGMODE,"Button",BS_AUTORADIOBUTTON,154,90,91,10 CONTROL "Background mode",IDC_RADIO_BGMODE,"Button",BS_AUTORADIOBUTTON,154,90,91,10
@ -114,7 +114,7 @@ BEGIN
END END
IDD_PREFERENCE_SETTING_BOX DIALOGEX 0, 0, 455, 185 IDD_PREFERENCE_SETTING_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | DS_CONTROL
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
CONTROL "Enable",IDC_CHECK_ENABLEDOCSWITCHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,15,69,10 CONTROL "Enable",IDC_CHECK_ENABLEDOCSWITCHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,15,69,10
@ -144,7 +144,7 @@ BEGIN
END END
IDD_PREFERENCE_NEWDOCSETTING_BOX DIALOGEX 0, 0, 455, 185 IDD_PREFERENCE_NEWDOCSETTING_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | DS_CONTROL
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
GROUPBOX "New Document",IDC_NEWDOCUMENT_GR_STATIC,7,2,195,178,BS_CENTER GROUPBOX "New Document",IDC_NEWDOCUMENT_GR_STATIC,7,2,195,178,BS_CENTER
@ -177,7 +177,7 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,79,124,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,79,124,10
GROUPBOX "Recent Files History",IDC_HISTORY_GB_STATIC,213,69,232,110,BS_CENTER GROUPBOX "Recent Files History",IDC_HISTORY_GB_STATIC,213,69,232,110,BS_CENTER
RTEXT "Max. number of entries :",IDC_MAXNBFILE_STATIC,217,91,112,8 RTEXT "Max. number of entries :",IDC_MAXNBFILE_STATIC,217,91,112,8
LTEXT "0",IDC_MAXNBFILEVAL_STATIC,338,91,15,8 LTEXT "0",IDC_MAXNBFILEVAL_STATIC,338,91,15,8,SS_LEFT | WS_TABSTOP
CONTROL "Don't check at launch time",IDC_CHECK_DONTCHECKHISTORY, CONTROL "Don't check at launch time",IDC_CHECK_DONTCHECKHISTORY,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,221,78,140,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,221,78,140,10
GROUPBOX "Display",IDC_STATIC,226,103,207,69,BS_CENTER GROUPBOX "Display",IDC_STATIC,226,103,207,69,BS_CENTER
@ -186,12 +186,12 @@ BEGIN
CONTROL "Full File Name Path",IDC_RADIO_FULLFILENAMEPATH,"Button",BS_AUTORADIOBUTTON,235,144,109,10 CONTROL "Full File Name Path",IDC_RADIO_FULLFILENAMEPATH,"Button",BS_AUTORADIOBUTTON,235,144,109,10
CONTROL "Customize Maximum Length:",IDC_RADIO_CUSTOMIZELENTH, CONTROL "Customize Maximum Length:",IDC_RADIO_CUSTOMIZELENTH,
"Button",BS_AUTORADIOBUTTON,235,157,114,10 "Button",BS_AUTORADIOBUTTON,235,157,114,10
LTEXT "0",IDC_CUSTOMIZELENGTHVAL_STATIC,353,158,18,8 LTEXT "0",IDC_CUSTOMIZELENGTHVAL_STATIC,353,158,18,8,SS_LEFT | WS_TABSTOP
END END
IDD_PREFERENCE_LANG_BOX DIALOGEX 0, 0, 455, 185 IDD_PREFERENCE_LANG_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | DS_CONTROL
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
GROUPBOX "Language Menu",IDC_CHECK_LANGMENU_GR_STATIC,37,3,220,172,BS_CENTER GROUPBOX "Language Menu",IDC_CHECK_LANGMENU_GR_STATIC,37,3,220,172,BS_CENTER
@ -208,13 +208,13 @@ BEGIN
GROUPBOX "",IDC_GR_TABVALUE_STATIC,295,125,110,42,BS_CENTER GROUPBOX "",IDC_GR_TABVALUE_STATIC,295,125,110,42,BS_CENTER
CONTROL "Use default value",IDC_CHECK_DEFAULTTABVALUE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,291,125,85,10 CONTROL "Use default value",IDC_CHECK_DEFAULTTABVALUE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,291,125,85,10
RTEXT "Tab size : ",IDC_TABSIZE_STATIC,296,138,58,8 RTEXT "Tab size : ",IDC_TABSIZE_STATIC,296,138,58,8
LTEXT "0",IDC_TABSIZEVAL_STATIC,356,138,18,8 LTEXT "0",IDC_TABSIZEVAL_STATIC,356,138,18,8,SS_LEFT | WS_TABSTOP
LTEXT "0",IDC_TABSIZEVAL_DISABLE_STATIC,356,138,18,8 LTEXT "0",IDC_TABSIZEVAL_DISABLE_STATIC,356,138,18,8
CONTROL "Replace by space",IDC_CHECK_REPLACEBYSPACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,303,149,100,10 CONTROL "Replace by space",IDC_CHECK_REPLACEBYSPACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,303,149,100,10
END END
IDD_PREFERENCE_PRINT_BOX DIALOGEX 0, 0, 455, 185 IDD_PREFERENCE_PRINT_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | DS_CONTROL
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
CONTROL "WYSIWYG",IDC_RADIO_WYSIWYG,"Button",BS_AUTORADIOBUTTON,12,30,123,10 CONTROL "WYSIWYG",IDC_RADIO_WYSIWYG,"Button",BS_AUTORADIOBUTTON,12,30,123,10
@ -271,7 +271,7 @@ END
*/ */
IDD_PREFERENCE_BACKUP_BOX DIALOGEX 0, 0, 455, 185 IDD_PREFERENCE_BACKUP_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | DS_CONTROL
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
GROUPBOX "Backup",IDC_BACKUPDIR_GRP_STATIC,79,11,289,86,BS_CENTER GROUPBOX "Backup",IDC_BACKUPDIR_GRP_STATIC,79,11,289,86,BS_CENTER
@ -289,7 +289,7 @@ BEGIN
CONTROL "Function completion",IDD_AUTOC_FUNCRADIO,"Button",BS_AUTORADIOBUTTON | WS_GROUP,111,128,145,10 CONTROL "Function completion",IDD_AUTOC_FUNCRADIO,"Button",BS_AUTORADIOBUTTON | WS_GROUP,111,128,145,10
CONTROL "Word completion",IDD_AUTOC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,111,144,145,10 CONTROL "Word completion",IDD_AUTOC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,111,144,145,10
RTEXT "From",IDD_AUTOC_STATIC_FROM,241,114,47,8 RTEXT "From",IDD_AUTOC_STATIC_FROM,241,114,47,8
CTEXT "1",IDD_AUTOC_STATIC_N,292,114,8,8 CTEXT "1",IDD_AUTOC_STATIC_N,292,114,8,8,SS_CENTER | WS_TABSTOP
LTEXT "th character",IDD_AUTOC_STATIC_CHAR,306,114,57,8 LTEXT "th character",IDD_AUTOC_STATIC_CHAR,306,114,57,8
LTEXT "Valid value : 1 - 9",IDD_AUTOC_STATIC_NOTE,271,124,93,8 LTEXT "Valid value : 1 - 9",IDD_AUTOC_STATIC_NOTE,271,124,93,8
CONTROL "Function parameters hint on input",IDD_FUNC_CHECK, CONTROL "Function parameters hint on input",IDD_FUNC_CHECK,

View File

@ -72,7 +72,7 @@ void TabBar::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTraditio
int multiLine = isMultiLine?(_isTraditional?TCS_MULTILINE:0):0; int multiLine = isMultiLine?(_isTraditional?TCS_MULTILINE:0):0;
int style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE |\ int style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE |\
TCS_FOCUSNEVER | TCS_TABS | vertical | multiLine; TCS_FOCUSNEVER | TCS_TABS | WS_TABSTOP | vertical | multiLine;
_hSelf = ::CreateWindowEx( _hSelf = ::CreateWindowEx(
0, 0,