Re: Mouse clicks in EditText with CWindow as Parent
- Posted by Judith Evans <camping at ccewb.net> Apr 18, 2007
- 623 views
CChris wrote: > > CChris wrote: > > > > Judith Evans wrote: > > > > > > Rad wrote: > > > > > > > The EditText controls do not get focus with mouse clicks when their > > > > parent is > > > > ChildWindow control. One can neither click and place the cursor on > > > > them, nor can select a part or full text present in it. > > > > > > One response was that this could be an IDE issue. > > > > > > Here is a sample of what IDE produces. > > > > > > }}} <eucode> > > > include Win32Lib.ew > > > without warning > > > > > > > > > -------------------------------------------------------------------------------- > > > -- Window Window1 > > > constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, > > > 300, 0, 0 ) > > > constant CWindow3 = createEx( Window, "", Window1, 56, 24, 200, 100, > > > w32or_all({WS_CHILD}), > > > 0 ) > > > openWindow(CWindow3, Normal) > > > constant EditText4 = createEx( EditText, "EditText4", CWindow3, 8, 28, 48, > > > 20, 0, 0 ) > > > --------------------------------------------------------- > > > > > > > > > WinMain( Window1,Normal ) > > > </eucode> {{{ > > > > > > I've moved the createEx statements for CWindow3 and the EditText4 as well > > > as > > > the openWindow(CWindow3, Normal) to an w32HOpen event or w32HActivate > > > event > > > and the EditText still does not respond. > > > > > > What needs to be changed in this program or in win32lib for this exw to > > > work? > > > > Did you test this snippet with any of the "patch #67" versions? Or is the > > problem the same even there, with modified processing of focus (some of > > them due to Sascha Zindel)? > > > > An explicit setFocus(EditText4) sets everything right. My working > > version is not stable right now, so I didn't attempt to run this. > > > > Note that setFocus(CWindow3) doesn't work, and the setFocus(EditText4) > > command has to be in a w32HActivate handler. Using w32HOpen doesn't work > > either. Same behaviour if adding a button to Window1 and opening > > CWindow3 as a result of clicking the button. > > > > CChris > > It may have been a little late when I wrote this. Actually the behaviour > exhibited is quite logical: > * creting a control doesn't set focus to it; > * for the control to naturally get focus, it would need to be in the internal > list of focusable chilren of its parent. But there is no natural place to > insert the new control, so it is the coder's job to add a setFocus() call > if a control is created after its parent is opened. I made this change:
constant EditText4 = createEx( EditText, "123", CWindow3, 8, 28, 48, 20, 0, 0 ) openWindow(CWindow3,Normal)
and it doesn't change the behavior. I still need the w32HActivate for the EditText control. > > Perhaps there is a need for a w32FOCUS_NOW style flag, which would force focus > > on creation and insertion as last (or first?) focusable control in the parent. > What do you think? The problem I see is that setting focus will highlight (select) the data and that may not always be desirable. > > CChris