unit lr_funct_editor_unit; {$mode objfpc}{$H+} interface uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, LR_Class, Buttons, ButtonPanel, LR_Const; type { TLR_FunctEditorForm } TLR_FunctEditorForm = class(TForm) ButtonPanel1: TButtonPanel; Label1: TLabel; Label2: TLabel; ListBox1: TListBox; ListBox2: TListBox; Panel1: TPanel; Splitter1: TSplitter; procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction); procedure FormCreate(Sender: TObject); procedure ListBox1Click(Sender: TObject); procedure ListBox2Click(Sender: TObject); procedure ListBox2DblClick(Sender: TObject); private { private declarations } public CurentFunctionDescription:TfrFunctionDescription; end; implementation {$R *.lfm} { TLR_FunctEditorForm } procedure TLR_FunctEditorForm.FormCreate(Sender: TObject); var i,j:integer; F:TfrFunctionLibrary; FD:TfrFunctionDescription; begin for i:=0 to frFunctionsCount-1 do begin F:=frFunctions[i].FunctionLibrary; for j:=0 to F.FunctionCount-1 do begin FD := F.Description[j]; if Assigned(FD) then begin if ListBox1.Items.IndexOf(FD.funGroup)=-1 then ListBox1.Items.Add(FD.funGroup); end end; end; if ListBox1.Items.Count>0 then ListBox1.ItemIndex:=0; ListBox1Click(nil); CurentFunctionDescription:=nil; Caption:=sFunctions; end; procedure TLR_FunctEditorForm.FormClose(Sender: TObject; var CloseAction: TCloseAction); begin if ModalResult = mrOk then begin if (ListBox2.Items.Count>0) and (ListBox2.ItemIndex>-1) and (ListBox2.ItemIndex0) and (ListBox1.ItemIndex>-1) and (ListBox1.ItemIndex0 then ListBox2.ItemIndex:=0; ListBox2Click(nil); end; end; procedure TLR_FunctEditorForm.ListBox2Click(Sender: TObject); var FD:TfrFunctionDescription; S:string; begin if (ListBox2.Items.Count>0) and (ListBox2.ItemIndex>-1) and (ListBox2.ItemIndex