* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
LCL / Re: TListView: Reduce space between images.
« Last post by jamie on Today at 11:31:08 pm »
Look in the "Columns" Array and set the Maxwidth for First column ?

Columns is an array of TlistColumn  which has MaxWidth and MinWidth or even Width..

2
General / Re: More objects and object list questions
« Last post by molly on Today at 11:27:56 pm »
Offending line highlighted below.


Code: Pascal  [Select]
  1. unit MainFormUnit;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, InsUnit, fgl;
  9.  
  10. type
  11.   TInsList = specialize TFPGObjectList<TIns>;
  12.  
  13. type
  14.  
  15.   { TForm1 }
  16.  
  17.   TForm1 = class(TForm)
  18.     ShowListButton: TButton;
  19.     ShowObjectsButton: TButton;
  20.     Memo1: TMemo;
  21.     procedure FormCreate(Sender: TObject);
  22.     procedure ShowListButtonClick(Sender: TObject);
  23.     procedure ShowObjectsButtonClick(Sender: TObject);
  24.   private
  25.  
  26.   public
  27.  
  28.   end;
  29.  
  30. const
  31.   I_NUM_ENTRIES : integer = 4;
  32.  
  33. var
  34.   Form1: TForm1;
  35.   InsList : TInsList;
  36.  
  37. implementation
  38.  
  39. {$R *.lfm}
  40.  
  41. { TForm1 }
  42.  
  43. procedure TForm1.ShowObjectsButtonClick(Sender: TObject);
  44. var
  45.   i : integer = 0;
  46.   InsObj : TIns;
  47.  
  48. begin
  49.  
  50.   InsList := TInsList.Create;
  51.  
  52.   for i := 0 to I_NUM_ENTRIES do
  53.     begin
  54.       InsObj := TIns.Create;
  55.       InsObj.Init();
  56.       InsObj.RunTimeInsNumber := i;
  57.       InsObj.InsSerial := 'testSerialNum' + IntToStr(i);
  58.       InsObj.InsName := 'Name '  + IntToStr(i);
  59.       InsList.add(InsObj);
  60.       Memo1.Lines.Add(IntToStr(InsObj.RunTimeInsNumber));
  61.       Memo1.Lines.Add(InsObj.InsSerial);
  62.       Memo1.Lines.Add(InsObj.InsName);
  63.       Memo1.Lines.Add('  ');
  64.  
  65.       InsObj.Free;
  66.     end;
  67.  
  68.   ShowListButton.Enabled:=true;
  69.  
  70. end;
  71.  
  72. procedure TForm1.ShowListButtonClick(Sender: TObject);
  73. var
  74.   i : integer = 0;
  75.   InsObj : TIns;
  76.   var p : pointer;
  77.  
  78. begin
  79.  
  80.   i := InsList.Count;
  81.  
  82.   Memo1.Lines.Add('--------------- ');
  83.   Memo1.Lines.Add('Items from list ');
  84.   Memo1.Lines.Add('--------------- ');
  85.   Memo1.Lines.Add(' ');
  86.  
  87.    for i := 0 to I_NUM_ENTRIES do
  88.      begin
  89.        InsObj := TIns.Create;
  90.        InsObj.Init();
  91.        InsObj.RunTimeInsNumber:= InsList[i].RunTimeInsNumber;
  92.        InsObj.InsSerial := InsList[i].InsSerial;
  93.        InsObj.InsName:=InsList[i].InsName;
  94.        Memo1.Lines.Add(IntToStr(InsObj.RunTimeInsNumber));
  95.        Memo1.Lines.Add(InsObj.InsSerial);
  96.        Memo1.Lines.Add(InsObj.InsName);
  97.      end;
  98.  
  99.  
  100. end;
  101.  
  102. procedure TForm1.FormCreate(Sender: TObject);
  103. begin
  104.   ShowListButton.Enabled:=false;
  105. end;
  106.  
  107. end.    
3
General / Re: Cannot find unit file
« Last post by jamie on Today at 11:20:48 pm »
I like the simple CONTROL+LEFTMOUSE_CLICK over item.
4
General / Re: Dll pascal Library to be used also with .net
« Last post by molly on Today at 11:12:02 pm »
More info also here.
5
General / Re: More objects and object list questions
« Last post by jamie on Today at 11:10:20 pm »
as with many objects that have index functions they are 0 based...

 What this means is  if you have X-NUMBEROF_ENTRIies, you start at 0 and end at COUNT-1

 So if a list has 10 items and you want to index them...

 For I := 0 To 9 do.....
  or
 For I := 0 To SomeList.Count-1 do...


 0 index counts as the first item..


6
LCL / TListView: Reduce space between images.
« Last post by GAN on Today at 11:06:59 pm »
Is there a way to reduce it?, because I don't use caption. SmallImages used and ViewStyle := vsSmallIcon.

Best regards.
7
General / Re: Dll pascal Library to be used also with .net
« Last post by amartitegui on Today at 11:03:08 pm »
Thanks man, ill take a look at that info.
Btw, both lazarus testing dll and .net compiled x86.
8
Third party / Re: I need some more advanced message box?
« Last post by taazz on Today at 11:01:39 pm »
Very long button captions are IMO more often than not confusing.
+1 the option description is to be shown on the message it self not the buttons its not by accident that the only choices on buttons are yes, yes to all, no, no to all, ok, cancel.
9
Editor / Re: Ability to move current line up or down?
« Last post by taazz on Today at 10:51:44 pm »
Find attached a package that installs two extra commands to move the line under the cursor up or down it is written fast and tested little, but if you compile it in lazarus you will find two commands under the source menu (the two commands before the last) and have the shortcuts ctrl+alt+up,ctrl+alt+Down which can be changed in the application options I guess, I did not test it.
TODO (some one else I guess)
1) auto enable/disable depending on the cursor position
2) add undo/redo steps in the editor.
10
General / More objects and object list questions
« Last post by jbmckim on Today at 10:46:27 pm »
This is a companion to my previous question on oject lists.  This one however attempts to use a different approach to reading a list of objects.  It has a problem that I can't figure out.

This demo program is built from two units.  (Most of the main unit is display.)

Here's the main unit:

Code: Pascal  [Select]
  1. unit MainFormUnit;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, InsUnit, fgl;
  9.  
  10. type
  11.   TInsList = specialize TFPGObjectList<TIns>;
  12.  
  13. type
  14.  
  15.   { TForm1 }
  16.  
  17.   TForm1 = class(TForm)
  18.     ShowListButton: TButton;
  19.     ShowObjectsButton: TButton;
  20.     Memo1: TMemo;
  21.     procedure FormCreate(Sender: TObject);
  22.     procedure ShowListButtonClick(Sender: TObject);
  23.     procedure ShowObjectsButtonClick(Sender: TObject);
  24.   private
  25.  
  26.   public
  27.  
  28.   end;
  29.  
  30. const
  31.   I_NUM_ENTRIES : integer = 4;
  32.  
  33. var
  34.   Form1: TForm1;
  35.   InsList : TInsList;
  36.  
  37. implementation
  38.  
  39. {$R *.lfm}
  40.  
  41. { TForm1 }
  42.  
  43. procedure TForm1.ShowObjectsButtonClick(Sender: TObject);
  44. var
  45.   i : integer = 0;
  46.   InsObj : TIns;
  47.  
  48. begin
  49.  
  50.   InsList := TInsList.Create;
  51.  
  52.   for i := 0 to I_NUM_ENTRIES do
  53.     begin
  54.       InsObj := TIns.Create;
  55.       InsObj.Init();
  56.       InsObj.RunTimeInsNumber := i;
  57.       InsObj.InsSerial := 'testSerialNum' + IntToStr(i);
  58.       InsObj.InsName := 'Name '  + IntToStr(i);
  59.       InsList.add(InsObj);
  60.       Memo1.Lines.Add(IntToStr(InsObj.RunTimeInsNumber));
  61.       Memo1.Lines.Add(InsObj.InsSerial);
  62.       Memo1.Lines.Add(InsObj.InsName);
  63.       Memo1.Lines.Add('  ');
  64.  
  65.       InsObj.Free;
  66.     end;
  67.  
  68.   ShowListButton.Enabled:=true;
  69.  
  70. end;
  71.  
  72. procedure TForm1.ShowListButtonClick(Sender: TObject);
  73. var
  74.   i : integer = 0;
  75.   InsObj : TIns;
  76.   var p : pointer;
  77.  
  78. begin
  79.  
  80.   i := InsList.Count;
  81.  
  82.   Memo1.Lines.Add('--------------- ');
  83.   Memo1.Lines.Add('Items from list ');
  84.   Memo1.Lines.Add('--------------- ');
  85.   Memo1.Lines.Add(' ');
  86.  
  87.    for i := 0 to I_NUM_ENTRIES do
  88.      begin
  89.        InsObj := TIns.Create;
  90.        InsObj.Init();
  91.        InsObj.RunTimeInsNumber:= InsList[i].RunTimeInsNumber;
  92.        InsObj.InsSerial := InsList[i].InsSerial;
  93.        InsObj.InsName:=InsList[i].InsName;
  94.        Memo1.Lines.Add(IntToStr(InsObj.RunTimeInsNumber));
  95.        Memo1.Lines.Add(InsObj.InsSerial);
  96.        Memo1.Lines.Add(InsObj.InsName);
  97.      end;
  98.  
  99.  
  100. end;
  101.  
  102. procedure TForm1.FormCreate(Sender: TObject);
  103. begin
  104.   ShowListButton.Enabled:=false;
  105. end;
  106.  
  107. end.    

Here's the unit that contains the class from which I want to build a list:

Code: Pascal  [Select]
  1. unit InsUnit;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils;
  9.  
  10. type
  11. TIns = Class
  12.     public
  13.      RunTimeInsNumber : integer;
  14.      SortOrderInsNumber : integer;
  15.      InsName : string;
  16.      InsSerial : string;
  17.      DBFeatureStr : string;
  18.  
  19.      constructor Init();
  20.  
  21.    private const
  22.      defaultSpecLoad = 'Testing Private';
  23.  
  24.    public
  25.  
  26.      const SpecDefaults = 'test';
  27.  
  28.  end;
  29.  
  30. implementation
  31.  
  32. constructor TIns.Init();
  33. begin
  34.    RuntimeInsNumber := 0;
  35.     SortOrderInsNumber :=0;
  36.     InsName :='';
  37.     InsSerial :='';
  38.     DBFeatureStr :='';
  39.  
  40.   end;
  41.  
  42. end.

The program dies on the line  InsObj.InsSerial := InsList.InsSerial; in the section that attempts to display the values after they've been loaded to the list.  I'm guessing this is a pointer/value problem but I don't get why or how to get this demo to work.

If it would help, I can upload the entire project.  Let me know how to so/what you'd prefer if you're interested.

EDIT:  Ooops, this throws the SIGSEGV error with stack trace.

Thanks in advance.
Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus