Re: Edit text fields in child windows
- Posted by Dan Moyer <danielmoyer at prodigy.net> Apr 25, 2007
- 518 views
Rad wrote: > > CChris wrote: > > > > I tried various things, and came up with the following: > > 1/ the window procedure associated to a window with the WS_CHILD flag > > doesn't send the right messages to an edit field when the latter gets mouse > > clicks (and it actually gets them). Edit fields are supposed to appear in > > top level windows or in dialog boxes. > > > > 2/ Edit fields are antiquated components that existed before win 3.0. This > > may explain 1/, and why 1/ doesn't have an easy fix. > > > > 3/ But after all, RichEdit controls are more recent and don't depend so much > > on the parent, so use RichEdit instead of EditText in child windows. > > > > 4/ But you'll have to create them with the right styles, and using > > findText() > > will fail on NT based systems (will be fixed in the next version of > > win32lib). > > Does the code in <a > > href="http://www.listfilter.com/EUforum/m13681.htm">http://www.listfilter.com/EUforum/m13681.htm</a> > > help? See if it works for you. > > > > CChris > > Hi CChris, > > As I would like to use RichEdit in place of the EditText control, is there a > way to limit text to specified characters within one line at the same time not > allowing to move to next line within RichEdit by pressing RETURN key? > > I used "Limit Text To:" property in IDE to set max characters, but I can press > Return key and continue on next line, which I want to avoid. > > Regards, > Rad. Rad, I can't be sure if this will help, nor can I fill in the details right now, but: I think you could set a trap for the enter/return key in some event like w32HKeyDown, or w32HKeyPress, for the RichEdit, and then make the routine have a return if the enter key pressed, which should/might make the enter key be ignored. (ie, if keypressed equal "enter" key, then return from procedure) Dan Moyer