View Issue Details

IDProjectCategoryView StatusLast Update
0032458LazarusLCLpublic2017-10-24 09:46
ReporterAlexey Tor.Assigned ToMichl 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinux gtk2 x64OSubuntuOS Version
Product Version1.9 (SVN)Product Build 
Target VersionFixed in Version1.9 (SVN) 
Summary0032458: Tab cannot go from combobox to combobox
Descriptionattached demo.
in demo, test tabOrder. on Linux gtk2, tab - after 1st combo goes to 1st control. must: go to 2nd combo.
TagsNo tags attached.
Fixed in Revision55920, 55979
LazTarget-
Widgetset
Attached Files
  • tst-taborder.zip (2,962 bytes)
  • gtk2.patch (2,382 bytes)
    Index: lcl/interfaces/gtk2/gtk2widgetset.inc
    ===================================================================
    --- lcl/interfaces/gtk2/gtk2widgetset.inc	(revision 55918)
    +++ lcl/interfaces/gtk2/gtk2widgetset.inc	(working copy)
    @@ -783,9 +783,8 @@
         LM_SYSKEYDOWN,
         LM_SYSKEYUP:
         begin
    -      if (ALCLObject is TCustomComboBox) then
    -        ConnectKeyPressReleaseEvents(PgtkObject(PgtkCombo(gObject)^.entry))
    -      else if (ALCLObject is TCustomForm) then
    +      if ((ALCLObject is TCustomComboBox) and gtk_is_combo_box_entry(gObject))
    +      or (ALCLObject is TCustomForm) then
             ConnectKeyPressReleaseEvents(gObject);
     
           ConnectKeyPressReleaseEvents(gCore);
    Index: lcl/interfaces/gtk2/gtk2wsstdctrls.pp
    ===================================================================
    --- lcl/interfaces/gtk2/gtk2wsstdctrls.pp	(revision 55918)
    +++ lcl/interfaces/gtk2/gtk2wsstdctrls.pp	(working copy)
    @@ -1668,6 +1668,9 @@
       else
         InputObject := AGtkObject;
     
    +  Gtk2WidgetSet.SetCallbackDirect(LM_KEYDOWN, InputObject, AWinControl);
    +  Gtk2WidgetSet.SetCallbackDirect(LM_KEYUP, InputObject, AWinControl);
    +  Gtk2WidgetSet.SetCallbackDirect(LM_CHAR, InputObject, AWinControl);
       Gtk2WidgetSet.SetCallbackDirect(LM_MOUSEMOVE, InputObject, AWinControl);
       Gtk2WidgetSet.SetCallbackDirect(LM_LBUTTONDOWN, InputObject, AWinControl);
       Gtk2WidgetSet.SetCallbackDirect(LM_LBUTTONUP, InputObject, AWinControl);
    @@ -1684,6 +1687,9 @@
     
       // And now the same for the Button in the combo
       if AButton<>nil then begin
    +    Gtk2WidgetSet.SetCallbackDirect(LM_KEYDOWN, AButton, AWinControl);
    +    Gtk2WidgetSet.SetCallbackDirect(LM_KEYUP, AButton, AWinControl);
    +    Gtk2WidgetSet.SetCallbackDirect(LM_CHAR, AButton, AWinControl);
         if not GtkWidgetIsA(PGtkWidget(AButton),GTK_TYPE_CELL_VIEW) then begin
           Gtk2WidgetSet.SetCallbackDirect(LM_MOUSEENTER, AButton, AWinControl);
           Gtk2WidgetSet.SetCallbackDirect(LM_MOUSELEAVE, AButton, AWinControl);
    @@ -2091,7 +2097,7 @@
         Entry := GTK_BIN(WidgetInfo^.CoreWidget)^.child;
         Result:=GTK_WIDGET_CAN_FOCUS(Entry);
       end else begin
    -    Result:=GTK_WIDGET_CAN_FOCUS(WidgetInfo^.CoreWidget);
    +    Result:=inherited CanFocus(AWinControl);
       end;
       //DebugLn(['TGtk2WSCustomComboBox.CanFocus ',dbgsName(AWinControl),' ',gtk_is_combo_box_entry(WidgetInfo^.CoreWidget),' Result=',Result]);
     end;
    
    gtk2.patch (2,382 bytes)
  • combo_test.c (1,178 bytes)
  • TabComboboxStylesTest.zip (1,902 bytes)

Relationships

related to 0027036 resolvedJuha Manninen Navigating on a form using <TAB>-key doesn't work for dynamically created Controls on a panel 
related to 0025487 resolvedMichl TAB key in ComboBox with Style=csDropDownList does not switch to the next TabStop control 

Activities

Alexey Tor.

2017-09-23 08:06

reporter  

tst-taborder.zip (2,962 bytes)

Michl

2017-09-25 11:24

developer  

gtk2.patch (2,382 bytes)
Index: lcl/interfaces/gtk2/gtk2widgetset.inc
===================================================================
--- lcl/interfaces/gtk2/gtk2widgetset.inc	(revision 55918)
+++ lcl/interfaces/gtk2/gtk2widgetset.inc	(working copy)
@@ -783,9 +783,8 @@
     LM_SYSKEYDOWN,
     LM_SYSKEYUP:
     begin
-      if (ALCLObject is TCustomComboBox) then
-        ConnectKeyPressReleaseEvents(PgtkObject(PgtkCombo(gObject)^.entry))
-      else if (ALCLObject is TCustomForm) then
+      if ((ALCLObject is TCustomComboBox) and gtk_is_combo_box_entry(gObject))
+      or (ALCLObject is TCustomForm) then
         ConnectKeyPressReleaseEvents(gObject);
 
       ConnectKeyPressReleaseEvents(gCore);
Index: lcl/interfaces/gtk2/gtk2wsstdctrls.pp
===================================================================
--- lcl/interfaces/gtk2/gtk2wsstdctrls.pp	(revision 55918)
+++ lcl/interfaces/gtk2/gtk2wsstdctrls.pp	(working copy)
@@ -1668,6 +1668,9 @@
   else
     InputObject := AGtkObject;
 
+  Gtk2WidgetSet.SetCallbackDirect(LM_KEYDOWN, InputObject, AWinControl);
+  Gtk2WidgetSet.SetCallbackDirect(LM_KEYUP, InputObject, AWinControl);
+  Gtk2WidgetSet.SetCallbackDirect(LM_CHAR, InputObject, AWinControl);
   Gtk2WidgetSet.SetCallbackDirect(LM_MOUSEMOVE, InputObject, AWinControl);
   Gtk2WidgetSet.SetCallbackDirect(LM_LBUTTONDOWN, InputObject, AWinControl);
   Gtk2WidgetSet.SetCallbackDirect(LM_LBUTTONUP, InputObject, AWinControl);
@@ -1684,6 +1687,9 @@
 
   // And now the same for the Button in the combo
   if AButton<>nil then begin
+    Gtk2WidgetSet.SetCallbackDirect(LM_KEYDOWN, AButton, AWinControl);
+    Gtk2WidgetSet.SetCallbackDirect(LM_KEYUP, AButton, AWinControl);
+    Gtk2WidgetSet.SetCallbackDirect(LM_CHAR, AButton, AWinControl);
     if not GtkWidgetIsA(PGtkWidget(AButton),GTK_TYPE_CELL_VIEW) then begin
       Gtk2WidgetSet.SetCallbackDirect(LM_MOUSEENTER, AButton, AWinControl);
       Gtk2WidgetSet.SetCallbackDirect(LM_MOUSELEAVE, AButton, AWinControl);
@@ -2091,7 +2097,7 @@
     Entry := GTK_BIN(WidgetInfo^.CoreWidget)^.child;
     Result:=GTK_WIDGET_CAN_FOCUS(Entry);
   end else begin
-    Result:=GTK_WIDGET_CAN_FOCUS(WidgetInfo^.CoreWidget);
+    Result:=inherited CanFocus(AWinControl);
   end;
   //DebugLn(['TGtk2WSCustomComboBox.CanFocus ',dbgsName(AWinControl),' ',gtk_is_combo_box_entry(WidgetInfo^.CoreWidget),' Result=',Result]);
 end;
gtk2.patch (2,382 bytes)

Michl

2017-09-25 11:26

developer   ~0103035

@AlexeyT: Does the patch work for you? Does it breaks other things for TComboboxes on GTK2?

Alexey Tor.

2017-09-25 11:53

reporter   ~0103036

patch works for me. I tested combobox in dropdownlist and usual modes, seems OK.

Michl

2017-09-25 16:44

developer   ~0103038

@Zeljan: Can you have a look at this issue? I'm not sure about the patch, if it breaks something. Especially about the changes in gtk2widgetset.inc I'm not sure.

GTK_WIDGET_CAN_FOCUS(WidgetInfo^.CoreWidget) originally returned false (thatswhile I changed it to inherited) but that is imho a workaround.

Zeljan Rikalo

2017-09-25 17:26

developer   ~0103040

@Michl, looks good to me, only check if key events are ok now on combobox and form.

Michl

2017-09-25 17:30

developer   ~0103041

Thank you, I'll test it some more and apply it, if everything is ok.

accorp

2017-10-04 23:03

reporter   ~0103192

This patch breaks cursor key behaviour when combobox is in editor mode.
Up/down keys changes focus instead of changing selected item.

Steps to reproduce:
* open attached sample project
* for TComboBox controls change Style property to csDropDown
* run, change focus to combobox, press up/down keys.

Zeljan Rikalo

2017-10-05 10:08

developer   ~0103199

Thats gtk2 behaviour. In normal gtk2 app up/down keys behaves as backtab/tab.

accorp

2017-10-05 19:02

reporter  

combo_test.c (1,178 bytes)

accorp

2017-10-05 19:04

reporter   ~0103205

This is true for some widgets, but not for GtkCombo. You can check it with attached c program.
gcc combo_test.c `pkg-config --cflags gtk+-2.0` -o combo_test `pkg-config --libs gtk+-2.0`
./combo_test

Michl

2017-10-05 19:57

developer   ~0103206

Yes, IMO this is a valid regression. Fixed in trunk revision 55979.

Michl

2017-10-05 19:57

developer  

TabComboboxStylesTest.zip (1,902 bytes)

Issue History

Date Modified Username Field Change
2017-09-23 08:05 Alexey Tor. New Issue
2017-09-23 08:06 Alexey Tor. File Added: tst-taborder.zip
2017-09-25 11:24 Michl File Added: gtk2.patch
2017-09-25 11:26 Michl LazTarget => -
2017-09-25 11:26 Michl Note Added: 0103035
2017-09-25 11:26 Michl Status new => feedback
2017-09-25 11:53 Alexey Tor. Note Added: 0103036
2017-09-25 11:53 Alexey Tor. Status feedback => new
2017-09-25 16:44 Michl Note Added: 0103038
2017-09-25 17:26 Zeljan Rikalo Note Added: 0103040
2017-09-25 17:29 Michl Assigned To => Michl
2017-09-25 17:29 Michl Status new => assigned
2017-09-25 17:30 Michl Note Added: 0103041
2017-09-25 20:16 Michl Fixed in Revision => 55920
2017-09-25 20:16 Michl Status assigned => resolved
2017-09-25 20:16 Michl Fixed in Version => 1.9 (SVN)
2017-09-25 20:16 Michl Resolution open => fixed
2017-10-04 23:03 accorp Note Added: 0103192
2017-10-04 23:11 Michl Status resolved => assigned
2017-10-04 23:11 Michl Resolution fixed => reopened
2017-10-05 10:08 Zeljan Rikalo Note Added: 0103199
2017-10-05 19:02 accorp File Added: combo_test.c
2017-10-05 19:04 accorp Note Added: 0103205
2017-10-05 19:57 Michl Note Added: 0103206
2017-10-05 19:57 Michl File Added: TabComboboxStylesTest.zip
2017-10-05 19:58 Michl Fixed in Revision 55920 => 55920, 55979
2017-10-05 19:58 Michl Status assigned => resolved
2017-10-05 19:58 Michl Resolution reopened => fixed
2017-10-14 10:52 Juha Manninen Relationship added related to 0027036
2017-10-24 09:46 Michl Relationship added related to 0025487