View Issue Details

IDProjectCategoryView StatusLast Update
0032458LazarusLCLpublic2017-10-24 07:46
ReporterCudaText man Assigned ToMichl  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinux gtk2 x64OSubuntu 
Product Version1.9 (SVN) 
Fixed 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

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

CudaText man

2017-09-23 06:06

reporter  

tst-taborder.zip (2,962 bytes)

Michl

2017-09-25 09: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 09:26

developer   ~0103035

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

CudaText man

2017-09-25 09:53

reporter   ~0103036

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

Michl

2017-09-25 14: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 15:26

developer   ~0103040

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

Michl

2017-09-25 15:30

developer   ~0103041

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

accorp

2017-10-04 21: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 08:08

developer   ~0103199

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

accorp

2017-10-05 17:02

reporter  

combo_test.c (1,178 bytes)   
#include <gtk/gtk.h>

int main(int argc, char **argv)
{
    gtk_init(&argc, &argv);

    GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_container_set_border_width(GTK_CONTAINER(window), 8);
    gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_exit), NULL);

    GtkWidget *vbox = gtk_vbox_new(TRUE, 8);
    gtk_container_add(GTK_CONTAINER(window), vbox);

    GtkWidget *button = gtk_button_new_with_label("GtkButton");
    gtk_container_add(GTK_CONTAINER(vbox), button);

    GtkWidget *check = gtk_check_button_new_with_label("GtkCheckButton");
    gtk_container_add(GTK_CONTAINER(vbox), check);

    GList *items = NULL;
    items = g_list_append(items, "First Item");
    items = g_list_append(items, "Second Item");
    items = g_list_append(items, "Third Item");
    items = g_list_append(items, "Fourth Item");
    items = g_list_append(items, "Fifth Item");

    GtkWidget *combo = gtk_combo_new();
    gtk_combo_set_popdown_strings(GTK_COMBO(combo), items);
    gtk_container_add(GTK_CONTAINER(vbox), combo);

    gtk_window_set_focus(GTK_WINDOW(window), button);
    gtk_widget_show_all(window);
    gtk_main();

    return 0;
}
combo_test.c (1,178 bytes)   

accorp

2017-10-05 17: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 17:57

developer   ~0103206

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

Michl

2017-10-05 17:57

developer  

Issue History

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