Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-10

Initializing my App

19 messages · 11 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dave Coventry

Hi,

How can I tell when my application has loaded and I can start initializing some of the form elements?

At the moment I place all of the initialization routines in the FormCreate but quite often I get an 'external SIGSEHV' exception as the mouse generates a false onSelection event on a StringGrid, presumably because the StringGrid has yet to be fully loaded.

This is on Windows XP using 0.9.25 beta 15981 (I will upgrade when I finish this current project).

Many thanks,

Dave Coventry

Reply by email

Graeme Geldenhuys
to Dave Coventry
Dave Coventry wrote
At the moment I place all of the initialization routines in the FormCreate but quite often I get an 'external SIGSEHV' exception as the mouse generates a false onSelection event on a StringGrid, presumably because the StringGrid has yet to be fully loaded.

TComponent has a Loaded() method you could try and use.

Alternative to FormCreate - maybe use a overridden AfterConstruction() method.

  procedure AfterConstruction; override;

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Dave Coventry
to Graeme Geldenhuys

Hi Graeme,

How does the 'Loaded' thing work?

2008/10/28 Graeme Geldenhuys :

Show quoted text 25 lines
On Tue, Oct 28, 2008 at 1:59 PM, Dave Coventry wrote: > At the moment I place all of the initialization routines in the > FormCreate but quite often I get an 'external SIGSEHV' exception as > the mouse generates a false onSelection event on a StringGrid, > presumably because the StringGrid has yet to be fully loaded. TComponent has a Loaded() method you could try and use. Alternative to FormCreate - maybe use a overridden AfterConstruction() method. procedure AfterConstruction; override; Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Valdas Jankūnas
to Dave Coventry: How can I tell when my application has loaded and I can start initializing some of the…

Dave Coventry ra??:

Show quoted text 9 lines
Hi, How can I tell when my application has loaded and I can start initializing some of the form elements? At the moment I place all of the initialization routines in the FormCreate but quite often I get an 'external SIGSEHV' exception as the mouse generates a false onSelection event on a StringGrid, presumably because the StringGrid has yet to be fully loaded.

If form is non modal then I do that in OnShow event, like this:

// when form appears
procedure TfrMain.FormShow(Sender: TObject);
const
   SHOWED_FIRST_TIME: Boolean=False;
begin
     if (not SHOWED_FIRST_TIME) then begin
         SHOWED_FIRST_TIME:=True;
         // initializing
     end;
end;
Valdas Jank?nas

Reply by email

Jalal

There is a flaw in the code suggested below. To accomplish what you seem to want, the SHOWED_FIRST_TIME variable needs to be an instance variable rather than a local variable as declared below.

That is, the SHOWED_FIRST_TIME variable should be declared in the class definition of the form.

Using a local variable as below may work, but if so it works by chance due to the memory location the compiler is using for that local variable being static. In Delphi it would likely be a register variable, so the value would be unpredictable. The compiler would issue a hint too.

Dave Coventry ra??:

Show quoted text 7 lines
Hi, How can I tell when my application has loaded and I can start initializing some of the form elements? At the moment I place all of the initialization routines in the FormCreate but quite often I get an 'external SIGSEHV' exception

as

the mouse generates a false onSelection event on a StringGrid, presumably because the StringGrid has yet to be fully loaded.

? If form is non modal then I do that in OnShow event, like this:

// when form appears
procedure TfrMain.FormShow(Sender: TObject);
const
?? SHOWED_FIRST_TIME: Boolean=False;
begin
???? if (not SHOWED_FIRST_TIME) then begin
???????? SHOWED_FIRST_TIME:=True;

???????? // initializing

???? end;
end;
?? Valdas Jank?nas -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081028/f60b0e2c/attachment.html

Reply by email

Flávio Etrusco
to Jalal

No, there's no problem. A typed constant is allocated just like a global variable (or a static local variable in C). The syntax is hackish, but the functionality is nice, indeed.

-Fl?vio

2008/10/28 Jalal :

Show quoted text 48 lines
There is a flaw in the code suggested below. To accomplish what you seem to want, the SHOWED_FIRST_TIME variable needs to be an instance variable rather than a local variable as declared below. That is, the SHOWED_FIRST_TIME variable should be declared in the class definition of the form. Using a local variable as below may work, but if so it works by chance due to the memory location the compiler is using for that local variable being static. In Delphi it would likely be a register variable, so the value would be unpredictable. The compiler would issue a hint too. Dave Coventry ra??: > Hi, > > How can I tell when my application has loaded and I can start > initializing some of the form elements? > > At the moment I place all of the initialization routines in the > FormCreate but quite often I get an 'external SIGSEHV' exception as > the mouse generates a false onSelection event on a StringGrid, > presumably because the StringGrid has yet to be fully loaded. If form is non modal then I do that in OnShow event, like this: // when form appears procedure TfrMain.FormShow(Sender: TObject); const SHOWED_FIRST_TIME: Boolean=False; begin if (not SHOWED_FIRST_TIME) then begin SHOWED_FIRST_TIME:=True; // initializing end; end; -- Valdas Jank?nas _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mattias Gärtner
to Felipe Monteiro de Carvalho: Does this work? If this was a variable this surely wouldn't work, because it's scope…

Zitat von Felipe Monteiro de Carvalho :

Show quoted text 8 lines
On Tue, Oct 28, 2008 at 4:42 PM, Valdas Jank?nas wrote: > // when form appears > procedure TfrMain.FormShow(Sender: TObject); > const > SHOWED_FIRST_TIME: Boolean=False; Does this work? If this was a variable this surely wouldn't work, because it's scope would be local to the procedure.

scope lifetime

afaik const are never on the stack. It should work.

Mattias

Reply by email

tommy
to Flávio Etrusco: No, there's no problem. A typed constant is allocated just like a global variable (or a…

Hello, I have a problem with rebuilding lazarus when adding components. The componets are lazreport and ZEOSlib. Before this upgarde all worked fine. Now I get a stop when the rebuilding tries to recompile interfaces, with a message that system checksum have changed, cant find the interface.pp. All searchpaths are correct in the cfg. I have installed the new release of lazarus0.9.26 with fpc 2.2.2 and also tried the fixesbuilds with the same result.
The fresh install of lazarus functions as it should, but as soon I do a rebuild of lazarus it stops with the same message, and that even without adding och removing any componets from the packages. I also tried the comandline with --build-ide=

What am I missing? All paths are as by default, and I have the paths set in windows XP as before. lazarus.cfg contains all searchpaths to all files and units that lazbuild don?t find.

/ Tom

Reply by email

Raistware
to tommy
Show quoted text 14 lines
fine. Now I get a stop when the rebuilding tries to recompile interfaces, with a message that system checksum have changed, cant find the interface.pp. All searchpaths are correct in the cfg. I have installed the new release of lazarus0.9.26 with fpc 2.2.2 and also tried the fixesbuilds with the same result. The fresh install of lazarus functions as it should, but as soon I do a rebuild of lazarus it stops with the same message, and that even without adding och removing any componets from the packages. I also tried the comandline with --build-ide= What am I missing? All paths are as by default, and I have the paths set in windows XP as before. lazarus.cfg contains all searchpaths to all files and units that lazbuild don??t find.

I had same problem and solved adding this line to
C:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.cfg :
-Fuc:\lazarus\ideintf

Hope helps

Reply by email

Vincent Snijders
to Raistware
Raistware wrote
I had same problem and solved adding this line to C:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.cfg : -Fuc:\lazarus\ideintf

This is asking for more trouble. Generally, don't add the path to lazarus sources in a -Fu option, instead use the appropriate directory with compiled units, in this case c:\lazarus\ideintf\units\i386-win32. Otherwise you may have two sets compiled units for the ideintf package and you get errors like checksum changed, etc.

Better yet, is to add a requirement of the IDEIntf package to the package or project you are trying to compile.

Vincent

Reply by email

Bogusław Brandys
to Vincent Snijders

Vincent Snijders pisze:

Show quoted text 20 lines
Raistware schreef: > I had same problem and solved adding this line to > C:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.cfg : > -Fuc:\lazarus\ideintf > This is asking for more trouble. Generally, don't add the path to lazarus sources in a -Fu option, instead use the appropriate directory with compiled units, in this case c:\lazarus\ideintf\units\i386-win32. Otherwise you may have two sets compiled units for the ideintf package and you get errors like checksum changed, etc. Better yet, is to add a requirement of the IDEIntf package to the package or project you are trying to compile. Vincent _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

If you are using fpc SVN then try fpc 2.2.2

Regards
Boguslaw

Reply by email

Jalal
Show quoted text 13 lines
> > // when form appears > > procedure TfrMain.FormShow(Sender: TObject); > > const > >?? SHOWED_FIRST_TIME: Boolean=False; > > Does this work? If this was a variable this surely wouldn't work, > because it's scope would be local to the procedure. scope lifetime afaik const are never on the stack. It should work. Mattias

Indeed, since it was declared 'const' it will work *if* only one instance of this form is created.

I maintain that this should be a class member (variable). I believe those are all initialized to zeroes too, so you'll only have the set it to True to turn on your indicator.

Of course, do whatever you want in your code.? ;-) -------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081029/d439089d/attachment.html

Reply by email

tommy
to Vincent Snijders: This is asking for more trouble. Generally, don't add the path to lazarus sources in a…
Vincent Snijders wrote 20 lines
Raistware schreef: > I had same problem and solved adding this line to > C:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.cfg : > -Fuc:\lazarus\ideintf > > This is asking for more trouble. Generally, don't add the path to lazarus sources in a -Fu option, instead use the appropriate directory with compiled units, in this case c:\lazarus\ideintf\units\i386-win32. Otherwise you may have two sets compiled units for the ideintf package and you get errors like checksum changed, etc. Better yet, is to add a requirement of the IDEIntf package to the package or project you are trying to compile. Vincent _______________________________________________

I tried these suggestions and yeas more errors with the referens to lazarus source in fpc.cfg. With referens to units I passed the stop at interfaces but ended at stop with interfacebase instead. All search paths are correct. The svn of lazarus gave even more strange errors when running, but the compiling of svn lazarus-0.9.26 worked without any complains.

Reading the wiki concerning errors of checksum and not finding interface, it is stated that the checksum would occur if there are several compiled units in the system och several fpc.cfg. I check and there are no dubbel units or cfg. However testing the compiler options in projektmenu I recieve a lot of warnings about duplicate units. When looking at these directories there are no duplicates! I have no clue to what is happening. I also whent through with regedit to delete all references of lazarus and also deleting the directory in documents and settings before doing each new installation.

The win32-installer version of lazarus with fpc works fine, as long as not rebuilding lazarus.

/ Tom

Reply by email

Vincent Snijders
to tommy
tommy wrote 7 lines
Vincent Snijders skrev: Reading the wiki concerning errors of checksum and not finding interface, it is stated that the checksum would occur if there are several compiled units in the system och several fpc.cfg. I check and there are no dubbel units or cfg. However testing the compiler options in projektmenu I recieve a lot of warnings about duplicate units. When looking at these directories there are no duplicates!

What duplicate units did Lazarus say there were?

I have no clue to what is happening. I also whent through with regedit to delete all references of lazarus and also deleting the directory in documents and settings before doing each new installation.

Did you install lazarus in an empty directory, i.e. not over an existing Lazarus installation?

The win32-installer version of lazarus with fpc works fine, as long as not rebuilding lazarus.

Vincent

Reply by email

tommy
to Vincent Snijders
Vincent Snijders wrote 32 lines
tommy schreef: > Vincent Snijders skrev: > Reading the wiki concerning errors of checksum and not finding > interface, it is stated that the checksum would occur if there are > several compiled units in the system och several fpc.cfg. I check and > there are no dubbel units or cfg. However testing the compiler options > in projektmenu I recieve a lot of warnings about duplicate units. When > looking at these directories there are no duplicates! > What duplicate units did Lazarus say there were? > I have no clue to what is happening. I also whent through with regedit > to delete all references of lazarus and also deleting the directory in > documents and settings before doing each new installation. > > Did you install lazarus in an empty directory, i.e. not over an existing Lazarus installation? > The win32-installer version of lazarus with fpc works fine, as long as > not rebuilding lazarus. > Vincent _______________________________________________

Good news, now the rebuilding of the ide and packages is working! But How?!? It could be that I deleted som entries in registry or after deleting the lazarus svn version gott rid of the file disturbing. For the record, I did install earlier both in a fresh directory and in the old one but with deleting all subdirecories and files.

Still the compiler test give som warning about the fpc files being duplicate. With the erlier rebuild stop, it was warnings of files in the lazarus directories. Now when it is working the warning is as below from both an empty project and a compiled project:

WARNING: relative unit path found in fpc cfg:
.\fpc\2.2.2\bin\i386-win32\ THIS is issued for all unit paths in fpc,

WARNING: ppu exists twice:
C:\lazarus\fpc\2.2.2\units\i386-win32\httpd20\httpd.ppu, C:\lazarus\fpc\2.2.2\units\i386-win32\httpd13\httpd.ppu WARNING: ppu exists twice:
C:\lazarus\fpc\2.2.2\units\i386-win32\httpd22\apr.ppu, C:\lazarus\fpc\2.2.2\units\i386-win32\httpd20\apr.ppu WARNING: ppu exists twice:
C:\lazarus\fpc\2.2.2\units\i386-win32\httpd22\apriconv.ppu, C:\lazarus\fpc\2.2.2\units\i386-win32\httpd20\apriconv.ppu WARNING: ppu exists twice:
C:\lazarus\fpc\2.2.2\units\i386-win32\httpd22\aprutil.ppu, C:\lazarus\fpc\2.2.2\units\i386-win32\httpd20\aprutil.ppu WARNING: ppu exists twice:
C:\lazarus\fpc\2.2.2\units\i386-win32\httpd22\httpd.ppu, C:\lazarus\fpc\2.2.2\units\i386-win32\httpd20\httpd.ppu WARNING: ppu exists twice:
C:\lazarus\fpc\2.2.2\units\i386-win32\unzip\unzip.ppu, C:\lazarus\fpc\2.2.2\units\i386-win32\paszlib\unzip.ppu WARNING: ppu exists twice:
C:\lazarus\fpc\2.2.2\units\i386-win32\fv\dialogs.ppu, C:\lazarus\lcl\units\i386-win32\dialogs.ppu
WARNING: ppu exists twice:
C:\lazarus\fpc\2.2.2\units\i386-win32\fv\menus.ppu, C:\lazarus\lcl\units\i386-win32\menus.ppu

Thanks for taking the time to answer
it help me to try again
/ Tom

Reply by email

Bogusław Brandys
to tommy

tommy pisze:

Show quoted text 77 lines
Vincent Snijders skrev: > tommy schreef: > >> Vincent Snijders skrev: >> Reading the wiki concerning errors of checksum and not finding >> interface, it is stated that the checksum would occur if there are >> several compiled units in the system och several fpc.cfg. I check and >> there are no dubbel units or cfg. However testing the compiler options >> in projektmenu I recieve a lot of warnings about duplicate units. When >> looking at these directories there are no duplicates! >> > What duplicate units did Lazarus say there were? > > >> I have no clue to what is happening. I also whent through with regedit >> to delete all references of lazarus and also deleting the directory in >> documents and settings before doing each new installation. >> >> > Did you install lazarus in an empty directory, i.e. not over an existing > Lazarus installation? > > >> The win32-installer version of lazarus with fpc works fine, as long as >> not rebuilding lazarus. >> > Vincent > _______________________________________________ > > Good news, now the rebuilding of the ide and packages is working! But How?!? It could be that I deleted som entries in registry or after deleting the lazarus svn version gott rid of the file disturbing. For the record, I did install earlier both in a fresh directory and in the old one but with deleting all subdirecories and files. Still the compiler test give som warning about the fpc files being duplicate. With the erlier rebuild stop, it was warnings of files in the lazarus directories. Now when it is working the warning is as below from both an empty project and a compiled project: WARNING: relative unit path found in fpc cfg: .\fpc\2.2.2\bin\i386-win32\ THIS is issued for all unit paths in fpc, WARNING: ppu exists twice: C:\lazarus\fpc\2.2.2\units\i386-win32\httpd20\httpd.ppu, C:\lazarus\fpc\2.2.2\units\i386-win32\httpd13\httpd.ppu WARNING: ppu exists twice: C:\lazarus\fpc\2.2.2\units\i386-win32\httpd22\apr.ppu, C:\lazarus\fpc\2.2.2\units\i386-win32\httpd20\apr.ppu WARNING: ppu exists twice: C:\lazarus\fpc\2.2.2\units\i386-win32\httpd22\apriconv.ppu, C:\lazarus\fpc\2.2.2\units\i386-win32\httpd20\apriconv.ppu WARNING: ppu exists twice: C:\lazarus\fpc\2.2.2\units\i386-win32\httpd22\aprutil.ppu, C:\lazarus\fpc\2.2.2\units\i386-win32\httpd20\aprutil.ppu WARNING: ppu exists twice: C:\lazarus\fpc\2.2.2\units\i386-win32\httpd22\httpd.ppu, C:\lazarus\fpc\2.2.2\units\i386-win32\httpd20\httpd.ppu WARNING: ppu exists twice: C:\lazarus\fpc\2.2.2\units\i386-win32\unzip\unzip.ppu, C:\lazarus\fpc\2.2.2\units\i386-win32\paszlib\unzip.ppu WARNING: ppu exists twice: C:\lazarus\fpc\2.2.2\units\i386-win32\fv\dialogs.ppu, C:\lazarus\lcl\units\i386-win32\dialogs.ppu WARNING: ppu exists twice: C:\lazarus\fpc\2.2.2\units\i386-win32\fv\menus.ppu, C:\lazarus\lcl\units\i386-win32\menus.ppu Thanks for taking the time to answer it help me to try again / Tom _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Checksum changed is related to compiler problem or a problem with interpretation of some command line switches, I'm not sure,but I had it too when using fpc svn version, then I switched back to official fpc 2.2.2 and that resolved problems.

I have still one error about duplicated ppu but that's another problem and didn't cause checksum changed error. The temporarily fix was also to clean directories containing components and Lazarus itself from .o and .ppu files using clean wizard from Lazarus IDE, but again error was here once ppu are in place before compilation.

Boguslaw

Reply by email