Commit 0292135a authored by Dylan Smith's avatar Dylan Smith Committed by Alexandre Julliard

wordpad: Show error when user tries to add more than max tab stops.

Previously there was no such error, and if more than MAX_TAB_STOPS were added, then some of the tab stops would be silently discarded.
parent b4ea7d32
......@@ -239,5 +239,6 @@ BEGIN
STRING_WRITE_ACCESS_DENIED, "You do not have access to save the file."
STRING_OPEN_FAILED, "Could not open the file."
STRING_OPEN_ACCESS_DENIED, "You do not have access to open the file."
STRING_PRINTING_NOT_IMPLEMENTED, "Printing not implemented"
STRING_PRINTING_NOT_IMPLEMENTED, "Printing not implemented"
STRING_MAX_TAB_STOPS, "Cannot add more than 32 tab stops."
END
......@@ -1636,13 +1636,16 @@ static INT_PTR CALLBACK tabstops_proc(HWND hWnd, UINT message, WPARAM wParam, LP
if(SendMessageW(hTabWnd, CB_FINDSTRINGEXACT, -1, (LPARAM)&buffer) == CB_ERR)
{
float number = 0;
int item_count = SendMessage(hTabWnd, CB_GETCOUNT, 0, 0);
if(!number_from_string(buffer, &number, TRUE))
{
MessageBoxWithResStringW(hWnd, MAKEINTRESOURCEW(STRING_INVALID_NUMBER),
wszAppTitle, MB_OK | MB_ICONINFORMATION);
} else
{
} else if (item_count >= MAX_TAB_STOPS) {
MessageBoxWithResStringW(hWnd, MAKEINTRESOURCEW(STRING_MAX_TAB_STOPS),
wszAppTitle, MB_OK | MB_ICONINFORMATION);
} else {
SendMessageW(hTabWnd, CB_ADDSTRING, 0, (LPARAM)&buffer);
SetWindowTextW(hTabWnd, 0);
}
......
......@@ -200,6 +200,7 @@
#define STRING_OPEN_FAILED 1709
#define STRING_OPEN_ACCESS_DENIED 1710
#define STRING_PRINTING_NOT_IMPLEMENTED 1711
#define STRING_MAX_TAB_STOPS 1712
LPWSTR file_basename(LPWSTR);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment