Re: CWindow and Mouse Clicks on EditText : work-around
- Posted by CChris <christian.cuvier at agricultu?e?gouv.fr> Jul 22, 2007
- 506 views
Rad wrote: > > Hi, > > >> My Old Query >> > The EditText controls do not get focus with mouse clicks when their parent is > ChildWindow (CWindow) control. One can neither click and place the cursor on > them, nor can select a part or full text present in it. Other controls like > PushButtons, Combo etc respond correctly to mouse click. Only the EditText > control > seems to have this problem. > >> > > Doing further R&D on the issue, I got around the problem using following mods > in win32lib and my application: > > win32lib: In function fDoMouse(): > ================================ > }}} <eucode> > lRC = {pReturn} > if (and_bits(classAttr[ctrl_Type[id]], w32Clickable) != 0) > or (ctrl_Family[id] = BUTTON) > > -- 2007-07-22 Rad for receiving mouse click on EditText > or (ctrl_Family[id] = EDIT) > -- 2007-07-22 Rad for receiving mouse click on EditText > > or find(iMsg, {WM_RBUTTONDOWN, WM_MOUSEWHEEL}) > or (classType[ctrl_Type[id]] = STATIC and > and_bits(SS_NOTIFY, w32Func( xGetWindowLong, { ctrl_Handle[id], > GWL_STYLE })) > != 0) > then > doActions = w32True > else > doActions = w32False > end if > lParent = findParentWindow(id) > </eucode> {{{ > > > In my application's main window (MainMenu): > ========================================== > }}} <eucode> > procedure EditText_onClick(integer self, integer event, sequence params) > setIndex(self, {1, 0}) > setFocus(self) > end procedure > > procedure setEditClick(integer self) > sequence children, className > className = getClassName(self) > if equal(className, "Edit") then > EditTextFlds = append(EditTextFlds, self) > end if > children = findChildren(self) > for i = 1 to length(children) do > setEditClick(children[i][1]) > end for > end procedure > > --#Set all EditText controls for receiving Mouse Click > EditTextFlds = {} > setEditClick(MainMenu) > setHandler(EditTextFlds, w32HClick, routine_id("EditText_onClick")) > </eucode> {{{ > > With above mods, now I can click on EditText controls present in a Child > Window > to access them. > > Can this portion from my application be moved to win32lib in any way? > Looks like somehow default onClick setFocus event is not getting activated for > EditText controls. > > Any suggestions? > > Regards, > Rad. With your mod, do everything still work correctly when the edit text is the child of a top level window? I am not against the change, but what you are trying to circumvent is not a but in the library, but a standard behaviour of Windows, so some more care is needed. If no one complains about changing that, then it owould certainly be useful. CChris