Re: [fpc-pascal] Using StrindGrid

2010-01-14 Thread John & Marg Sunderland
berna uyan?k wrote: Hi, I started lazarus newly Codes that I used is below: unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Grids; type { TForm1 } TForm1 = class(TForm) grid1: TStringGrid; procedure FormCreate(Sen

[fpc-pascal] Using StrindGrid

2010-01-14 Thread berna uyanık
Hi, I started lazarus newly Codes that I used is below: unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Grids; type { TForm1 } TForm1 = class(TForm) grid1: TStringGrid; procedure FormCreate(Sender: TObject); private {

Re: [fpc-pascal] FPC class syntax was extended to support delphi code

2010-01-14 Thread Paul Ishenin
Marc Weustink wrote: Can we have a virtual version too like described here http://hallvards.blogspot.com/2007/05/hack17-virtual-class-variables-part-i.html Well, I suppose we can if someone will implement ;) Best regards, Paul Ishenin. ___ fpc-pasca

Re: [fpc-pascal] FPC class syntax was extended to support delphi code

2010-01-14 Thread Marc Weustink
Paul Ishenin wrote: David Emerson wrote: d. What happens with inheritance? d.1. wrt class constants and class vars-- are there separate "instances" (for lack of a better word) of these, one instance for each descendant? Or is the class var/const only stored once for the ancestor that declare

Re: [fpc-pascal] GetProcAddress

2010-01-14 Thread Anthony Walter
I am not too sure why GetProcAddress is returning nil, but a few points: 1) you do not need to typecast string literals as PChar FGetAsText := GetProcAddress (FHandle, 'clipboard_getastext'); 2) You really should not return strings as PChar, passing them is fine, but return, nope result := PCha

[fpc-pascal] GetProcAddress

2010-01-14 Thread Roland Turcan
Hello friends, I have written a very simple library which contains only two exports. It is intended to be a bridge between an old application and clipboard on linux to exchange data. --- library clipbrdgtk; {$MODE Delphi} uses Classes, Interface

Re: [fpc-pascal] Why does not assignment from int64 to integer trigger warning?

2010-01-14 Thread Jichao Yang
@Jonas, Thanks,it works well. Turn on the range checking switch {$R+},the free pascal compiler would also seek for compile-time range error.For example,the follow line will not compile through: byteVal := 256; It will produce 'Error: range check error while evaluating constants'; In conclusion,

Re: [fpc-pascal] Why does not assignment from int64 to integer trigger warning?

2010-01-14 Thread Jonas Maebe
On 14 Jan 2010, at 16:30, Jichao Yang wrote: int64Val := 2147483648; { 2^32 } intVal := int64Val; { does not trigger any warnings } Assigning a longint to a byte does not generate a warning either. This is simply how Pascal works. If you want compile-time checks for such operations, use

Re: [fpc-pascal] Generics problem/question

2010-01-14 Thread Honza
Hi all. At Mantis Florian already explained, why it is not possible to provide more information in the error message. Still he meanwhile managed to make it better. I got some time to return to this and now I'm here: 17:11 myn...@tux64:~/fpc/bugreports/20100105$ cat project1.pas program project1;

[fpc-pascal] Why does not assignment from int64 to integer trigger warning?

2010-01-14 Thread Jichao Yang
int64Val := 2147483648; { 2^32 } intVal := int64Val; { does not trigger any warnings } Now the intVal should be 0 which is not what I wanted. my platform: v2.4.0[2009/12/18] for i386 under windows. regards. jcyang. ___ fpc-pascal maillist - fpc-pasca

Re: [fpc-pascal] Swopping two items in TCollection

2010-01-14 Thread Michael Van Canneyt
Please do, this way we won't forget it. Michael. On Thu, 14 Jan 2010, Wimpie Nortje wrote: Thanks. An exhange() would be usefull. Should I file a bug report? Michael Van Canneyt wrote: On Thu, 14 Jan 2010, Wimpie Nortje wrote: Hi list I have a class derived from Tcollection, holding

Re: [fpc-pascal] Why limit string constant to 255?

2010-01-14 Thread Jonas Maebe
On 14 Jan 2010, at 15:23, Jichao Yang wrote: > I have one question about the free pascal programming language: why > limit string constant to 255? It's an implementation limit of the scanner (which uses shortstrings for speed reasons). Jonas___ fpc-

[fpc-pascal] Why limit string constant to 255?

2010-01-14 Thread Jichao Yang
Hi all,I have one question about the free pascal programming language: why limit string constant to 255? write('a x 256'); would produce 'Error: Constant string can't be longer than 255 chars',with fpc 2.4.0 default/objfpc/delphi/tp model. But gnu pascal would compile this well. On the other side

Re: [fpc-pascal] Swopping two items in TCollection

2010-01-14 Thread Wimpie Nortje
Thanks. An exhange() would be usefull. Should I file a bug report? Michael Van Canneyt wrote: On Thu, 14 Jan 2010, Wimpie Nortje wrote: Hi list I have a class derived from Tcollection, holding items derived from TCollectionItem. How do I swop two items in the collection? FItem is of type

Re: [fpc-pascal] FPC class syntax was extended to support delphi code

2010-01-14 Thread Andreas Schneider
I think they come in very handy for the Singleton OOP concept. You need to have a "factory" that handles the object query/instantiation. If no instance is available, it creates a new one (and stores it) and if one is already available, it just returns that. Naturally that looks better to have TS

Re: [fpc-pascal] Swopping two items in TCollection

2010-01-14 Thread Michael Van Canneyt
On Thu, 14 Jan 2010, Wimpie Nortje wrote: Hi list I have a class derived from Tcollection, holding items derived from TCollectionItem. How do I swop two items in the collection? FItem is of type TList which has an exchange function, but that is private and not accessable to me. You can s