[Lazarus] Example of TObjectList sorting

2016-05-09 Thread Richard Mace
Hi All,

I have a TObjectList that contains many objects that have a property called
"Position" which is an integer.

Could somebody show me an example of the code that I will need to create
that will sort all of my Objects within the TObjectList so that they are in
position order e.g. 1,2,3,4,5 and so on?

Thanks

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


Re: [Lazarus] Fw: new message

2016-05-09 Thread brian
On Sun, 8 May 2016 17:42:21 -0400, you wrote:

>On 05/08/2016 03:43 PM, Lazarus mailing list  wrote:
>> Hello!
>>
>> *You have a new message, please read* 
>> hxxp://thesafeandlockshop.co.uk/loud.php?lh
>>
>> Lazarus mailing list
>
>would an admin handle this infested account, please?
>

I'd suspect that the sender address is forged. Nothing that the
alleged sender can do about it if so. Nuking their account seems a
little harsh. 


Brian. 

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


Re: [Lazarus] Example of TObjectList sorting

2016-05-09 Thread Denis Kozlov
On 9 May 2016 at 12:48, Richard Mace  wrote:

> I have a TObjectList that contains many objects that have a property
> called "Position" which is an integer.
>
> Could somebody show me an example of the code that I will need to create
> that will sort all of my Objects within the TObjectList so that they are in
> position order e.g. 1,2,3,4,5 and so on?
>

Call TList.Sort method and supply a comparison function.


For example:

List.Sort(@CompareByPositionPtr);

function CompareByPosition(A, B: TMyObject): Integer; inline;
begin
  if A.Position < B.Position then
Result := -1
  else if A.Position > B.Position then
Result := 1
  else
Result := 0;
end;

function CompareByPositionPtr(A, B: Pointer): Integer;
begin
  Result := CompareByPosition(TMyObject(A), TMyObject(B));
end;


This kind of question is better suited on the forum I think

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


Re: [Lazarus] Missing components in Lazarus 1.6 DEB

2016-05-09 Thread Denis Kozlov
Package "lazarus-1.6" and its sub-packages are missing many of Lazarus 1.6
source files.

Reported to Debian:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823706

Beware when installing from Debian packaged repositories.

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


Re: [Lazarus] Example of TObjectList sorting

2016-05-09 Thread Graeme Geldenhuys
On 2016-05-09 13:24, Denis Kozlov wrote:
> This kind of question is better suited on the forum I think

Why? This mailing list is just as much a support area as the web forum.
Not everybody likes web based forums (I don't).

Granted the question related more to the RTL that Lazarus or LCL, so if
anything, it could have been posted in the fpc-users mailing list.  But
you were kind enough to answer anyway. ;-)


Regards,
  Graeme


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


Re: [Lazarus] Example of TObjectList sorting

2016-05-09 Thread Denis Kozlov
On 9 May 2016 at 13:44, Graeme Geldenhuys 
wrote:

> On 2016-05-09 13:24, Denis Kozlov wrote:
> > This kind of question is better suited on the forum I think
>
> Why? This mailing list is just as much a support area as the web forum.
> Not everybody likes web based forums (I don't).
>

Forum is especially good for tutorials, generic and commonly asked
questions - like a repository of knowledge, Also, forums are more easily
searched, indexed by search engines and easier to view for novice users.
Hence, I think this question/answer would reach more end users while being
on the forum, instead of on a mailing list.

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


Re: [Lazarus] Example of TObjectList sorting

2016-05-09 Thread Graeme Geldenhuys
On 2016-05-09 14:12, Denis Kozlov wrote:
> Also, forums are more easily
> searched, indexed by search engines and easier to view for novice users.


Lets agree to disagree.  ;-)

ps:
  The mailing lists are also searched and indexed by search engines -
  thanks to services like Nabble and many others. But then again, my
  email client does just fine searching on its own (and can do it
  offline).

  http://free-pascal-lazarus.989080.n3.nabble.com/
  http://free-pascal-general.1045716.n5.nabble.com/


Regards,
  Graeme



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


[Lazarus] does dbGrid's AutoSizeColumns method need to also be called in form's OnResize event?

2016-05-09 Thread Bob B.
Or is it sufficient to just include this in form's OnCreate or OnShow event?
with myDBGrid beginif not (dgautosizecolumns in options) then         options 
:= options + [dgautosizecolumns];        AutoSizeColumns; end;
Thanks.
Bob B.--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus