[Lazarus] Run Parameters Dialog

2016-09-22 Thread Lars
Hi in the Run Parameters dialog, it appears as though $macros such as
$TargetFile() or the current project directory, etc., don't get
expanded Is this by design? Would be nice if they were expanded just
as in the External Tools.  If no one has interest in it now but would find
it useful I could work on a patch. Or if by design it is intended to not
be that way for some reason let me know.

Once again I am trying to launch my app using cmd /k , so that a command
line stays open , and can't find a way to do this with the run parameters
window unless I manually type in project1.exe instead of $TargetFile()
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-22 Thread Lars
On Thu, September 22, 2016 3:45 pm, Mattias Gaertner wrote:
>> Oh, when did you add this, long ago or just recent... which release...
>> or is it only on the latest github/svn. Thanks, I did not see this
>> option
>
> Just recently, as in today.
>
>
> Mattias


Any idea what workarounds people used before? Surely someone used cmd.exe
before as an external tool in an older version.  I tend to not use the
latest version from source control. But I can, if I have to!
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Conditional code based on Lazarus/LCL version

2016-09-22 Thread Mattias Gaertner
On Thu, 22 Sep 2016 22:25:23 +0100
Denis Kozlov  wrote:

> On 22/09/2016 22:02, Mattias Gaertner wrote:
> > See unit lclversion.  
> 
> Thanks! Somehow I just couldn't find it.
> 
> Is it theoretically possible to implement a compile time define for 
> Lazarus version?

You can use it at compile time:

uses lclversion;
{$IF lcl_minor=7}
...

It is just that codetools do not support such constants. The compiler
does.

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-22 Thread Mattias Gaertner
On Thu, 22 Sep 2016 15:14:21 -0600
"Lars"  wrote:

> On Thu, September 22, 2016 3:08 am, Mattias Gaertner wrote:
> >
> > I added two options "Show console" and "Hide window". Enable Show
> > console and disable Hide window and cmd.exe will be shown in a console
> > window.
> >
> > Mattias  
> 
> 
> Oh, when did you add this, long ago or just recent... which release... or
> is it only on the latest github/svn. Thanks, I did not see this option

Just recently, as in today.

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Conditional code based on Lazarus/LCL version

2016-09-22 Thread Denis Kozlov

On 22/09/2016 22:02, Mattias Gaertner wrote:

See unit lclversion.


Thanks! Somehow I just couldn't find it.

Is it theoretically possible to implement a compile time define for 
Lazarus version?


Perhaps an extra define that Lazarus passes to compiler automatically?

Thanks,
Denis
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-22 Thread Lars
On Thu, September 22, 2016 3:08 am, Mattias Gaertner wrote:
>
> I added two options "Show console" and "Hide window". Enable Show
> console and disable Hide window and cmd.exe will be shown in a console
> window.
>
> Mattias


Oh, when did you add this, long ago or just recent... which release... or
is it only on the latest github/svn. Thanks, I did not see this option
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-22 Thread Lars
On Thu, September 22, 2016 2:38 am, shoKwave wrote:
> Hi,
>
>
> I simply tried putting a TProcess and a TButton on a form and used
> following code
>
> procedure TForm1.Button1Click(Sender: TObject); begin
> Process1.ApplicationName:='c:\windows\system32\cmd.exe';
> Process1.Execute;
> end;
>
> Works for me on a Win10 32bit machine with FPC 3.0.0 and Lazarus 1.6.
>


To clarify I meant the external tools in the IDE that allow you to launch
a tool from the IDE tools menu...
i.e. not actual lazarus coding, but a tool to launch from the IDE. Most
text editors have this feature, lazarus has really good access to lots of
macros that fill in values.

For some reason cmd.exe /k doesn't launch the command line from lazarus
external tools in the menu. /k option keeps the command line window open
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Conditional code based on Lazarus/LCL version

2016-09-22 Thread Mattias Gaertner
On Thu, 22 Sep 2016 21:30:51 +0100
Denis Kozlov  wrote:

> Hi,
> 
> Is there something like FPC_VERSION define but for Lazarus or LCL, e.g. 
> LAZARUS_VERSION?

See unit lclversion.

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Desktops - some features overengineered (?)

2016-09-22 Thread leledumbo
> Does anybody take advantage of the fact that these settings are 
different for every desktop? 

Yes

> Or did I overengineer the feature?

No

> For me it looks like the users are only confused (like Graeme in the "IDE 
> Docking windows and Editor Toolbar" thread)

they just need explanation, this feature is surprising for those who aren't
quite involved in the development. One wouldn't expect it at first glance.



--
View this message in context: 
http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Desktops-some-features-overengineered-tp4049593p4049610.html
Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com.
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Launching External Tool Cmd.exe in Windows

2016-09-22 Thread Mattias Gaertner
On Thu, 22 Sep 2016 00:14:17 -0600
"Lars"  wrote:

> Hi, Lazarus has the nice feature of being able to launch an external tool.
> 
> I'm trying to launch a console app...
> 
> So I put C:\Windows\System32\cmd.exe in the program file name for the
> external tool. This does nothing and gives no error message. Also add the
> parameter /k and it still does nothing.
> 
> Any idea how to get lazarus to launch a simple cmd.exe instance as an
> external tool? Should this be filed as a bug if it doesn't work?
> 
> Other things I will try... COMSPEC... but still cmd.exe should work, no?

I added two options "Show console" and "Hide window". Enable Show
console and disable Hide window and cmd.exe will be shown in a console
window.

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Accessing components in FormCreate event

2016-09-22 Thread Mattias Gaertner
On Thu, 22 Sep 2016 09:50:06 +0100
Lukasz Sokol  wrote:

>[...]
> From what I remember (on Turbo Delphi, but this is generally true I think)
> anything that causes the form to redraw,
> (as it's been indicated in responses here too - resizing, aligning, changing 
> colours etc)
> is a really bad idea, because there may not be anything to answer the OnPaint 
> events yet
> while FormCreate is being serviced.

There is no OnPaint during OnCreate.

 
> (Speculation because I haven't dived that deep: the visual component 
> hierarchy on the form
> is kept in a tree-like structure, that is being walked top-down by a single 
> thread, 
> and so other components' OnCreate is called AFTER their parent is created, 
> and not necessarily
> in order of appearance (in order of being placed on form, presumably?) 

The order of dropping the components on the form defines the creation
order.

>[...]

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Accessing components in FormCreate event

2016-09-22 Thread Lukasz Sokol
On 22/09/16 08:13, Luca Olivetti wrote:
> El 22/09/16 a les 08:47, Lars ha escrit:
> 
>> 
>> However these may be issues with formcreate that are not related to
>> the bugs I have come across. I'm trying to remember what exactly
>> was the problem that I had in FormCreate, but can't remember
> 
> 
> I don't remember exactly, but the size of the component isn't the
> final one (depending on align, anchors or autosize, as I said I don't
> remeber the details) until the FormShow, so if you need them to
> initialize other components you have to wait.
> 
> Bye

From what I remember (on Turbo Delphi, but this is generally true I think)
anything that causes the form to redraw,
(as it's been indicated in responses here too - resizing, aligning, changing 
colours etc)
is a really bad idea, because there may not be anything to answer the OnPaint 
events yet
while FormCreate is being serviced.

(Speculation because I haven't dived that deep: the visual component hierarchy 
on the form
is kept in a tree-like structure, that is being walked top-down by a single 
thread, 
and so other components' OnCreate is called AFTER their parent is created, and 
not necessarily
in order of appearance (in order of being placed on form, presumably?) 
Whereas in On(First)Show of the main form you can assume the entire tree exists 
and has sizes and
positions calculated at least once)

Hope it's not overly far from truth ;)

-L.


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


Re: [Lazarus] Accesing components in FormCreate event

2016-09-22 Thread Mattias Gaertner
On Thu, 22 Sep 2016 00:54:35 -0600
"Lars"  wrote:

>[...]
> Prefer positive attitude of Yes, vs No. Inbetween Qbit state: maybe.

I meant 'True'.

 
> > Keep in mind that the LCL tries to create the Handle and layout after
> > calling FormCreate. So changing properties do not have immediate effects
> > as in the VCL. For example changing Panel1.Align=alTop will move Panel1 to
> > top after FormCreate.  
> 
> 
> Maybe these were some of the issues. What if you had three panels, and you
> set all the alignments up.. then when the form is finally shown it has no
> idea which alignment you wanted done first?  Or does it somehow memorize
> which alignments were set first.  This could be related to the issue I had
> but cannot remember, for the life of me.

Maybe this helps:
http://wiki.lazarus.freepascal.org/Autosize_/_Layout#Order_of_controls_with_same_Align

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Accessing components in FormCreate event

2016-09-22 Thread Luca Olivetti

El 22/09/16 a les 08:47, Lars ha escrit:



However these may be issues with formcreate that are not related to the
bugs I have come across. I'm trying to remember what exactly was the
problem that I had in FormCreate, but can't remember



I don't remember exactly, but the size of the component isn't the final 
one (depending on align, anchors or autosize, as I said I don't remeber 
the details) until the FormShow, so if you need them to initialize other 
components you have to wait.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Accesing components in FormCreate event

2016-09-22 Thread Lars
On Thu, September 22, 2016 12:48 am, Mattias Gaertner wrote:
>> No, formcreate is the correct event to set up new components.
>>
>
> Yes.

Prefer positive attitude of Yes, vs No. Inbetween Qbit state: maybe.

> Keep in mind that the LCL tries to create the Handle and layout after
> calling FormCreate. So changing properties do not have immediate effects
> as in the VCL. For example changing Panel1.Align=alTop will move Panel1 to
> top after FormCreate.


Maybe these were some of the issues. What if you had three panels, and you
set all the alignments up.. then when the form is finally shown it has no
idea which alignment you wanted done first?  Or does it somehow memorize
which alignments were set first.  This could be related to the issue I had
but cannot remember, for the life of me.
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Accessing components in FormCreate event

2016-09-22 Thread Lars
On Thu, September 22, 2016 12:31 am, I previously wrote:
> If I could just find one other person that has been haunted by accessing
> components in formcreate, then I'd confirm I am not imagining things

i.e. here are some issues others have come across which may be semi
related to problems I have experienced, or not:

Quote "However sometimes a few special things can cause problems in
FormCreate, usually related to the order window handles are created, and
for such special cases FormShow can also be abused for initialization. "
-- Jens Grusche, (posted on another delphi list)

And this:
http://stackoverflow.com/questions/3261653/why-would-something-fail-in-formcreate-but-work-fine-in-formshow

However these may be issues with formcreate that are not related to the
bugs I have come across. I'm trying to remember what exactly was the
problem that I had in FormCreate, but can't remember. I do recall having
to create a FirstShow hack to do what I needed to do... I don't like using
the FormShow event, even with a counter, since it is called multiple times
and FormCreate is only called once.
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Accesing components in FormCreate event

2016-09-22 Thread Mattias Gaertner
On Thu, 22 Sep 2016 07:36:45 +0200 (CEST)
Michael Van Canneyt  wrote:

> On Wed, 21 Sep 2016, Lars wrote:
> 
> > I'm trying to remember if setting up some values of components is okay to
> > do in the form create event. From what I remember in Delphi days of
> > programming years ago, I think I found out the hard way that setting up
> > components in the FormCreate event was a bad idea, and I had to resort to
> > tricks like doing it in the FormShow event instead, using a counter to
> > only do it on the first show.
> >
> > Do I recall correctly? Is it bad practice to set up some components on the
> > form in the formcreate event, because of timing and issues with the
> > components not all being set up in time?  I recall, but cannot be sure,
> > that in Delphi this led to issues and bugs where if you accessed
> > components on the form in the formcreate event, it was too soon for some
> > components as they had not initialized yet. I can't remember for sure
> > though, and Lazarus may be different.  
> 
> No, formcreate is the correct event to set up new components. 

Yes.
Keep in mind that the LCL tries to create the Handle and layout after
calling FormCreate. So changing properties do not have immediate
effects as in the VCL. For example changing Panel1.Align=alTop will
move Panel1 to top after FormCreate.


> OnShow may be called multiple times in the lifetime of a form.

You can use
Form1.AddHandlerFirstShow

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus