Re: [Lazarus] "buffer" and string

2013-03-02 Thread Xiangrong Fang
If a buffer expect the first "element", and count is the number of elements to write, then what is the unit size of that element? is it always "byte"? 2013/3/3 leledumbo > > My question is, why the above code with string works sometime, but not > alwasy fail? > > TStream.Write expects a buffer,

Re: [Lazarus] "buffer" and string

2013-03-02 Thread leledumbo
> My question is, why the above code with string works sometime, but not alwasy fail? TStream.Write expects a buffer, typically the first element of an item (NOT a pointer to it) and the length (number of elements after first one). > fs.Write(s, Length(s)); Here you try to give the WHOLE string,

Re: [Lazarus] Ok I give up!

2013-03-02 Thread waldo kitty
On 3/2/2013 13:20, Mark Morgan Lloyd wrote: Note that if you download the helpfiles manually, you might have to be careful of exactly where you put them: it's easy to have a situation you've unpacked them in a slightly different directory from where lhelp expects. agreed... and if following the

[Lazarus] "buffer" and string

2013-03-02 Thread Xiangrong Fang
Hi, I encountered unpredictable behavior with the following code: var fs: TFileStream; s: string; begin ... ... fs.Write(s, Length(s)); ... ... end; But if I do this, then problem is gone: var fs: TFileStream; s: string; buf: PChar; begin ... ... buf := GetMem(Length(s) + 1)

Re: [Lazarus] ForceDirectoriesUTF8

2013-03-02 Thread Xiangrong Fang
> I would think that that depends on where you get the value for > ForceDirectories(UTF8) from. > If this vale is obtained from any widget (OpenDialog, TEdit, etc.) the > encoding of the value is in UTF-8. > If however you get the value as a commandline parameter, then it is in > system-encoding if

[Lazarus] Did anybody else use retinizer for Macbook Retina on lazarus before?

2013-03-02 Thread Johannes W. Dietrich
Hi Mattias, sorry that I did not answer your Post before today, somehow I did not see it. But as I saw in svn you managed to find it out by yourself, thank you for adding retina support to trunk! Great! Is there any documentation available? Thank you, Johannes Michael Am 27.02.13 10:59,

Re: [Lazarus] ForceDirectoriesUTF8

2013-03-02 Thread Bart
On 3/2/13, Xiangrong Fang wrote: > In order to write cross platform programs, shall I use ForceDirectories or > ForceDirectoriesUTF8? I would like to: I would think that that depends on where you get the value for ForceDirectories(UTF8) from. If this vale is obtained from any widget (OpenDialog

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Flávio Etrusco
On Sat, Mar 2, 2013 at 11:36 AM, Hans-Peter Diettrich wrote: > Reinier Olislagers schrieb: > > >>> What is *not* clear, to the OP and many other users, that the required >>> functionality is *not* found directly in TMemo, but resides in a >>> property (.Lines) of it. In such cases code completion

Re: [Lazarus] Maintainers: packages without description: please add them

2013-03-02 Thread Jesus Reyes
--- El vie 1-mar-13, Reinier Olislagers escribió: > > lazreportpdfexport > Enables PDF export for lazreport (requires LazReport and > PowerPDF) > > lr_add_function > ? > Additional functions for lazreport (requires LazReport) > > lr_codereport_pkg > ? > > lr_dialogdesign > ? > > lr_sqldb >

Re: [Lazarus] exception handling in constructor

2013-03-02 Thread Flávio Etrusco
On Sat, Mar 2, 2013 at 7:51 AM, Michael Van Canneyt wrote: > > > On Sat, 2 Mar 2013, Howard Page-Clark wrote: > >> On 02/03/13 5:45, Flávio Etrusco wrote: >>> >>> On Fri, Mar 1, 2013 at 11:49 PM, Xiangrong Fang wrote: (...) > > Also, setting Self to nil is nonsense. > > If you do FreeAndNil(

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Mark Morgan Lloyd
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 Finally, built in help is a nice aid: with your cursor on TMemo, press F1 and you'll see properties and methods that a

[Lazarus] Accessing windows mobile handhelds from Lazarus programs

2013-03-02 Thread Arí Ricardo Ody
Some time a guy from the Lazarus team commented with me that I can use microsoft .NET DLLs from a Lazarus program. The idea I have is access SQLite databases recorded in a windows mobile handheld from a Lazarus program running in a PC computer. I know this is possible when try from a C# program.

Re: [Lazarus] Photo camera and RFID devices

2013-03-02 Thread Arí Ricardo Ody
I was waiting some code examples. I have no expertise in these tecnologies you mentioned. SetCommDCB? DirectX? I have devices with camera and RFID readers builtin, and they aren't exactly the most recent models. From which SDK are you talking about? Every device with camera and/or RFID reader g

Re: [Lazarus] Assignment on exception (was Re: exception handling in constructor)

2013-03-02 Thread waldo kitty
On 3/2/2013 12:48, waldo kitty wrote: On 3/2/2013 12:43, patspiper wrote: On 02/03/13 19:34, waldo kitty wrote: what am i missing?? Probably http://wiki.freepascal.org/Multiplatform_Programming_Guide#Gtk2_and_masking_FPU_exceptions the main thing i see there is that the sample uses the math

Re: [Lazarus] Assignment on exception (was Re: exception handling in constructor)

2013-03-02 Thread waldo kitty
On 3/2/2013 12:43, patspiper wrote: On 02/03/13 19:34, waldo kitty wrote: what am i missing?? Probably http://wiki.freepascal.org/Multiplatform_Programming_Guide#Gtk2_and_masking_FPU_exceptions the main thing i see there is that the sample uses the math unit... if this is what is necessary,

Re: [Lazarus] Assignment on exception (was Re: exception handling in constructor)

2013-03-02 Thread patspiper
On 02/03/13 19:34, waldo kitty wrote: On 3/2/2013 08:25, Xiangrong Fang wrote: I guess there is really a bug, see the following: == f := 123; try f := ln(0); except end; //WriteLn(f); //{ if f = 123 then WriteLn('f=123, not modified')

Re: [Lazarus] Assignment on exception (was Re: exception handling in constructor)

2013-03-02 Thread waldo kitty
On 3/2/2013 08:25, Xiangrong Fang wrote: I guess there is really a bug, see the following: == f := 123; try f := ln(0); except end; //WriteLn(f); //{ if f = 123 then WriteLn('f=123, not modified') else WriteLn('f is modified to:',

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 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.

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Reinier Olislagers
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 > >>> 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

Re: [Lazarus] Help with... help!

2013-03-02 Thread Reinier Olislagers
On 2-3-2013 17:51, waldo kitty wrote: > On 3/2/2013 00:20, Reinier Olislagers wrote: >> Guys, >> >> Anybody else interested in getting F1 to show the offline help if >> context-sensitive help is not appropriate? > > i followed a wiki page that the help points to... the only thing i'm not > sure of

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Reinier Olislagers
Hi Paul, I'm going to respond to the list as well so they know what's going on. On 2-3-2013 17:35, Paul wrote: > Thank you Reinier for your offer to look at my code.I am new to Lazarus > and am working through some delphi books to try and learn, but this has > got me stumped. > I tried a new for

Re: [Lazarus] Ok I give up!

2013-03-02 Thread waldo kitty
On 3/2/2013 07:54, Hans-Peter Diettrich wrote: What is *not* clear, to the OP and many other users, that the required functionality is *not* found directly in TMemo, but resides in a property (.Lines) of it. In such cases code completion is of little help :-( this is what i was going to write b

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Martin
On 02/03/2013 13:49, appjaws wrote: 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 err

Re: [Lazarus] Help with... help!

2013-03-02 Thread waldo kitty
On 3/2/2013 00:20, Reinier Olislagers wrote: Guys, Anybody else interested in getting F1 to show the offline help if context-sensitive help is not appropriate? i followed a wiki page that the help points to... the only thing i'm not sure of is why it doesn't get built automatically when i upd

Re: [Lazarus] ForceDirectoriesUTF8

2013-03-02 Thread leledumbo
> as all my programs use string type, change them all to AnsiString is scaring and I don't know the consequence at all Do you access the string's internal structure? Do you write the string to file directly instead of taking its content? If not, then nothing you have to worry about. Standard strin

Re: [Lazarus] Ok I give up!

2013-03-02 Thread leledumbo
> I don't think my built in help is working, F1 does nothing. How do I enable built in help? http://wiki.freepascal.org/Installing_Help_in_the_IDE -- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Ok-I-give-up-tp4029554p4029579.html Sent from the Free

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 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 bu

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Juha Manninen
On Sat, Mar 2, 2013 at 4:38 PM, Hans-Peter Diettrich wrote: >> Code completion finds the Lines property without problems. > > How is this helpful in finding the property, which finally implements Clear > or some other task? First you find Lines, then you find Clear. It is very helpful. :) Your i

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Sven Barth
On 02.03.2013 15:57, Leonardo M. Ramé wrote: On 2013-03-02 13:49:48 +, appjaws wrote: 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? MemoCallNote.Lines.SaveToFile ('/home/paul

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Hans-Peter Diettrich
Juha Manninen schrieb: On Sat, Mar 2, 2013 at 2:54 PM, Hans-Peter Diettrich wrote: What is *not* clear, to the OP and many other users, that the required functionality is *not* found directly in TMemo, but resides in a property (.Lines) of it. In such cases code completion is of little help :-(

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Hans-Peter Diettrich
Reinier Olislagers schrieb: What is *not* clear, to the OP and many other users, that the required functionality is *not* found directly in TMemo, but resides in a property (.Lines) of it. In such cases code completion is of little help :-( True, but what other suggestion do you have apart fro

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Leonardo M . Ramé
On 2013-03-02 13:49:48 +, appjaws wrote: > 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? > > MemoCallNote.Lines.SaveToFile ('/home/paul/tmpinfo/MyTempFile.txt'); >

Re: [Lazarus] ForceDirectoriesUTF8

2013-03-02 Thread Xiangrong Fang
My program is always in {$mode objfpc} So string is not a problem, but shall I use the UTF8 version or not? I remember that Windows is NOT UTF8? 2013/3/2 Sven Barth > On 02.03.2013 15:12, Xiangrong Fang wrote: > >> * Avoid using AnsiString or the like (as all my programs use string >> >>

Re: [Lazarus] ForceDirectoriesUTF8

2013-03-02 Thread Sven Barth
On 02.03.2013 15:12, Xiangrong Fang wrote: * Avoid using AnsiString or the like (as all my programs use string type, change them all to AnsiString is scaring and I don't know the consequence at all). Are your programs compiled in either {$mode Delphi} or {$mode ObjFPC}{$H+}? If so th

[Lazarus] ForceDirectoriesUTF8

2013-03-02 Thread Xiangrong Fang
Hi, In order to write cross platform programs, shall I use ForceDirectories or ForceDirectoriesUTF8? I would like to: - Use native charset on the platform (i.e. UTF8 on Linux and whatever codepage on Windows) - Avoid using AnsiString or the like (as all my programs use string type, c

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Reinier Olislagers
On 2-3-2013 14:49, appjaws wrote: > 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 bu

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:

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Juha Manninen
On Sat, Mar 2, 2013 at 2:54 PM, Hans-Peter Diettrich wrote: > What is *not* clear, to the OP and many other users, that the required > functionality is *not* found directly in TMemo, but resides in a property > (.Lines) of it. In such cases code completion is of little help :-( Code completion fi

Re: [Lazarus] Assignment on exception (was Re: exception handling in constructor)

2013-03-02 Thread Michael Van Canneyt
On Sat, 2 Mar 2013, Sven Barth wrote: On 02.03.2013 14:04, Xiangrong Fang wrote: Hi, Could anyone explain this: Number := 123; try Number := Ln(0); except end; WriteLn(Number); The output is *Nan*, not 123. i.e. when exception occurs the variable is modified anyway! So in the example b

Re: [Lazarus] Assignment on exception (was Re: exception handling in constructor)

2013-03-02 Thread Sven Barth
On 02.03.2013 14:04, Xiangrong Fang wrote: Hi, Could anyone explain this: Number := 123; try Number := Ln(0); except end; WriteLn(Number); The output is *Nan*, not 123. i.e. when exception occurs the variable is modified anyway! So in the example below assigning MyInstance to nil before Cr

Re: [Lazarus] Assignment on exception (was Re: exception handling in constructor)

2013-03-02 Thread Xiangrong Fang
I guess there is really a bug, see the following: == f := 123; try f := ln(0); except end; //WriteLn(f); //{ if f = 123 then WriteLn('f=123, not modified') else WriteLn('f is modified to:', f); //} === If I just

Re: [Lazarus] Assignment on exception (was Re: exception handling in constructor)

2013-03-02 Thread Michael Van Canneyt
On Sat, 2 Mar 2013, Xiangrong Fang wrote: Hi, Could anyone explain this: Number := 123; try   Number := Ln(0); except end; WriteLn(Number); The output is Nan, not 123. i.e. when exception occurs the variable is modified anyway!  So in the example below assigning MyInstance to nil before Cr

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Michael Van Canneyt
On Sat, 2 Mar 2013, Hans-Peter Diettrich wrote: Juha Manninen schrieb: On Sat, Mar 2, 2013 at 2:05 PM, appjaws wrote: Another thing how can I find out legal qualifiers i.e. Memo.Clear , Memo.Text (both illegal). What is legal? See Memo.Lines. It has Clear and Text and everything that TStr

[Lazarus] Assignment on exception (was Re: exception handling in constructor)

2013-03-02 Thread Xiangrong Fang
Hi, Could anyone explain this: Number := 123; try Number := Ln(0); except end; WriteLn(Number); The output is *Nan*, not 123. i.e. when exception occurs the variable is modified anyway! So in the example below assigning MyInstance to nil before Create does not help to ensure it is nil if an e

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Reinier Olislagers
On 2-3-2013 13:54, Hans-Peter Diettrich wrote: > Juha Manninen schrieb: >> On Sat, Mar 2, 2013 at 2:05 PM, appjaws wrote: >>> Another thing how can I find out legal qualifiers i.e. Memo.Clear , >>> Memo.Text (both illegal). What is legal? >> >> See Memo.Lines. >> It has Clear and Text and everythi

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Hans-Peter Diettrich
Juha Manninen schrieb: On Sat, Mar 2, 2013 at 2:05 PM, appjaws wrote: Another thing how can I find out legal qualifiers i.e. Memo.Clear , Memo.Text (both illegal). What is legal? See Memo.Lines. It has Clear and Text and everything that TStrings supports. How to find it? With a new component

Re: [Lazarus] exception handling in constructor

2013-03-02 Thread Hans-Peter Diettrich
Sven Barth schrieb: If you want to ensure that MyInstance is Nil you need to do it like this: === code begin === try MyInstance := TMyClass.Create('AnNonExistentFile'); except MyInstance := Nil; end; === code end === When an exception occurs in Create, the assignment will never take pl

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Juha Manninen
On Sat, Mar 2, 2013 at 2:05 PM, appjaws wrote: > Another thing how can I find out legal qualifiers i.e. Memo.Clear , > Memo.Text (both illegal). What is legal? See Memo.Lines. It has Clear and Text and everything that TStrings supports. How to find it? With a new component I usually look at its

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Michael Van Canneyt
On Sat, 2 Mar 2013, appjaws wrote: 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. Simple: Memo1.Lines.SaveToFile('/home/yourname/yourfile.txt'); And Memo1.Lines.LoadFromFile('/home/yourname/yourfi

Re: [Lazarus] Ok I give up!

2013-03-02 Thread Reinier Olislagers
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 > Another thing how can I find out legal qualifiers i.e. Memo.Clear , > Memo.Text (both illegal). What is legal? Type Memo. then

[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

Re: [Lazarus] exception handling in constructor

2013-03-02 Thread Howard Page-Clark
On 02/03/13 10:51, Michael Van Canneyt wrote: This will definitely cause a memory leak, because the FPC code does not know that an exception occurred in the constructor (you catch it with Except), and hence will not call the destructor. Thanks for the correction and explanation. Howard -- _

Re: [Lazarus] Did anybody else use retinizer for Macbook Retina on lazarus before?

2013-03-02 Thread Michael Ring
Hi Mattias, sorry that I did not answer your Post before today, somehow I did not see it. But as I saw in svn you managed to find it out by yourself, thank you for adding retina support to trunk! Michael Am 27.02.13 10:59, schrieb Mattias Gaertner: On Sun, 17 Feb 2013 20:45:07 +0100 Micha

Re: [Lazarus] exception handling in constructor

2013-03-02 Thread Michael Van Canneyt
On Sat, 2 Mar 2013, Howard Page-Clark wrote: On 02/03/13 5:45, Flávio Etrusco wrote: On Fri, Mar 1, 2013 at 11:49 PM, Xiangrong Fang wrote: Hi there, If my class constructor looks like this: constructor TMyClass.Create(fn: string); begin sl := TStringList.Create; try fs := TFil

Re: [Lazarus] exception handling in constructor

2013-03-02 Thread Howard Page-Clark
On 02/03/13 5:45, Flávio Etrusco wrote: On Fri, Mar 1, 2013 at 11:49 PM, Xiangrong Fang wrote: Hi there, If my class constructor looks like this: constructor TMyClass.Create(fn: string); begin sl := TStringList.Create; try fs := TFileStream.Create(fn, fmOpenRead); except se

Re: [Lazarus] exception handling in constructor

2013-03-02 Thread Sven Barth
On 02.03.2013 03:49, Xiangrong Fang wrote: Hi there, If my class constructor looks like this: constructor TMyClass.Create(fn: string); begin sl := TStringList.Create; try fs := TFileStream.Create(fn, fmOpenRead); except self.Destroy; end; end; No, this is a bad idea. If