Re: [Lazarus] How to use data from stringlist in another form.

2013-03-27 Thread appjaws

On 27/03/13 08:06, Antonio Fortuny wrote:

Le 26/03/2013 15:14, appjaws a écrit :

I have 2 forms, form 1 calls form 2 on a buttonclick process.
Form 2 loads a string list, operations are carried out and the
stringlist is saved.


on FormMain:
...
implementation
uses
   unit2;

procedure TFrmMain.Button1Click(Sender: TObject);
begin
   if Form1.List.Count = 0 then
 Form1.LoadList;
   // do whatever do to to compare
end;
==
on second form:
unit unit2;
{$mode objfpc}{$H+}
interface
uses
   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs;
type
   { TForm1 }
   TForm1 = class(TForm)
 procedure FormCreate(Sender: TObject);
 procedure FormDestroy(Sender: TObject);
   private
 { private declarations }
 FList: TStringList;
   public
 { public declarations }
 procedure LoadList;

 property List: TStringList read FList;
   end;

var
   Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
   FList := TStringList.Create;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
   FList.Free
end;

procedure TForm1.LoadList;
begin
   FList.LoadFromFile('myfile.txt')
end;

end.


Thank you Antonio,
works well with no errors.
Paul


--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Compile Project with options?

2013-03-26 Thread appjaws

I am getting errors with duplicate code :-
Compiling resource /Lazarus/TestProj1/lib/x86_64-linux/TestProj1.or
TestProj1.lpr(21,1) Error: Error while compiling resources. Compile with 
-vd for more details. Check for duplicates.


How do I compile with -vd???

Thanks for any help
Paul
--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Compile Project with options?

2013-03-26 Thread appjaws

On 26/03/13 12:29, appjaws wrote:

I am getting errors with duplicate code :-
Compiling resource /Lazarus/TestProj1/lib/x86_64-linux/TestProj1.or
TestProj1.lpr(21,1) Error: Error while compiling resources. Compile with
-vd for more details. Check for duplicates.

How do I compile with -vd???

Thanks for any help
Paul

Sorry --Please ignore the above.
Correct question in next message.
Paul

--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] How to use data from stringlist in another form.

2013-03-26 Thread appjaws

I have 2 forms, form 1 calls form 2 on a buttonclick process.
Form 2 loads a string list, operations are carried out and the 
stringlist is saved.


The application opens with form 1, data is produced and stored in a Tedit

What I want to do is to compare the Tedit on form1 with data held in the 
stringlist of form2. The problem is that the stringlist is not yet 
created from the stringlist file.
I have tried to load the stringlist from within form 1 but compilation 
fails with :-
TestProj1.lpr(21,1) Error: Error while compiling resources. Compile with 
-vd for more details. Check for duplicates.


The messaged produced using -vd did not indicate any duplicates and 
terminated the application with the same message.


I'm sure this must be possible but with my limited knowledge, I can't 
see how.


Thanks for any help
Paul
--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to use data from stringlist in another form.

2013-03-26 Thread appjaws

On 26/03/13 14:26, Mattias Gaertner wrote:

On Tue, 26 Mar 2013 14:14:00 +
appjaws laza...@appjaws.plus.com wrote:


I have 2 forms, form 1 calls form 2 on a buttonclick process.
Form 2 loads a string list, operations are carried out and the
stringlist is saved.

The application opens with form 1, data is produced and stored in a Tedit

What I want to do is to compare the Tedit on form1 with data held in the
stringlist of form2. The problem is that the stringlist is not yet
created from the stringlist file.
I have tried to load the stringlist from within form 1 but compilation
fails with :-
TestProj1.lpr(21,1) Error: Error while compiling resources. Compile with
-vd for more details. Check for duplicates.

The messaged produced using -vd did not indicate any duplicates and
terminated the application with the same message.

I'm sure this must be possible but with my limited knowledge, I can't
see how.


The Error while compiling resources has nothing to do with
stringlists or any runtime logic.

What fpc version?
What platform?

Mattias

--



fpc 2.6.2, Lazarus 1.0.8 running on kubuntu linux

I copied the stringlist code from form 2 to form 1 and had the errors, 
so I thought that reusing the code was the wrong thing to do, once I 
removed it  the app compiled without error.

So I need to know if and how to do this.
Thanks
Paul

--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] some number manipulation

2013-03-09 Thread appjaws

Hi all,
I have a series of results, for each day of the month I have 10 numbers 
ranging from 1 to 20. i.e.

Day11,3,4,5,7,9,12,16,17,20
Day23,4,5,6,8,9,15,17,18,19
etc.

Question 1 how can I find the number of 1's 2's 3's 4's etc. for the 
whole month series?


Question 2 How can I test for 3 or more consecutive numbers in each day?

Hope this is clear, any guidance will be most appreciated.
Paul
--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] some number manipulation

2013-03-09 Thread appjaws

On 09/03/13 12:11, Howard Page-Clark wrote:

On 09/03/13 11:12, appjaws wrote:

Hi all,
I have a series of results, for each day of the month I have 10 numbers
ranging from 1 to 20. i.e.
Day11,3,4,5,7,9,12,16,17,20
Day23,4,5,6,8,9,15,17,18,19
etc.

Question 1 how can I find the number of 1's 2's 3's 4's etc. for the
whole month series?

Question 2 How can I test for 3 or more consecutive numbers in each day?


Q1 for such a small dataset a brute force approach of iterating over all
values and counting each occurrence of 1, 2, 3 etc. in 20 distinct
counters seems best.

Q2 Your data is ordered by value, so a function along these lines ought
to work:

type
   TNumber = 1..20;
   TDayData = array[1..10] of TNumber;

function ThreeOrMoreConsecutiveNos(dd: TDayData): boolean;
var i: integer=1;
begin
  Result:= False;
  while i =8 do
   begin
 if ( dd[i]=Pred(dd[i+1]) )
  and ( dd[i+1]=Pred(dd[i+2]) )
 then Exit(True);
 Inc(i);
   end;
end;


Thank you Howard,
I just realised that I need to sort the numbers because they are not 
like my example above. So where and how would I sort the array for each 
Day and then call ThreeOrMore?


I'm still learning and really appreciate your help
Paul


--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Ubuntu 12.10 install problem

2013-03-07 Thread appjaws

Hi,
I am running lazarus on amd64bit kubuntu 12.10 with kde 4.9.5 This is 
what I did to get the latest versions.
I downloaded the following rpm versions from the lazarus and freepascal 
sites.

  fpc_2.6.0-2.fc17_amd64.rpm
  fpc-doc_2.6.0-2.fc17_amd64.rpm
  fpc-src_2.6.0-2.fc17_amd64.rpm
  lazarus_1.0.4-0_amd64.rpm

I then converted to deb

 sudo alien -k fpc-2.6.0-2.fc17.x86_64.rpm
 sudo alien -k fpc-doc-2.6.0-2.fc17.x86_64.rpm
 sudo alien -k fpc-src-2.6.0-2.fc17.x86_64.rpm
 sudo alien -k lazarus-1.0.4-0.x86_64.rpm

then installed the deb versions
  sudo dpkg -i fpc_2.6.0-2.fc17_amd64.deb
  sudo dpkg -i fpc-doc_2.6.0-2.fc17_amd64.deb
  sudo dpkg -i fpc-src_2.6.0-2.fc17_amd64.deb
  sudo dpkg -i lazarus_1.0.4-0_amd64.deb

This all went without a hitch and is fully working.  This remind me I 
must update to lazarus 1.0.6.


Hope this helps
Paul

--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Ok I give up!

2013-03-05 Thread appjaws

On 04/03/13 18:20, Reinier Olislagers wrote:

On 4-3-2013 16:54, appjaws wrote:

On 04/03/13 11:28, Reinier Olislagers wrote:

On 4-3-2013 12:21, appjaws wrote:

On 02/03/13 17:21, Reinier Olislagers wrote:

On 2-3-2013 17:41, appjaws wrote:

Any ideas on the built in help, I'm using linux with lazarus 1.0.6 and
fpc 2.6.0

snip

/usr/share/lazarus/1.06  is where the components docs etc are installed.

I hope you mean this is the directory where Lazarus is installed (where
the lazarus and startlazarus executables are)


Yes that is correct.

snip


HelpEXE :- /usr/share/lazarus/1.0.6/components/chmhelp/lhelp/lhelp

That looks good.


HelpFilesPath :- /usr/share/lazarus/1.0.6/docs/chm/

That looks good. Do you have
fcl.chm  lazutils.chm  lcl.chm  prog.chm  ref.chm  rtl.chm  toc.chm
user.chm in there?


Yes all correct.

snip

As far as I can tell everything seems to be in the correct place and
referenced correctly.

I don't know. You haven't told us your tools/options/help/help options
settings. Following the instructions in the wiki (with everything in the
chm directory mentioned above), CHM Help Viewer's HelpFilesPath
should be empty.
Likewise the various Help Databases settings should be unchanged from a
default install (mostly empty).

Hope with this you can get it going!

Viewers section
HTML Browser
AutoRegister := False
BrowserParms := %s
BrowserPath := ''
Name := ''
Tag := 0

CHM Help Viewer
HelpExe := /usr/share/lazarus/1.0.6/components/chmhelp/lhelp/lhelp
HelpExeParm := ''
HelpFilePath := ''
HelpLabel := lazhelp
Name := ''
Tag := 0
Databases section
StartPage
AutoRegister := False
BaseURL := ''
KeywordPrefix := ''
Name := ''
Tag := 0
RTLUnits
AutoRegister := False
BaseURL := ''
KeywordPrefix := ''
Name := ''
Tag := 0
FCLUnits
AutoRegister := False
BaseURL := ''
KeywordPrefix := ''
Name := ''
Tag := 0
FreePascal Compiler messages
AdditionsFile := ''
AutoRegister := False
BaseURL := ''
FPCTranslationFile := ''
KeywordPrefix := ''
Name := ''
Tag := 0
FPC Language Reference
Name := ''
Tag := 0
LCL - Lazarus Component Librart
AutoRegister := False
BaseURL := ''
KeywordPrefix := ''
Name := ''
Tag := 0
FreePascal Compiler directives
Name := ''
Tag := 0
External Help
Name := ''
Tag := 0

Well it still does not work, I thought it might be a permissions problem 
because /home/paul/,config/lhelp had permissions set to root, but even 
running lazarus as root didn't solve the problem, F1 will not work.


This is /home/paul/,config/lhelp/ihelp-.conf

?xml version=1.0?
CONFIG
  Position
Left Value=261/
Top Value=244/
Width Value=758/
Height Value=535/
  /Position
  LastFileOpen Value=/usr/share/lazarus/1.0.6/docs/chm/user.chm/
  Recent
ItemCount Value=5/
Item0 Value=file:///usr/share/lazarus/1.0.6/docs/chm/user.chm/
Item1 Value=file:///usr/share/lazarus/1.0.6/docs/chm/toc.chm/
Item2 Value=file:///usr/share/lazarus/1.0.6/docs/chm/rtl.chm/
Item3 Value=file:///usr/share/lazarus/1.0.6/docs/chm/ref.chm/
Item4 Value=file:///usr/share/lazarus/1.0.6/docs/chm/lcl.chm/
  /Recent
  TChmContentProvider
TabControlWidth Value=227/
  /TChmContentProvider
/CONFIG


Is F1 the only way to access the integrated help?

Why is this so difficult?
Why isn't it automatically installed when Lazarus is installed?

Any other ideas?
regards
frustrated Paul

--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Ok I give up!

2013-03-05 Thread appjaws

On 05/03/13 12:50, Reinier Olislagers wrote:
snip


Is F1 the only way to access the integrated help?

Yep. Do note that you need to put the cursor on a keyword (e.g. begin,
or for or while...).


Maaaybe I have the wrong expectations with regard to the Help system.
If I press F1 with begin clicked I do get the help viewer - I've never 
done this before.
I was working on the assumption that if the cursor was over a component 
on the tool bar and them F1 was pressed I would see help about that 
component.  This is why I have been saying that F1 does not work for me.

So question How do I obtain help on a component?

Sorry for all the confusion, I told you that it was probably me being 
silly and not understanding the basics.

regards
Paul

--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Using the clipboard in linux

2013-03-04 Thread appjaws

On 03/03/13 17:41, Mark Morgan Lloyd wrote:

appjaws wrote:

On 03/03/13 17:04, Flávio Etrusco wrote:

On Sun, Mar 3, 2013 at 1:20 PM, appjaws laza...@appjaws.plus.com
wrote:

How do I save, copy to and paste from the clipboard using a kde
environment
on linux 64?
I am using Lazarus 1.0.6 and fpc 2.6.0.
Thanks for any help
Paul


Add unit 'Clipbrd', then
 Clipboard.AsText := 'something';

For custom formats, use AddFormat.

For images, method SaveToClipboardFormat on the image (TGraphic).

-Flávio



I tried this and it didn't work in Linux.
I'll try again


Which didn't work: text or graphic?

[My experience is on 32-bit KDE but] Remember that the persistence of
something on the clipboard is that of the program that put it there.
However look at KDE's Klipper which keeps a history.

Thank you very much, I now have it working and understand how to use 
auto complete. Why it didn't work before I've no idea, probable me 
making a silly mistake.

Paul

--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Ok I give up!

2013-03-04 Thread appjaws

On 02/03/13 17:21, Reinier Olislagers wrote:

On 2-3-2013 17:41, appjaws wrote:

Any ideas on the built in help, I'm using linux with lazarus 1.0.6 and
fpc 2.6.0
snip

Finally, built in help is a nice aid: with your cursor on TMemo, press
F1 and you'll see properties and methods that are available.


  I don't think my built in help is working, F1 does nothing.
  How do I enable built in help?


Well, did you read the wiki article I posted the link for? What happened?


Help is installed in Install/Uninstall Packaged ChmHelpPkg 0.1 is on the 
installed side.  However, F1 is not working, when I look at Tools, 
Options, Key Mapping, Help menu commands, Context sensitive help [F1] is 
shown but F1 does not do anything so I tried to change the key using the 
edit button but the new key was not displayed alongside the entry (Where 
[F1] was) and the new key did not work.

The next entry 'Edit context sensitive help [Ctrl+Shift+F1] does work.
So I am baffled as to what to try next.

I do now have my file procedures working and even have the clipboard 
working.Thank you to all who helped.


Paul

--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Ok I give up!

2013-03-04 Thread appjaws

On 04/03/13 11:28, Reinier Olislagers wrote:

On 4-3-2013 12:21, appjaws wrote:

On 02/03/13 17:21, Reinier Olislagers wrote:

On 2-3-2013 17:41, appjaws wrote:

Any ideas on the built in help, I'm using linux with lazarus 1.0.6 and
fpc 2.6.0
snip

Finally, built in help is a nice aid: with your cursor on TMemo, press
F1 and you'll see properties and methods that are available.


   I don't think my built in help is working, F1 does nothing.
   How do I enable built in help?


Well, did you read the wiki article I posted the link for? What happened?


Help is installed in Install/Uninstall Packaged ChmHelpPkg 0.1 is on the
installed side.  However, F1 is not working, when I look at Tools,
Options, Key Mapping, Help menu commands, Context sensitive help [F1] is
shown but F1 does not do anything so I tried to change the key using the
edit button but the new key was not displayed alongside the entry (Where
[F1] was) and the new key did not work.

Perhaps it's not the key mapping that's wrong?


The next entry 'Edit context sensitive help [Ctrl+Shift+F1] does work.
So I am baffled as to what to try next.


... Try reading the next section  checking the settings  chm files are
okay instead of just the part about the key mappings.



Thank you for the reply,
I have followed the 'installing_Help_in_the_IDE document and  F1 still 
does not work.

/usr/share/lazarus/1.06  is where the components docs etc are installed.
/usr/lib64/fpc/2.6.0 is where pascal is installed/
HelpEXE :- /usr/share/lazarus/1.0.6/components/chmhelp/lhelp/lhelp
HelpFilesPath :- /usr/share/lazarus/1.0.6/docs/chm/
fpc docs :- /usr/share/doc/fp-docs/$(FPCVER)

As far as I can tell everything seems to be in the correct place and 
referenced correctly.


Any other ideas?
regards
Paul
--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Using the clipboard in linux

2013-03-03 Thread appjaws
How do I save, copy to and paste from the clipboard using a kde 
environment on linux 64?

I am using Lazarus 1.0.6 and fpc 2.6.0.
Thanks for any help
Paul
--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Using the clipboard in linux

2013-03-03 Thread appjaws

On 03/03/13 17:04, Flávio Etrusco wrote:

On Sun, Mar 3, 2013 at 1:20 PM, appjaws laza...@appjaws.plus.com wrote:

How do I save, copy to and paste from the clipboard using a kde environment
on linux 64?
I am using Lazarus 1.0.6 and fpc 2.6.0.
Thanks for any help
Paul


Add unit 'Clipbrd', then
 Clipboard.AsText := 'something';

For custom formats, use AddFormat.

For images, method SaveToClipboardFormat on the image (TGraphic).

-Flávio



I tried this and it didn't work in Linux.
I'll try again
Thanks
Paul

--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Ok I give up!

2013-03-02 Thread appjaws

Hi,
How do you write the contents of a Memo to a file and read back into a Memo?
I have tried all sorts, I am using Lazarus 1.0.6 on linux.
How this started was because I wanted to write the content of my Memo to 
the clipboard and be able to paste it back in again, but I couldn't 
figure out how to do this in the linux version.
Another thing how can I find out legal qualifiers i.e. Memo.Clear , 
Memo.Text (both illegal). What is legal?

Thank you for any help
Paul
--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Ok I give up!

2013-03-02 Thread appjaws

On 02/03/13 12:16, Reinier Olislagers wrote:

On 2-3-2013 13:05, appjaws wrote:

Hi,
How do you write the contents of a Memo to a file and read back into a
Memo?

Memo1.Lines.SaveToFile
Memo1.Lines.LoadFromFile


I tried the following line but I just get an error message :-
Call.pas(87,17) Error: Illegal qualifier

MemoCallNote.Lines.SaveToFile ('/home/paul/tmpinfo/MyTempFile.txt');




Another thing how can I find out legal qualifiers i.e. Memo.Clear ,
Memo.Text (both illegal). What is legal?

Type Memo. then press ctrl-space, then identifier completion will show
you legal qualifiers.


I didn't fine .Lines.SaveToFile?



You can also go to the declaration of the tmemo (using alt-up) and see
the source code to inspect the properties/methods/functions but as
you'll see TMemo descends from TCustomMemo, probably inheriting some
properties etc, and the inheritance tree goes on up.

Finally, built in help is a nice aid: with your cursor on TMemo, press
F1 and you'll see properties and methods that are available.


I don't think my built in help is working, F1 does nothing.
How do I enable built in help?

Thank you to all who responded
Paul

--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Ok I give up!

2013-03-02 Thread appjaws
Any ideas on the built in help, I'm using linux with lazarus 1.0.6 and 
fpc 2.6.0

snip

Finally, built in help is a nice aid: with your cursor on TMemo, press
F1 and you'll see properties and methods that are available.


 I don't think my built in help is working, F1 does nothing.
 How do I enable built in help?

 Thank you to all who responded
 Paul



--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Ok I give up!

2013-03-02 Thread appjaws

On 02/03/13 17:21, Reinier Olislagers wrote:

On 2-3-2013 17:41, appjaws wrote:

Any ideas on the built in help, I'm using linux with lazarus 1.0.6 and
fpc 2.6.0
snip

Finally, built in help is a nice aid: with your cursor on TMemo, press
F1 and you'll see properties and methods that are available.


  I don't think my built in help is working, F1 does nothing.
  How do I enable built in help?


Well, did you read the wiki article I posted the link for? What happened?


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Yes thank you I will have a go tomorrow.
Paul
--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Problem growing an array

2013-01-25 Thread appjaws

Hi,
Could one of you experts look at my code please.
My program crashes after the first set of strings are added because -- I 
think -- the length is not updating.

The following is just a snipet.
type
   Detail = record
 Extra1, Extra2, Extra3, Extra4, Extra5, Extra6, Extra7, Extra8 :string
   end;

var
  Form1: TForm1;
  head : array [0..7] of string = ('Extra1', 'Extra2', 'Extra3', 
'Extra4','Extra5', 'Extra6', 'Extra7', 'Extra8');

  x : integer;
  y : integer;
  z : integer;
  w : integer;
  currentLength : integer;
  collection : array of Detail;
  information : array  of array of string;

procedure TForm1.MenuItemInputClick(Sender: TObject);
//initial setup
begin
 SetLength(collection,1);
 SetLength(information,8,1);
end;

procedure TForm1.ButtonNextClick(Sender: TObject);
begin
 // extend array lengths
   if Length(collection)  (y+1)then
   begin
   SetLength(collection, y+1);
   SetLength(information[x],y+1);
   end;

 // load array
   information[0,y] := TEdit1.Text;
   information[1,y] := TEdit2.Text;
   information[2,y] := TEdit3.Text;
   information[3,y] := TEdit4.Text;
   information[4,y] := TEdit5.Text;
   information[5,y] := TEdit6.Text;
   information[6,y] := TEdit7.Text;
   information[7,y] := TEdit8.Text;

//display aray lenghts
   z := (Length(collection));
   LabelResult.Caption := inttostr(z);
   w := (Length(information));
   LabelResult1.Caption := inttostr(w);
 //write to listbox
   for  x := 0 to 7 do
 begin
 ListBox1.Items.Add(head[x] + ' ' + information[x,y] + ' ');
 end;
  //clear edit boxes
   TEdit1.Text := ' ';
   TEdit2.Text := ' ';
   TEdit3.Text := ' ';
   TEdit4.Text := ' ';
   TEdit5.Text := ' ';
   TEdit6.Text := ' ';
   TEdit7.Text := ' ';
   TEdit8.Text := ' ';
   y := y + 1
end;

After the first set of strings are added, I get this error message:-

Project protection raised exception class 'External: SIGSEGV'.

I'm sure it's just me not understanding how arrays should be manipulated,
Look forward to any help
Paul
--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Problem growing an array

2013-01-25 Thread appjaws

On 25/01/13 18:26, Howard Page-Clark wrote:

On 25/1/13 3:55, appjaws wrote:

Hi,
Could one of you experts look at my code please.
My program crashes after the first set of strings are added because -- I
think -- the length is not updating.
The following is just a snipet.


It's hard to tell from a snippet, but I don't see anywhere that you are
initialising the values of your array indices x and y.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Thank you for your reply,

procedure TForm1.MenuItemInputClick(Sender: TObject);

//initial setup
begin
 SetLength(collection,1);
 SetLength(information,8,1);
 x := 0;
 y := 0;
end;

Sorry I missed that out.
Paul
--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Lazarus books

2013-01-24 Thread appjaws

Hi all,
I am trying to get to grips with lazarus and freepascal, but I am 
finding it difficult to find out all of the attributes that can be used 
and indeed what some of the components can be used for.
I need a book or site that can explain these details and provide working 
examples that I can use as practise.
I know what I want to achieve with a gui program but not the best way to 
to complete an operation.

Any pointers would be most welcome,
Paul
--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] terminal window not displayed in lazarus on kubuntu linux

2013-01-19 Thread appjaws

On 18/01/13 17:44, Malcolm Poole wrote:

On 18/01/13 11:25, Paul wrote:

I am running kubuntu linux which runs KDE as the desktop and have
installed lazarus 1,0,4, FPC version 2.6.0. x86_64-linux-gtk2.
The problem:
When I choose run, the program compiles just fine but the output is not
displayed in a terminal window.  This happens with all of my programs
running on lazarus.
I have the same lazarus, fpc and programs running on windows and on
windows as soon as the program is compiled a terminal window pops up and
displayed the results.


 From the 'Run' menu, select 'Run Parameters' and check 'Use Launching
Application'. If Lazarus complains that it can't find the launching
application, choose another from the combobox list

snip
Thank you for your reply Malcolm and leledumbo,
The rub parameter for selection is:-

/usr/bin/konsole -T 'Lazarus Run Output' -e 
$(LazarusDir)/tools/runwait.sh $(TargetCmdLine)


If I select this and then run a program execution is stopped but the 
console window (from DeBug window-Terminal output) shows the following:-


QDBusConnection: session D-Bus connection created before 
QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before 
QCoreApplication. Application may misbehave.
Fontconfig warning: /etc/fonts/conf.d/50-user.conf, line 9: reading 
configurations from ~/.fonts.conf is deprecated.


If I don't check 'Use Launching Application' but have the debug console 
showing I get the following:


 9 9 2 2 8 5 4 3 5 10 3 4 6 8 6 8 8 1 3 2 10 5 6 4 1 3 
10 4 5 8 9 10 1 3 8 10 6 1

0 5 1 5 8 5 4 4 5 9 1 3 2
Please Press Enter To Quit

This program should clear screen and generate random numbers 
but the  and[1B seem to be control codes, also the 
console does not refresh.
So as an example how can I check that a program is working correctly 
without having to run a final executable?

If I './executable' it run and clears screen perfectly.

I just can't see why the linux version will not work the same as the 
windows version.


I hope all of the above is clear and look forward to any advise.
regards
Paul
--
---This message has been sent using Thunderbird on kubuntu---

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus