|
|
|
date: Sat, 23 Aug 2008 04:04:15 -0700 (PDT),
group: microsoft.public.win32.programmer.ui
back
Edit control does not display border, only after WM_PAINT called
again
Hi,
I need to create a simple EDIT control on a window application,
without using MFC.
This is the code adding the EDIT control, with the WS_BORDER:
HWND hwndEdit = CreateWindow("EDIT",
NULL,
WS_CHILD | WS_VISIBLE | ES_LEFT | ES_AUTOHSCROLL | WS_BORDER,
650,3,120,23,
hwndTB,
(HMENU) SEARCH_EDIT_ID,
(HINSTANCE)(GetWindowLong(hwndTB,GWL_HINSTANCE)),
NULL);
SendMessage(hwndEdit, EM_SETLIMITTEXT, (WPARAM) 30, (LPARAM)
0);
But yet, the edit control has no border.
Only if I minimize & maximize the window (hence calling WM_PAINT) the
border is drawn.
help??
Thanks!!
Gabi
date: Sat, 23 Aug 2008 04:04:15 -0700 (PDT)
author: Gabriela
Re: Edit control does not display border, only after WM_PAINT called again
>I need to create a simple EDIT control on a window application,
>without using MFC.
>This is the code adding the EDIT control, with the WS_BORDER:
>
> HWND hwndEdit = CreateWindow("EDIT",
> NULL,
> WS_CHILD | WS_VISIBLE | ES_LEFT | ES_AUTOHSCROLL | WS_BORDER,
> 650,3,120,23,
> hwndTB,
> (HMENU) SEARCH_EDIT_ID,
> (HINSTANCE)(GetWindowLong(hwndTB,GWL_HINSTANCE)),
> NULL);
>
> SendMessage(hwndEdit, EM_SETLIMITTEXT, (WPARAM) 30, (LPARAM)
>0);
>
>But yet, the edit control has no border.
>Only if I minimize & maximize the window (hence calling WM_PAINT) the
>border is drawn.
That seems odd.
Have you tried using SetWindowPos with SWP_DRAWFRAME?
Dave
date: Sat, 23 Aug 2008 16:30:59 +0100
author: David Lowndes lid
Re: Edit control does not display border, only after WM_PAINT called again
>I tried
>SetWindowPos(hwndEdit,HWND_TOP,650,3,120,23,SWP_DRAWFRAME);
>- but it didn't help...
Gabi,
I've tried your code snippet by adding it to the WM_INITDIALOG handler
of the About dialog of the generic SDK Windows application generated
by Visual Studio, and I don't see any problem (tested under XP).
You're not by any chance expecting to see the beveled type border that
you normally get when you place an edit control on a dialog are you?
If you are, change your code to:
hwndEdit = CreateWindowEx( WS_EX_CLIENTEDGE,
_T("EDIT"),
...
Dave
date: Mon, 25 Aug 2008 10:28:18 +0100
author: David Lowndes lid
|
|