1. edit window select all text

------=_NextPart_000_0034_01C0159F.4C012260
        charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

Does anybody know how do I select all text in simple singleline edit =
window within my program? I tried with EM_SETSEL messsage but it doesn't =
work. I want all text to be selected when edit window gets WM_SETFOCUS =
message (when you first click with mouse in it).=20

I have this code in my EditWndProcedure:

---------start code

if msg=3DWM_SETFOCUS then
    --this should work but it doesn't
  ok=3DSendMessage(hwnd,EM_SETSEL,0,
    SendMessage(hwnd,WM_GETTEXTLENGTH,0,0))


    --this should also work but it doesn't =20
ok=3DSendMessage(hwnd,WM_LBUTTONDBLCLK,0,
   0)
--  ok=3DSetFocus(hwnd)
--  return 1
 =20
 end if

---------end code

I need it becuase I am making my own ComboBox and other controls because =
those of Windows are so damn complicated to use and so slow! In two days =
I have ComBobox (with images) almost complete and Scroll more than half =
finished, it's easy!

------=_NextPart_000_0034_01C0159F.4C012260
        charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-2" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DVerdana size=3D2>Does&nbsp;anybody know&nbsp;how =
do&nbsp;I select=20
all text in simple singleline edit window within my program? I tried =
with=20
EM_SETSEL messsage but it doesn't work. I want all text to be selected =
when edit=20
window gets WM_SETFOCUS message (when you first click with mouse in it). =

</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>I have this code in my=20
EditWndProcedure:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>
<DIV><FONT face=3DVerdana size=3D2>---------start code</FONT></DIV>
<DIV>&nbsp;</DIV></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>if msg=3DWM_SETFOCUS =
then</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><U>&nbsp;&nbsp;&nbsp; --this should =
work but it=20
>
<DIV><FONT face=3DVerdana size=3D2>&nbsp;&nbsp;&nbsp;=20
<DIV><FONT face=3DVerdana size=3D2><BR>&nbsp;</DIV></FONT>
<DIV><FONT face=3DVerdana size=3D2><U><FONT face=3DVerdana =
size=3D2>&nbsp;&nbsp;&nbsp;=20
--this should also work but it =
doesn't</FONT>&nbsp;&nbsp;</U></FONT></DIV>
<DIV><FONT face=3DVerdana=20
)</FONT></DIV>
<DIV><FONT face=3DVerdana=20
1<BR>&nbsp;&nbsp;<BR>&nbsp;end if</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>---------end code</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>
<DIV><FONT face=3DVerdana size=3D2>I need it becuase I am making my own =
ComboBox and=20
other controls because those of Windows are so damn complicated to use =
and so=20
slow! In two days I have ComBobox (with images) almost complete and =
Scroll more=20

------=_NextPart_000_0034_01C0159F.4C012260--

new topic     » topic index » view message » categorize

2. Re: edit window select all text

=A9koda wrote:

> Does anybody know how do I select all text in simple
> singleline edit window within my program? I tried with
> EM_SETSEL messsage but it doesn't work.

According to the Win32 help file:

   "If the nStart parameter is 0 and the nEnd parameter is -1,
     all the text in the edit control is selected."

My guess is that:

   ok =3D SendMessage(hwnd,EM_SETSEL,0,-1)

should work.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu