Re: [fpc-pascal] convert "epoch" to UTC

2012-01-17 Thread Sven Barth

Am 16.01.2012 23:57, schrieb waldo kitty:

anyway, the format is like this...

*_TLE Epoch Format_*

eg: 12013.93338171

1. there are always 5 digits to the left of the decimal. the first two
digits
are the year of the epoch.

if year<57 then year:=year+2000 else year:=year+1900

in the above, 12 is the year which is 2012.

2. the next three digits (up to the decimal point) are the "day number
of the
year" of the TLE Epoch record.

in the above, 013 is the day number of the year. feed this plus the year
to a julian date routine to find the julian date number. in this example,
we're looking for the julian date number for the 13th day of 2012.

3. the digits from the decimal point to the end are the fractional part of
the day. these are /not/ in julian date or julian day format.

in the above, .93338171 is the fractional part of the day. the time portion
of the formula goes like this.

fooo := frac(12013.93338171)
rslt := fooo * 24 // 22.40116104
hour := trunc(rslt) // 22
fooo := frac(rslt) // .40116104
rslt := fooo * 60 // 24.0696624
mins := trunc(rslt) // 24
fooo := frac(rslt) // .0696624
rslt := fooo * 60 // 4.179744
secs := trunc(rslt) // 4
fooo := frac(rslt) // .179744
rslt := fooo * 1000 // the more zeros, the more precision
msec := trunc(rslt) // 179

4. convert the julian date number from #2 to TDateTime. fill in the
TDateTime
time fields from #3. now EncodeDateTime and you'll have the proper numbers
in a TDateTime record.

so what i ran into, besides the julian date routines not doing the time,
but i was also sending the entire decimal number, without the year
digits, to the julian date routine and that was just flat wrong since
the fractional side wasn't a julian date fraction! ::TripleFacePalm::

so there's three pieces of data stored in that one "TLE Epoch" number
and each has to be broken out and treated differently... now my answers
finally agree with the programs i've been attempting to verify them
against... i just couldn't see the forest for the trees and couldn't see
the trees for all the leaves on'em :LOL:


Have you tried just adding the fractional part (which you called "fooo" 
above) to the TDateTime value returned by TryJulianToDateTime and then 
feeding that to FormatDatTime? It should give you the same result... (at 
least I hope that ^^)


Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Would someone be willing to build the skeleton of a simple application for me?

2012-01-17 Thread Sven Barth

Am 16.01.2012 23:33, schrieb hdv.ja...@gmail.com:

So here's my request: would someone be willing to get me started by building
the basics when given the specs? Basically it concerns a sqlite database with
just three tables (each with four or less fields) and the interface to query
and manipulate them. All in all probably not more than 3 forms will be needed.
More detailed specs are available.

I think it will not take more than one or two days for an experienced
programmer and it doesn't have to be a full product. Just something that does
what is needed and enough to get me up and running in a short time. Polishing
the thing later on will be a good learning project for me.

I am willing to pay for this, as long as the fee is reasonable and the
developer doesn't have any objections to have his code made available under an
OSS license.

Anyone interested, please contact me directly and off-list.


I know that this is not what you asked for, but you can take a look at 
http://wiki.lazarus.freepascal.org/Lazarus_Documentation and 
http://wiki.lazarus.freepascal.org/Category:Tutorials where some 
tutorials are located which might help you.
Even if someone will write you a sceleton application these links might 
provide you a bit of insight to understand the code given to you.


Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Help!!

2012-01-17 Thread Andreas Schneider
On Sunday, January 15, 2012, at 15:04 Mattias Gaertner wrote:
> On Sun, 15 Jan 2012 05:58:21 -0800 (PST)
> Malvin  wrote:

>> So far i've managed to do the program quite well, and I was wondering, can
>> i close the main form (form1) whils opening form2 and not closing the app?
>> Is there any way that I can do it?

> If you mean LCL forms: The MainForm can not be closed, but you can hide
> it.

But  you can trick the LCL into changing what Form is considered to be
the MainForm.

Btw.  is  there any chance for having an official way to do this? i.e.
making  TApplication.MainForm  a  writable  property? (I ask this here
instead  of  opening  a ticket because I suspect there's a good reason
why this isn't available yet, which you will tell me now. :-))

-- 
Best Regards,
Andreas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Postscriptcanvas

2012-01-17 Thread Felipe Monteiro de Carvalho
If you are trying to print, why do you want to use PostScriptCanvas
directly? Are you targeting only UNIXes? How will you connect the
generated postscript to the printer? You have your own code for that?

I would recommend that you use the LCL in your project and print via
the Printer object, as normally done. LCL applications do not need to
be visual, just make an application without any forms.

-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Advanced Records - Why not available by default?

2012-01-17 Thread Felipe Monteiro de Carvalho
On Sun, Jan 15, 2012 at 12:59 AM, Lars  wrote:
> Personally, I'm getting sick of all the new features added to delphi that
> don't add anything meaningful, and just add complexity to the compiler.

Why is compiler complexity relevant (if true at all that the new
features add significant complexity)? Are you sending patches to the
compiler and finds that the new features disturb this?

About adding something meaningful, this varies from one person to
another one. For me new features might not be useful now, but if there
is a chance they might be useful in the future, then they are good
features to have. Use cases are often not obvious. I would normally
not think that static class methods are useful, but they were very
useful for me in the early days of PasCocoa. And if a features will
never be useful to me, then they will be for someone else (if they
were useful for noone, then noone would have written the code to
support them in the first place)

And if you dont like them, you dont need to use them. The LCL rarely
uses newer compiler features. I would say the same for most code in
the FCL.

-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Help!!

2012-01-17 Thread Mattias Gaertner

Andreas Schneider  hat am 17. Januar 2012 um 11:23
geschrieben:

> On Sunday, January 15, 2012, at 15:04 Mattias Gaertner wrote:
> > On Sun, 15 Jan 2012 05:58:21 -0800 (PST)
> > Malvin  wrote:
>
> >> So far i've managed to do the program quite well, and I was wondering,
can
> >> i close the main form (form1) whils opening form2 and not closing the
app?
> >> Is there any way that I can do it?
>
> > If you mean LCL forms: The MainForm can not be closed, but you can hide
> > it.
>
> But  you can trick the LCL into changing what Form is considered to be
> the MainForm.
>
> Btw.  is  there any chance for having an official way to do this? i.e.
> making  TApplication.MainForm  a  writable  property? (I ask this here
> instead  of  opening  a ticket because I suspect there's a good reason
> why this isn't available yet, which you will tell me now. :-))


No one needed it yet.
The MainForm contains the default main menu and its handle is used as
default handle. All widgetsets must be checked.

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Help!!

2012-01-17 Thread Felipe Monteiro de Carvalho
If the use case is closing the main form without quitting the
application, then I would prefer a property
TApplication.QuitApplicationWhenMainFormCloses or something like that.

-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] MySQL5

2012-01-17 Thread Mattias Gaertner
Hi,

I tried connecting to a mysql 5.5 database and used the fpc unit mysql51.
There are only examples for 3 and 4, so I started with testdb4.pp and
adapted it.
It turned out that the MYSQL record is missing some new fields, so the
mysql_init overwrites the memory behind.
After adding some dummy bytes at the end it worked nice.

Is there a better way?
If not, maybe this should be done by default?

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] MySQL5

2012-01-17 Thread michael . vancanneyt



On Tue, 17 Jan 2012, Mattias Gaertner wrote:


Hi,

I tried connecting to a mysql 5.5 database and used the fpc unit mysql51.
There are only examples for 3 and 4, so I started with testdb4.pp and
adapted it.
It turned out that the MYSQL record is missing some new fields, so the
mysql_init overwrites the memory behind.
After adding some dummy bytes at the end it worked nice.

Is there a better way?


Yes, convert the mysql 5.5. headers. Or adapt the 5.1 headers to match the
5.5 specs.

That is how we bring it up-to-date whenever a new MySQL version appears.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Postscriptcanvas

2012-01-17 Thread David Copeland
Hi Felipe,

I had not thought that approach (a non-visual lcl program) to be
possible, but I will try it. Would I use the Nogui widgetset? Would such
a program run on a host where X was not installed? I am targeting only
Linux. I save the output to a file (SaveToFile). The user prints the
file if needed.

Thanks,
Dave. 

-Original Message-
From: Felipe Monteiro de Carvalho 
Reply-to: FPC-Pascal users discussions 
To: FPC-Pascal users discussions 
Subject: Re: [fpc-pascal] Postscriptcanvas
Date: Mon, 16 Jan 2012 14:14:44 +0100

If you are trying to print, why do you want to use PostScriptCanvas
directly? Are you targeting only UNIXes? How will you connect the
generated postscript to the printer? You have your own code for that?

I would recommend that you use the LCL in your project and print via
the Printer object, as normally done. LCL applications do not need to
be visual, just make an application without any forms.


-- 
David Copeland
JSI Data Systems Limited
613-727-9353.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] MySQL5

2012-01-17 Thread Marco van de Voort
In our previous episode, michael.vancann...@wisa.be said:
> > There are only examples for 3 and 4, so I started with testdb4.pp and
> > adapted it.
> > It turned out that the MYSQL record is missing some new fields, so the
> > mysql_init overwrites the memory behind.
> > After adding some dummy bytes at the end it worked nice.
> >
> > Is there a better way?
> 
> Yes, convert the mysql 5.5. headers. Or adapt the 5.1 headers to match the
> 5.5 specs.
> 
> That is how we bring it up-to-date whenever a new MySQL version appears.

http://bugs.freepascal.org/view.php?id=19736
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] MySQL5

2012-01-17 Thread Mattias Gaertner

michael.vancann...@wisa.be hat am 17. Januar 2012 um 13:28 geschrieben:

>
>
> On Tue, 17 Jan 2012, Mattias Gaertner wrote:
>
> > Hi,
> >
> > I tried connecting to a mysql 5.5 database and used the fpc unit
mysql51.
> > There are only examples for 3 and 4, so I started with testdb4.pp and
> > adapted it.
> > It turned out that the MYSQL record is missing some new fields, so the
> > mysql_init overwrites the memory behind.
> > After adding some dummy bytes at the end it worked nice.
> >
> > Is there a better way?
>
> Yes, convert the mysql 5.5. headers. Or adapt the 5.1 headers to match
the
> 5.5 specs.


;)




> That is how we bring it up-to-date whenever a new MySQL version appears.


I only found mysql51 headers. Are there some newer ones?

I would like my program to still run when the next small upgrade comes. As
far as I can see new things are only added at the end, so adding some dummy
bytes for "future extensions" may help here. Is this wishful thinking?


Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Postscriptcanvas

2012-01-17 Thread Felipe Monteiro de Carvalho
On Tue, Jan 17, 2012 at 1:40 PM, David Copeland
 wrote:
> I had not thought that approach (a non-visual lcl program) to be
> possible, but I will try it. Would I use the Nogui widgetset?

No, it doesn't implement printing.

> Would such a program run on a host where X was not installed?

No

> I am targeting only Linux. I save the output to a file (SaveToFile). The user 
> prints the
> file if needed.

Well, if you are not printing in your software then you are not doing
printing, only drawing. So the answer to my original questions should
have been "Drawing". So with your requirements using the LCL is
probably not necessary. If you are targeting only linux then you can
probably use a command line execution to print the file.

-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] MySQL5

2012-01-17 Thread michael . vancanneyt



On Tue, 17 Jan 2012, Mattias Gaertner wrote:



michael.vancann...@wisa.be hat am 17. Januar 2012 um 13:28 geschrieben:




On Tue, 17 Jan 2012, Mattias Gaertner wrote:


Hi,

I tried connecting to a mysql 5.5 database and used the fpc unit

mysql51.

There are only examples for 3 and 4, so I started with testdb4.pp and
adapted it.
It turned out that the MYSQL record is missing some new fields, so the
mysql_init overwrites the memory behind.
After adding some dummy bytes at the end it worked nice.

Is there a better way?


Yes, convert the mysql 5.5. headers. Or adapt the 5.1 headers to match

the

5.5 specs.



;)


You asked for a better way. not a faster :-)







That is how we bring it up-to-date whenever a new MySQL version appears.



I only found mysql51 headers. Are there some newer ones?


Not to my knowlegde.



I would like my program to still run when the next small upgrade comes.


We cannot guarantee that. You even can't guarantee that in C. An upgrade of
the mysql library may break your perfectly running program. 
(I have known it to happen for a client of mine)


Most people don't notice this, since all distributions recompile everything 
that depends on MySQL from scratch anyway. But for FPC, the case is different.



As
far as I can see new things are only added at the end, so adding some dummy
bytes for "future extensions" may help here. Is this wishful thinking?


No, because sometimes they change the size or position of a field, 
and then resolve it with macros in C. Since we need the correct size and
position this does not guarantee you solve everything. They also change 
the number of arguments to calls and change the export symbols, again 
they mask this with C macros.


In short: You never know, hence you must upgrade the headers.

This mess is why I urge people not to use MySQL. Their API is not stable.
e.g. Firebird's API has been stable for the last 12 years, but features are
nevertheless added all the time.

So: upgrade the 5.1 to 5.5, and I'll add it in FPC and create a 5.5 mysql
connection object as soon as I have received the upgraded headers.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Postscriptcanvas

2012-01-17 Thread Mattias Gaertner

Felipe Monteiro de Carvalho  hat am 17.
Januar 2012 um 13:59 geschrieben:

> On Tue, Jan 17, 2012 at 1:40 PM, David Copeland
>  wrote:
> > I had not thought that approach (a non-visual lcl program) to be
> > possible, but I will try it. Would I use the Nogui widgetset?
>
> No, it doesn't implement printing.


The printer4lazarus package uses cups by default. I have not tested if it
works with the nogui widgetset.



>
> > Would such a program run on a host where X was not installed?
>
> No
>
> > I am targeting only Linux. I save the output to a file (SaveToFile).
The user prints the
> > file if needed.
>
> Well, if you are not printing in your software then you are not doing
> printing, only drawing. So the answer to my original questions should
> have been "Drawing". So with your requirements using the LCL is
> probably not necessary. If you are targeting only linux then you can
> probably use a command line execution to print the file.


Yes.

OTOH cups gives some information about the queue and the printer.

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] MySQL5

2012-01-17 Thread ik
On Tue, Jan 17, 2012 at 15:19,  wrote:

>
>
> On Tue, 17 Jan 2012, Mattias Gaertner wrote:
>
>
>> michael.vancann...@wisa.be hat am 17. Januar 2012 um 13:28 geschrieben:
>>
>>
>>>
>>> On Tue, 17 Jan 2012, Mattias Gaertner wrote:
>>>
>>>  Hi,

 I tried connecting to a mysql 5.5 database and used the fpc unit

>>> mysql51.
>>
>>> There are only examples for 3 and 4, so I started with testdb4.pp and
 adapted it.
 It turned out that the MYSQL record is missing some new fields, so the
 mysql_init overwrites the memory behind.
 After adding some dummy bytes at the end it worked nice.

 Is there a better way?

>>>
>>> Yes, convert the mysql 5.5. headers. Or adapt the 5.1 headers to match
>>>
>> the
>>
>>> 5.5 specs.
>>>
>>
>>
>> ;)
>>
>
> You asked for a better way. not a faster :-)


The best way imho is not to use this "db" toy. Unless you do not have a way
to avoid it, and then "it sucks to be you" ;)


>
>
>
>>
>>
>>
>>  That is how we bring it up-to-date whenever a new MySQL version appears.
>>>
>>
>>
>> I only found mysql51 headers. Are there some newer ones?
>>
>
> Not to my knowlegde.
>
>
>
>> I would like my program to still run when the next small upgrade comes.
>>
>
> We cannot guarantee that. You even can't guarantee that in C. An upgrade of
> the mysql library may break your perfectly running program. (I have known
> it to happen for a client of mine)
>
> Most people don't notice this, since all distributions recompile
> everything that depends on MySQL from scratch anyway. But for FPC, the case
> is different.


MySQL is "deprecated", and there are several open source projects that uses
the same code base, but try to provide better support
(http://mariadb.org/for example).
The problem is, that most people know "MySQL". so here is the problem you
describe :(


>
>
>  As
>> far as I can see new things are only added at the end, so adding some
>> dummy
>> bytes for "future extensions" may help here. Is this wishful thinking?
>>
>
> No, because sometimes they change the size or position of a field, and
> then resolve it with macros in C. Since we need the correct size and
> position this does not guarantee you solve everything. They also change
> the number of arguments to calls and change the export symbols, again they
> mask this with C macros.
>
> In short: You never know, hence you must upgrade the headers.
>
> This mess is why I urge people not to use MySQL. Their API is not stable.
> e.g. Firebird's API has been stable for the last 12 years, but features are
> nevertheless added all the time.
>
> So: upgrade the 5.1 to 5.5, and I'll add it in FPC and create a 5.5 mysql
> connection object as soon as I have received the upgraded headers.
>
>
> Michael.
> __**_
> fpc-pascal maillist  -  
> fpc-pascal@lists.freepascal.**org
> http://lists.freepascal.org/**mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Postscriptcanvas

2012-01-17 Thread David Copeland
Okay, I now understand the distinction between printing and drawing.
Using the LCL was only necessary to use it's Postscriptcanvas as that is
what I'm familiar with. But as this program needs to be able to run
without X, I will either puzzle out the FCL's fpcanvas, or just write
the postscript myself.

Thanks,
Dave.


-Original Message-
From: Felipe Monteiro de Carvalho 
Reply-to: FPC-Pascal users discussions 
To: FPC-Pascal users discussions 
Subject: Re: [fpc-pascal] Postscriptcanvas
Date: Tue, 17 Jan 2012 13:59:19 +0100

On Tue, Jan 17, 2012 at 1:40 PM, David Copeland
 wrote:
> I had not thought that approach (a non-visual lcl program) to be
> possible, but I will try it. Would I use the Nogui widgetset?

No, it doesn't implement printing.

> Would such a program run on a host where X was not installed?

No

> I am targeting only Linux. I save the output to a file (SaveToFile). The user 
> prints the
> file if needed.

Well, if you are not printing in your software then you are not doing
printing, only drawing. So the answer to my original questions should
have been "Drawing". So with your requirements using the LCL is
probably not necessary. If you are targeting only linux then you can
probably use a command line execution to print the file.


-- 
David Copeland
JSI Data Systems Limited
613-727-9353.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] MySQL5

2012-01-17 Thread michael . vancanneyt



On Tue, 17 Jan 2012, ik wrote:



Most people don't notice this, since all distributions recompile
everything that depends on MySQL from scratch anyway. But for FPC, the case
is different.



MySQL is "deprecated", and there are several open source projects that uses
the same code base, but try to provide better support
(http://mariadb.org/for example).
The problem is, that most people know "MySQL". so here is the problem you
describe :(



If these forks use the same tactics, they are not better suited for a FPC
program. Since the same people that started MySQL are now working on these
forks, I think the chances are high that they use the same mechanisms...

So, use a more stable DB. If you need open source: Postgres or Firebird...

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Postscriptcanvas

2012-01-17 Thread michael . vancanneyt



On Tue, 17 Jan 2012, Mattias Gaertner wrote:



Felipe Monteiro de Carvalho  hat am 17.
Januar 2012 um 13:59 geschrieben:


On Tue, Jan 17, 2012 at 1:40 PM, David Copeland
 wrote:

I had not thought that approach (a non-visual lcl program) to be
possible, but I will try it. Would I use the Nogui widgetset?


No, it doesn't implement printing.



The printer4lazarus package uses cups by default. I have not tested if it
works with the nogui widgetset.


Would such a program run on a host where X was not installed?


No


I am targeting only Linux. I save the output to a file (SaveToFile).

The user prints the

file if needed.


Well, if you are not printing in your software then you are not doing
printing, only drawing. So the answer to my original questions should
have been "Drawing". So with your requirements using the LCL is
probably not necessary. If you are targeting only linux then you can
probably use a command line execution to print the file.



Yes.

OTOH cups gives some information about the queue and the printer.


Purely as a side note: 
This is not relevant if the user is behind a browser on another machine.

For instance, none of our webservers has cups installed.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Postscriptcanvas

2012-01-17 Thread Felipe Monteiro de Carvalho
I think I was wrong about the nogui LCL widgetset. It should probably
be able to run the unit Postscriptcanvas and require no X11.

Another option would be adding postscript output to fpvectorial. It
has postscript input at the moment but not output:
http://wiki.lazarus.freepascal.org/fpvectorial

-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Help!!

2012-01-17 Thread Andreas Schneider
On Tuesday, January 17, 2012, at 13:15 Felipe Monteiro de Carvalho wrote:
> If the use case is closing the main form without quitting the
> application, then I would prefer a property
> TApplication.QuitApplicationWhenMainFormCloses or something like that.


My current use case is:
- show a login form
- when login succeeds, show a progress form (connection  initialization) and 
close login
- on failure: go back to login
- on success: show the actual application form and close the login form

Showing the "main" form always wouldn't seem nice. Starting the application 
with the
mainform hidden doesn't work afaik. You can hide it manually AFTER it was shown 
(.Hide),
but Visible=False is ignored on startup. This just doesn't look nice if the 
main form
pops up for a second to be hidden again. So I use the workflow described above, 
which
changes the current Application.MainForm several times.

-- 
Best Regards,
Andreas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Help!!

2012-01-17 Thread Mattias Gaertner

Andreas Schneider  hat am 17. Januar 2012 um 16:08
geschrieben:

> On Tuesday, January 17, 2012, at 13:15 Felipe Monteiro de Carvalho wrote:
> > If the use case is closing the main form without quitting the
> > application, then I would prefer a property
> > TApplication.QuitApplicationWhenMainFormCloses or something like that.
>
>
> My current use case is:
> - show a login form

> - when login succeeds, show a progress form (connection  initialization)
and close login

> - on failure: go back to login
> - on success: show the actual application form and close the login form


Instead of Application.CreateForm create the form directly. For example:

LoginForm:=TLoginForm.Create(nil);
while LoginForm.ShowModal<>mrOk do ;
LoginForm.Free;
...
Application.CreateForm(Form1);



>
> Showing the "main" form always wouldn't seem nice. Starting the
application with the
> mainform hidden doesn't work afaik. You can hide it manually AFTER it was
shown (.Hide),
> but Visible=False is ignored on startup. This just doesn't look nice if
the main form
> pops up for a second to be hidden again. So I use the workflow described
above, which
> changes the current Application.MainForm several times.



Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] procedure variable and inc/dec procedures

2012-01-17 Thread ik
Hello,

I'm trying to do the following:

-
var
  a : procedure(var x : TOrdinal);
  b : procedure(var x : integer);

begin
  a := @inc;
  b := @dec;

end.
---

I simplified the original code of mine to this specific example to make it
more clear.

At variable a, I get the following error
Error: Identifier not found "TOrdinal"

And on both of them I get:
Fatal: Syntax error, "(" expected but ";" found

This does not happen on my own procedures, or other procedures at all that
I have tried.
Why doesn't the compiler like the above code ?
What is the difference between that and other procedures ?
And beside inline wrapper, is there a way to do this like so ?

Thanks,
Ido
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] procedure variable and inc/dec procedures

2012-01-17 Thread Howard Page-Clark

On 17/1/12 9:47, ik wrote:


var
   a : procedure(var x : TOrdinal);
   b : procedure(var x : integer);

begin
   a := @inc;
   b := @dec;



Why doesn't the compiler like the above code ?


Inc and Dec are internal compiler routines, more like macros than true 
functions. They are not coded as library functions you can locate in the 
RTL at an addressable location.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal