[Lazarus] Pointer woes when trying to port a Delphi program

ik idokan at gmail.com
Fri Aug 24 21:27:26 CEST 2012


On Fri, Aug 24, 2012 at 10:22 PM, brian <brian at meadows.pair.com> wrote:

> Hi all,
>
> I'm trying to port a Delphi program to Lazarus, although I'm redoing the
> interface from scratch.
>
> Without getting into to much detail about what the program does, it needs
> an array of 72 buttons on the main screen, these buttons have their
> captions changed and are variously enabled and disabled as the program
> executes.
>
> Because of the underlying logic, it's easiest to manipulate these buttons
> as an array of pointers to the buttons (in fact two arrays, but that's not
> really relevant).
>
> So, I have
>
> Type
>  TBtnPtr = ^TButton;
>  TBtnArray = Array [1..36] of TBtnPtr;
>
> Var
>  Buttons1, Buttons2 : TBtnArray;
>
>
> Then in a procedure called from the Form's OnCreate, I set the arrays up :-
>
> Buttons[1]^ := FirstButton;
> Buttons[2]^ := SecondButton;
>
> etc, etc.
>
> Everything compiles OK, but at runtime, the moment the program reaches
> that first assignment statement running interactively under GDB, I get an
> error "Exception class External : SIGSEGV"
>
> This is using SVN 38353M (downloaded and built this morning) with FPC
> 2.6.0 on an AMD Phenom X4 box running Debian SID 64-bit, and generating a
> 64 bit executable.
>
> I'm lost. This same code worked under Delphi 7. Can anyone give me a hint
> as to what I'm doing wrong? I wanted to create the buttons as design time
> so that I can set the initial layout, but if I need to create them
> dynamically I can do that.
>
>
It will not answer your question (there are few details that are missing
there), but I'ved wrote a component for Lazarus few years ago that provide
a grid of buttons:
https://github.com/ik5/linesip-components

It might be useful for your to try and use it instead, or at least learn
from it.


>
> Thanks
>
> Brian
>

Ido

>
> --
> ______________________________**_________________
> Lazarus mailing list
> Lazarus at lists.lazarus.**freepascal.org<Lazarus at lists.lazarus.freepascal.org>
> http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120824/fd2b5371/attachment-0003.html>


More information about the Lazarus mailing list