[Qt] Tab order fix

Hess, Philip J pjhess at purdue.edu
Mon Jan 29 00:57:34 CET 2007


Here's a fix for the tab order problem in the Qt widgetset. Also delete the SortListByTabOrder function since it isn't needed anymore.

Thanks.


procedure TQtMainWindow.setTabOrders;
var
  i: Integer;
  Form: TForm;
  List: TFPList;
begin
  Form := TForm(LCLObject);

  List := TFPList.Create;
  Form.GetTabOrderList(List);
  
  for i := 0 to List.Count - 2 do
  begin
    setTabOrder(TQtWidget(TWinControl(List.Items[i]).Handle),
     TQtWidget(TWinControl(List.Items[i + 1]).Handle));

    {$ifdef VerboseQt}
      WriteLn('Setting Tab Order first: ', TWinControl(List.Items[i]).Name, ' second: ',
       TWinControl(List.Items[i + 1]).Name);
    {$endif}
  end;
  
  { The last element points to the first }
  if List.Count > 1 then
  begin
    setTabOrder(TQtWidget(TWinControl(List.Items[List.Count - 1]).Handle),
     TQtWidget(TWinControl(List.Items[0]).Handle));
     
    {$ifdef VerboseQt}
      WriteLn('Setting Tab Order first: ', TWinControl(List.Items[List.Count - 1]).Name, ' second: ',
       TWinControl(List.Items[0]).Name);
    {$endif}
  end;
  
  List.Free;
end;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 2774 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/qt/attachments/20070128/6ecd6b7c/attachment-0001.bin>


More information about the Qt mailing list