[SOLVED] TComboBox is skipped when navigating with Tab lazarus / 7-LCL ---------------------------------------------------------------------- vrull · 2007-12-06 19:41 If I navigate through the form with Tab or using this function Code: [Select]  if (key = VK_RETURN) and (Shift = []) then     begin       key := 0;       ActiveControl := FindNextControl(ActiveControl, true, true, false);     end; TComboBox never gets focus. Does anybody know workaround? Edited: see workaround three posts below. ---------------------------------------------------------------------- Dr.Theopolis · 2007-12-07 00:58 I did a quick test by making a form and putting some controls on it, including a combo box. Tabbing through the controls worked fine for me, including the combo box. Is your combo box directly on the form with the rest of the controls, or is it inside another control, like a panel? ---------------------------------------------------------------------- vrull · 2007-12-07 01:18 Yes, it is right on the form, along  with others. Actually I have two ones, and they are both ignored, when I move focus. Also I have forgotten to mention, that the program is compiled for GTK2 and I use Lazarus 0.9.24. ---------------------------------------------------------------------- vrull · 2007-12-07 01:25 Just recompiled the project for GTK - all works fine. Back to GTK2 - again two comboboxes are ignored. ---------------------------------------------------------------------- vrull · 2007-12-07 04:15 Here is the code I took from Delphi and adapted to my requirements (it was a part of TWinControl methods) Code: [Select] Now it navigates forward if one presses Tab or Enter (that is what I wanted) and backward with Shift+Tab. For some reason Lazarus does not show function's implementation, when I click Find Declaration, as Delphi does. This, together with lack of help, make things much harder. ---------------------------------------------------------------------- vrull · 2007-12-07 08:04 Seems in this: Code: [Select]Function TWinControl.CanTab: Boolean; begin   Result := CanFocus and TWSWinControlClass(WidgetSetClass).CanFocus(Self); end; TWSWinControlClass(WidgetSetClass).CanFocus(Self) returns FALSE for TComboBox in GTK2,  although Code: [Select] class function TWSWinControl.CanFocus(const AWincontrol: TWinControl): Boolean; begin   // lets consider that by deafult all WinControls can be focused   Result := True; end; :?: ---------------------------------------------------------------------- Vincent Snijders · 2007-12-09 19:17 vrull, don't put copyrighted code in this forum, even if you modified it. I am pretty sure Delphi does not allow that their code is taken and put it on the internet even if it is modified somewhat.