Issue 97044

Summary: SQL editor: all text selected when window recivies focus
Product: Base Reporter: Ariel Constenla-Haile <arielch>
Component: codeAssignee: marc.neumann
Status: CLOSED FIXED QA Contact: issues@dba <issues>
Severity: Trivial    
Priority: P3 CC: frank.schoenheit, issues, max.odendahl
Version: DEV300m37Keywords: usability
Target Milestone: OOo 3.1   
Hardware: All   
OS: All   
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
patch none

Description Ariel Constenla-Haile 2008-12-09 00:20:33 UTC
In the SQL editor multi-line edit control, all the text is selected every time
the editor's window gains focus. This way, switching different windows in the
task bar can become really annoying.
Comment 1 max.odendahl 2008-12-09 13:12:17 UTC
mod->fs: this behaviour has been like that since the beginning of time, there is
extra code so it behaves that way, but I don't know the reason for that.

If you agree this change would be a good one, I can still do it as a bug fix for 3.1
Comment 2 Frank Schönheit 2008-12-09 13:40:12 UTC
fs->mod: I think it would be a change to the better. However, one needs to be
careful that really only the SQL view is affected. Where's the code for
selecting everything? In dbaccess, or some base class?
Comment 3 max.odendahl 2008-12-09 13:51:32 UTC
mod->fs: seems like I remembered wrong about the extra code, this behaviour is
enabled for all MultiLineEdits

But all we have to do is call

EnableFocusSelectionHide(true) in our sqledit constructor object and all should
be fine. Would you integrate into some dba31* cws?
Comment 4 Frank Schönheit 2008-12-09 13:55:45 UTC
Just attach a patch, and I'll commit to CWS dba31g
Comment 5 Frank Schönheit 2008-12-09 22:01:36 UTC
fs->mod: you volunteered, so you should own it :) Thanks.
Comment 6 max.odendahl 2008-12-10 11:54:25 UTC
mod->fs: m37 is broken for me, I can't package it, so I could not verify the
patch, but I think it should do the trick
Comment 7 max.odendahl 2008-12-10 11:54:50 UTC
Created attachment 58683 [details]
patch
Comment 8 Frank Schönheit 2008-12-10 12:14:44 UTC
sadly, this patch doesn't work (in that it simply doesn't have the desired result).

Looking into TextWindow::GetFocus, I think it's mbFocusSelectionHide you need to
affect. This variable controls whether the selection is hidden when the control
does not have the focus, and as a side effect, it also controls whether or not
the complete text is selected when the control gains the focus.

Perhaps a better solution, instead of working around the TextWindow's strange
mixture of the "hide selection on un-focus" with the "select all on focus"
concepts, it would be better to
- introduce a SELECTION_OPTION_SELECT_ALL_ON_FOCUS in vcl's settings.hxx
- set this bit by default when constructing a StyleSettings instance
- reset this bit in the OSqlEdit's constructor
- respect this flag in TextWindow::GetFocus

At least this would be the cleanest way, IMO.
Comment 9 max.odendahl 2008-12-10 12:26:31 UTC
>>mbFocusSelectionHide you need to affect

EnableFocusSelectionHide() does affect exactly this variable...but if it does
not work....

No time to debug, as I am very busy right now with other stuff, this must be
postponed then :-(

Comment 10 Frank Schönheit 2008-12-12 13:04:21 UTC
EnableFocusSelectionHide(false) instead of EnableFocusSelectionHide(true) does
the trick :) ... committed to CWS dba31g, thanks for the patch!
Comment 11 Frank Schönheit 2008-12-12 13:04:52 UTC
fixed in CWS dba31g

find more information about this CWS, like when it is available in the master
builds, in EIS, the Environment Information System:
http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Path=DEV300%2Fdba31g
Comment 12 max.odendahl 2008-12-12 13:06:40 UTC
enable and hide in the same name and having a boolean variable should be
forbidden ;-)

thanks fs for integrating
Comment 13 Frank Schönheit 2008-12-12 13:13:53 UTC
> enable and hide in the same name and having a boolean variable should be
> forbidden ;-)

indeed ....
Comment 14 Frank Schönheit 2009-01-07 09:32:09 UTC
fs->msc: please verify in CWS dba31g
Comment 15 marc.neumann 2009-01-19 11:55:12 UTC
verified in CWS dba31g

find more information about this CWS, like when it is available in the master
builds, in EIS, the Environment Information System:
http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Path=DEV300%2Fdba31g
Comment 16 marc.neumann 2009-02-25 10:14:55 UTC
Hi,

this is fixed in master OOO310_m2.

I close this issue now.

Bye Marc