View Issue Details

IDProjectCategoryView StatusLast Update
0022057LazarusLCLpublic2012-05-23 08:53
Reportercobines Assigned ToJesus Reyes  
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionfixed 
PlatformWin32OSWindows XP 
Product Version1.1 (SVN) 
Summary0022057: Cannot close application with Alt+F4 if TCustomGrid has focus
DescriptionRegression after 37304. The grid eats each function key so it also eats Alt+F4.

Run attached example, press Alt+F4 - app is not closed. Focus TEdit, now press Alt+F4 - app is closed.

It also eats Shift+F10 which displays sysmenu.
TagsNo tags attached.
Fixed in Revision
LazTarget-
Widgetset
Attached Files

Relationships

related to 0022056 closedJuha Manninen StringGrid error by deleting contents of a cell 

Activities

2012-05-18 04:02

 

close_grid_alt_f4.zip (1,995 bytes)

cobines

2012-05-18 04:06

reporter   ~0059698

Sorry, caused by 37305.

Juha Manninen

2012-05-18 17:51

developer   ~0059709

Last edited: 2012-05-18 18:25

The problem is caused by my commits. I changed it in r37317 so that function-keys are filtered out only if shift state = [].
The problem depends on the Window manager in use. My KDE + KWin grabs Alt-F4 in any case.
cobines, does it help in your test environment?

Jesus, please see if my changes make sense. See also why a cell loses its focus after DELETE (see related issue).

Was the '?' problem there always? Maybe it was, I just didn't notice.

cobines

2012-05-18 21:40

reporter   ~0059713

Last edited: 2012-05-18 22:08

Yes, now Alt+F4, Shift+F10 work.

Still, if you set a menu item shortcut to F3 for example it won't work from within grid. I don't see why the control has to eat keys that it doesn't handle.

I uploaded example function_keys_menu_shortcuts. Try pressing F1, F10 - they should execute menu items but they don't work from within the grid. They work from TEdit however.

2012-05-18 22:05

 

Bart Broersma

2012-05-19 02:37

developer   ~0059718

This problem of the appearing "?" was introduced in r36266 in
function HandleGTKKeyUpDown()
(I disected from r35365...)

I attached a possible patch.
This patch must be reviewed by someone who knows about gtk2 widgetset (zeljko ?).

2012-05-19 02:38

 

gtk2proc.inc.diff (555 bytes)   
Index: lcl/interfaces/gtk2/gtk2proc.inc
===================================================================
--- lcl/interfaces/gtk2/gtk2proc.inc	(revision 37289)
+++ lcl/interfaces/gtk2/gtk2proc.inc	(working copy)
@@ -2454,7 +2454,7 @@
       begin
         KeyPressesChar := GetSpecialChar;
         //NonAscii key was pressed, and UTF8KeyPress didn't handle it.issue #21489
-        if PassUTF8AsKeyPress and (KeyPressesChar = #0) then
+        if PassUTF8AsKeyPress and (KeyPressesChar <> #0) then
           KeyPressesChar := Char($3F);
       end;
 
gtk2proc.inc.diff (555 bytes)   

Juha Manninen

2012-05-19 10:30

developer   ~0059723

Last edited: 2012-05-19 10:33

Yes, my fix was wrong.

The question marks also appear with QT bindings. I think it uses those parts of gtk2 binding code (?).

Anyway, this is not only a TCustomGrid related issue. You Bart could assign this to yourself as you already have a possible solution. Then ask Zeljan on developers mailing list to comment.

Bart Broersma

2012-05-19 11:34

developer   ~0059729

Better leave it to Zeljan.
I do not really see how that piece of code works, and that revision was made by Zeljan.
Also, i cannot build latest svn due to gtk2 bindings, so I cannot really test before committing.

Jesus Reyes

2012-05-19 21:28

developer   ~0059769

It seems to me like a regression, so it should block

Zeljan Rikalo

2012-05-21 17:05

developer   ~0059832

hm, it works ok here. App is closed with Alt + F4 under gtk2 and qt w/o problems (tested with close_grid example). Any hints ? Gtk2 version, wm, distribution ?
I'm on Fedora 14 gtk2-2.22.0-2.fc14.i686, KDE 32bit, lazarus trunk + fpc-2.6.1

cobines

2012-05-21 18:39

reporter   ~0059834

I think they want you to make a different fix for 0022056. See Bart's note 0059718.

Zeljan Rikalo

2012-05-21 19:27

developer   ~0059836

I don't understand what's needed to be fixed. With Bart's patch it works in same way. Tested with example from 0022056.

cobines

2012-05-21 20:54

reporter   ~0059840

Have you reverted r37305 beforehand?

Juha Manninen

2012-05-21 21:30

developer   ~0059842

I reverted my hackinsh changes. Now the original problem is easier to see.

Zeljan Rikalo

2012-05-22 07:55

developer   ~0059844

I still don't see any problem.
Alt+F4 works, no question marks in grid.

cobines

2012-05-22 17:49

reporter   ~0059857

Well, if Juha reverted his changes then this issue can be closed and the other one reopened.

Jesus Reyes

2012-05-22 22:13

developer   ~0059864

I tried the test function_keys_menu_shortcut in Lazarus after revert has been done and it works fine, so I think there is nothing left here to fix.

Juha Manninen

2012-05-22 23:47

developer   ~0059868

Alt+F4 works, yes, and no question marks with QT bindings.
Strange, I saw the same error with QT but not any more.

GTK2 bindings + StringGrid however still enters question marks with all those keys.

Jesus Reyes

2012-05-23 08:53

developer   ~0059879

it does, but it doesn't belong to this report

Issue History

Date Modified Username Field Change
2012-05-18 04:02 cobines New Issue
2012-05-18 04:02 cobines File Added: close_grid_alt_f4.zip
2012-05-18 04:06 cobines Note Added: 0059698
2012-05-18 07:40 Zeljan Rikalo Status new => assigned
2012-05-18 07:40 Zeljan Rikalo Assigned To => Jesus Reyes
2012-05-18 17:37 Juha Manninen Relationship added related to 0022056
2012-05-18 17:51 Juha Manninen Note Added: 0059709
2012-05-18 18:25 Juha Manninen Note Edited: 0059709
2012-05-18 21:40 cobines Note Added: 0059713
2012-05-18 22:05 cobines File Added: function_keys_menu_shortcuts.zip
2012-05-18 22:08 cobines Note Edited: 0059713
2012-05-19 02:37 Bart Broersma Note Added: 0059718
2012-05-19 02:38 Bart Broersma File Added: gtk2proc.inc.diff
2012-05-19 10:30 Juha Manninen Note Added: 0059723
2012-05-19 10:33 Juha Manninen Note Edited: 0059723
2012-05-19 11:34 Bart Broersma Note Added: 0059729
2012-05-19 21:28 Jesus Reyes LazTarget => -
2012-05-19 21:28 Jesus Reyes Note Added: 0059769
2012-05-19 21:28 Jesus Reyes Severity minor => block
2012-05-21 17:05 Zeljan Rikalo Note Added: 0059832
2012-05-21 18:39 cobines Note Added: 0059834
2012-05-21 19:27 Zeljan Rikalo Note Added: 0059836
2012-05-21 20:54 cobines Note Added: 0059840
2012-05-21 21:30 Juha Manninen Note Added: 0059842
2012-05-22 07:55 Zeljan Rikalo Note Added: 0059844
2012-05-22 17:49 cobines Note Added: 0059857
2012-05-22 22:13 Jesus Reyes Status assigned => resolved
2012-05-22 22:13 Jesus Reyes Resolution open => fixed
2012-05-22 22:13 Jesus Reyes Note Added: 0059864
2012-05-22 23:47 Juha Manninen Note Added: 0059868
2012-05-23 08:53 Jesus Reyes Note Added: 0059879