Forum > Designer

[SOLVED] Error "List index (0) out of bounds" while opening form in IDE on Linux

(1/4) > >>

Unvictis:
Hi, guys! If i open my project in IDE on Windows (XP, 7, 10 - any) its opens normally. If i open same project in Lazarus on my Ubuntu Mate 16.04 x64 desktop, i see error: "List index (0) out of bounds".

Empirically, I found out that this problem occurs when the IDE tries to open the "fDevEditor" in my application. Nothing strange or unusual in the code and file "fDevEditor.lfm" I have not found. Tell me how to solve this problem?

IDE (Windows): Lazarus 1.6.2 (x86)
IDE (Ubuntu 16.04 x64): Lazarus 1.6+dfsg-1 (x86_64-linux-gtk2) [from standart Ubuntu repo]

PS: None of the project files I edited on a straight line - only through IDE.

File fdeveditor.pas:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit fDevEditor; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,  StdCtrls, DbCtrls, DBGrids, LCLType, uCommon, dOrder; type   { TfmDevEditor }   TfmDevEditor = class(TForm)    btCancel: TButton;    btOk: TButton;    btAddDevice: TButton;    btDeleteDevice: TButton;    edNewDevice: TEdit;    dgDevices: TDBGrid;    lbNewDevice: TLabel;    plContents: TPanel;    plButtonContainer: TPanel;    procedure btAddDeviceClick(Sender: TObject);    procedure btDeleteDeviceClick(Sender: TObject);    procedure edNewDeviceChange(Sender: TObject);    procedure edNewDeviceKeyDown(Sender: TObject; var Key: Word;      Shift: TShiftState);    procedure FormShow(Sender: TObject);  private    { private declarations }  public    { public declarations }  end; var  fmDevEditor: TfmDevEditor; implementation {$R *.lfm} { TfmDevEditor } procedure TfmDevEditor.FormShow(Sender: TObject);begin  edNewDevice.Clear;  btAddDevice.Enabled := False;  edNewDevice.SetFocus;end; procedure TfmDevEditor.edNewDeviceChange(Sender: TObject);begin  btAddDevice.Enabled := (Length(edNewDevice.Text) >= 2);end; procedure TfmDevEditor.edNewDeviceKeyDown(Sender: TObject; var Key: Word;  Shift: TShiftState);begin  // Если нажата клавиша "Enter" нажать кнопку "Добавить"  if (Key = VK_RETURN) and btAddDevice.Enabled then    btAddDeviceClick(Sender);end; procedure TfmDevEditor.btAddDeviceClick(Sender: TObject);begin  with dmOrder.sqDevice do    begin      Insert;      FieldByName('CREATOR').AsInteger := CurrentUserID;      FieldByName('EDITOR').AsInteger := CurrentUserID;      FieldByName('DEVICE').AsString := edNewDevice.Text;      Post;    end;   edNewDevice.Clear;end; procedure TfmDevEditor.btDeleteDeviceClick(Sender: TObject);begin  with dmOrder.sqDevice do    if MessageDlg(cDlgConfirmation, Format(cDlgDeviceDelConfirm,      [FieldByName('DEVICE').AsString]), mtConfirmation, mbYesNo, 0) = mrYes then        Delete;end; end. 
File fdeveditor.lfm:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---object fmDevEditor: TfmDevEditor  Left = 324  Height = 307  Top = 134  Width = 281  BorderStyle = bsDialog  BorderWidth = 4  Caption = 'Типы устройств'  ClientHeight = 307  ClientWidth = 281  OnShow = FormShow  Position = poOwnerFormCenter  LCLVersion = '1.6.2.0'  object plButtonContainer: TPanel    Left = 4    Height = 25    Top = 278    Width = 273    Align = alBottom    AutoSize = True    BorderSpacing.Top = 4    BevelOuter = bvNone    ChildSizing.HorizontalSpacing = 4    ClientHeight = 25    ClientWidth = 273    TabOrder = 1    object btCancel: TButton      Left = 198      Height = 25      Top = 0      Width = 75      Align = alRight      Cancel = True      Caption = 'Отмена'      ModalResult = 2      TabOrder = 1    end    object btOk: TButton      Left = 119      Height = 25      Top = 0      Width = 75      Align = alRight      Caption = 'OK'      Default = True      ModalResult = 1      TabOrder = 0    end  end  object plContents: TPanel    Left = 4    Height = 270    Top = 4    Width = 273    Align = alClient    AutoSize = True    BevelOuter = bvNone    BorderWidth = 4    ClientHeight = 270    ClientWidth = 273    TabOrder = 0    object lbNewDevice: TLabel      AnchorSideLeft.Control = dgDevices      AnchorSideTop.Control = plContents      Left = 4      Height = 15      Top = 4      Width = 145      BorderSpacing.Bottom = 4      Caption = 'Новый тип оборудования:'      ParentColor = False    end    object btAddDevice: TButton      AnchorSideTop.Side = asrCenter      AnchorSideRight.Control = plContents      AnchorSideRight.Side = asrBottom      Left = 194      Height = 25      Top = 22      Width = 75      Anchors = [akTop, akRight]      BorderSpacing.Bottom = 8      Caption = 'Добавить'      Enabled = False      OnClick = btAddDeviceClick      TabOrder = 1    end    object btDeleteDevice: TButton      AnchorSideTop.Control = btAddDevice      AnchorSideTop.Side = asrBottom      AnchorSideRight.Control = plContents      AnchorSideRight.Side = asrBottom      Left = 194      Height = 25      Top = 55      Width = 75      Anchors = [akTop, akRight]      BorderSpacing.Bottom = 8      Caption = 'Удалить'      OnClick = btDeleteDeviceClick      TabOrder = 2    end    object dgDevices: TDBGrid      AnchorSideLeft.Control = plContents      AnchorSideTop.Side = asrBottom      AnchorSideRight.Side = asrBottom      AnchorSideBottom.Control = plContents      AnchorSideBottom.Side = asrBottom      Left = 4      Height = 212      Top = 54      Width = 182      Anchors = [akTop, akRight]      AutoEdit = False      AutoFillColumns = True      Color = clWindow      Columns = <              item          Title.Caption = 'Устройство'          Width = 161          FieldName = 'DEVICE'        end>      DataSource = dmOrder.dsDevice      FixedCols = 0      Options = [dgColumnResize, dgColumnMove, dgTabs, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit, dgTruncCellHints]      Scrollbars = ssVertical      TabOrder = 3    end    object edNewDevice: TEdit      AnchorSideLeft.Control = plContents      AnchorSideTop.Control = lbNewDevice      AnchorSideTop.Side = asrBottom      AnchorSideRight.Control = btAddDevice      Left = 4      Height = 23      Top = 23      Width = 182      Anchors = [akTop, akRight]      BorderSpacing.Right = 8      BorderSpacing.Bottom = 8      MaxLength = 50      OnChange = edNewDeviceChange      OnKeyDown = edNewDeviceKeyDown      TabOrder = 0    end  endend 

howardpc:
Diagnosing the cause requires you to publish your project (Project->Publish Project...) and zip the published folder with some actual or dummy data. The unit and .lfm you show depend on other unseen code and data.

Unvictis:
Full project source.

Handoko:
Tested and confirmed. I got similar error.

howardpc:
I get a different exception:
EIBDatabaseError   icConnection:DoInternalConnect: -cannot attach to password database

Navigation

[0] Message Index

[#] Next page

Go to full version