user32: Select text control content while setting initial dialog focus
Piotr Caban
piotr.caban at gmail.com
Tue Feb 16 05:32:56 CST 2016
On 02/16/16 09:38, Dmitry Timoshkov wrote:
> Dmitry Timoshkov <dmitry at baikal.ru> wrote:
>
>>>>> --- a/dlls/user32/dialog.c
>>>>> +++ b/dlls/user32/dialog.c
>>>>> @@ -707,7 +707,11 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
>>>>> focus = GetNextDlgTabItem( hwnd, 0, FALSE );
>>>>> if (!focus) focus = GetNextDlgGroupItem( hwnd, 0, FALSE );
>>>>> if (focus)
>>>>> + {
>>>>> + if (SendMessageW( focus, WM_GETDLGCODE, 0, 0 ) & DLGC_HASSETSEL)
>>>>> + SendMessageW( focus, EM_SETSEL, 0, -1 );
>>>>> SetFocus( focus );
>>>>> + }
>>>>> }
>>>> Selecting the text on SetFocus() is the job of DefDlgProc(), it's worth
>>>> to investigate why it doesn't work.
>>>>
>>> It works as expected. Calling SetFocus on edit HWND is not selecting the
>>> text on windows either.
>>>
>>> The text will be selected if you call SetFocus/WM_NEXTDLGCTL on the
>>> dialog window.
>>
>> A message test would be more convincing then.
>
> There is a possibility that it's the edit control who is responsible
> for selecting and deselecting the text on focus events, so more tests
> is required to show what the correct behaviour is.
There already are tests for edit control that show it doesn't select
it's content on focus gain.
I will add more tests for dialog creation messages (mainly to show that
WM_NEXTDLGCTL message is not send).
Thanks,
Piotr
More information about the wine-devel
mailing list