Thread: Vanishing cursor in SQL editor - propose quick and dirty fix
Hi, I love PGAdminIII, and use it extensively on my Redhat Linux box. I'm currently using a CVS build as it fixes a significant crashing situation over the stable release. However, I find the disappearence of the cursor/caret in the SQL editor very annoying. An hour or so of poking has led me into the labyrinth of code which is the wxWindows focus handling mechanism. I really don't have the time or inclination to debug that so here is my hacky fix: In the file contrib/src/stc/ScintillaWX.cpp, line 637, change the left mouse click callback as follows: ... void ScintillaWX::DoLeftButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) { ButtonDown(pt, curTime, shift, ctrl, alt); //Hack to try and reclaim the caret: if(!hasFocus) DoGainFocus(); } ... ie - we force a focus event and hence redraw the caret. The added line should never be called, since you should never get a left click without getting focus, so on the plus side this patch should not break anything if wxWindows gets fixed properly. Also, the wxWindows build you use has already been forked, so I don't think it would be polluting good code to add this. Anyway, whoever maintains this code, take it or leave it. TIM
Tim Booth wrote: >Hi, > >I love PGAdminIII, and use it extensively on my Redhat Linux box. I'm >currently using a CVS build as it fixes a significant crashing situation >over the stable release. However, I find the disappearence of the >cursor/caret in the SQL editor very annoying. > > Hi Tim, can you tell us in which situation stable (1.0.2?) crashes? Seems we missed to backport a fix. >An hour or so of poking has led me into the labyrinth of code which is >the wxWindows focus handling mechanism. I really don't have the time or >inclination to debug that so here is my hacky fix: > >In the file contrib/src/stc/ScintillaWX.cpp, line 637, change the left >mouse click callback as follows: > >... >void ScintillaWX::DoLeftButtonDown(Point pt, unsigned int curTime, bool >shift, bool ctrl, bool alt) { > ButtonDown(pt, curTime, shift, ctrl, alt); > > //Hack to try and reclaim the caret: > if(!hasFocus) DoGainFocus(); >} >... >ie - we force a focus event and hence redraw the caret. > >The added line should never be called, since you should never get a left >click without getting focus, so on the plus side this patch should not >break anything if wxWindows gets fixed properly. Also, the wxWindows >build you use has already been forked, so I don't think it would be >polluting good code to add this. > > Thanks Tim for contributing this fix. IFAIR I did some debugging about this myself, can't remember what happened. We'll be upgrading our wx snapshot quite soon (as soon as I find the time to do so, yes guys I'm telling this for quite a while now...), the 2.5.1 release is settling these days. The Scintilla control has been updated, and AFAIK there has been work on focus code too. Maybe the problem is already fixed properly, if not we'll certainly incorporate this hack into our version. Regards, Andreas
Hi Andreas, I think I have pinned down a situation which reliably crashes the program: 1. Open a database and select a table in the tree view 2. Click the pencil icon to edit the underlying SQL 3. Execute the SQL. You obviously get an error that the table already exists, since the 'drop table' is commented out. 4. Close the window, and select no when asked if you want to save. Segfault! Just tried this on the new Debian box, with the same result. Hope this is useful. TIM On Thu, 2004-02-26 at 17:37, Andreas Pflug wrote: > Tim Booth wrote: > > >Hi, > > > >I love PGAdminIII, and use it extensively on my Redhat Linux box. I'm > >currently using a CVS build as it fixes a significant crashing situation > >over the stable release. However, I find the disappearence of the > >cursor/caret in the SQL editor very annoying. > > > > > > Hi Tim, > can you tell us in which situation stable (1.0.2?) crashes? Seems we > missed to backport a fix. >