Re: [Lazarus] Gtk2

2018-02-19 Thread Anthony Walter via Lazarus
Maybe homebrew as well. I've heard from most people that brew is better
than ports.
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Strange ComboBox behavior (Windows)

2018-02-19 Thread Rolf Wetjen(rolf.wetjen--- via Lazarus

Hi Lazarus team,

I've two issues with a ComboBox (csDropDown) control in Windows:

1. ComboBox.AutoSelect:=false isn't working. I seems that Windows always 
selects the whole ComboBox.Text at activation of the control.


2. Changing the ComboBox.Font (.Style, .Size or .Color) overwrites the 
ComboBox.Text with the first matching item of ComboBox.Items.

ComboBox.Style is csDropDown. Look at this code:

procedure TForm1.SpeedButtonTestClick (Sender: TObject);
begin
  ComboBox1.Clear;
  ComboBox1.Items.Add('Item0');
  ComboBox1.Items.Add('TestItem1');
  ComboBox1.Items.Add('Item2');
  ComboBox1.Text:='Test';
  if fsBold in ComboBox1.Font.Style then
ComboBox1.Font.Style:=ComboBox1.Font.Style-[fsBold]
  else
ComboBox1.Font.Style:=ComboBox1.Font.Style+[fsBold];
end;

ComboBox1.Text is set to 'TestItem1'.

I'd a good look into customcombobox.inc and win32wsstdctrls.pp (Windows 
10 x64, Lazarus 1.9 57316) trying to analyse this without any idea. 
Meanwhile I think that both issues are MS Windows ones. But I don't have 
a Linux environment to check it. Maybe someone else can do?


Is there any interest in a patch to solve MS Windows issues although the 
patch would add some windows specific code to stdctrls.pp and 
customcombobox.inc? I've a solution for the "AutoSelect=false" one and 
an idea for the second one.


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


Re: [Lazarus] Form events firing order and count

2018-02-19 Thread Martok via Lazarus
Am 19.02.2018 um 00:18 schrieb Michael Van Canneyt via Lazarus:
> Why is it obviously not true ? It's obviously not true that it is compatible
> at the binary level. FPC does not produce the same binary code
I'm more talking about the macroscopic perspective. Of course the binary code
may be different, but does it have the same concept of what a specific block of
source "means"?

Or, put differently,
> But source code written for Delphi must compile in FPC.
Should it also do something *similar*?

Just from the things that come up at least twice a year in the time since I
started actively following the lists... tempvar allocation and lifetimes
(especially with respect to interface refcounting), TBitmap Pixelformat & co,
LCL event order, my pet peeve small type memory layout...
I get why most of them are/must be different, it's just that code compiles, but
stops working. That's kinda the opposite of what the technical definition of
"source-code compatible" means.

-- 
Regards,
Martok

Ceterum censeo b32079 esse sanandam.

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


Re: [Lazarus] Form events firing order and count

2018-02-19 Thread Sven Barth via Lazarus
Am 19.02.2018 10:29 schrieb "Martok via Lazarus" <
lazarus@lists.lazarus-ide.org>:

> But source code written for Delphi must compile in FPC.
Should it also do something *similar*?


As long as the code does not rely on undocumented behavior, yes.

Regards,
Sven
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Form events firing order and count

2018-02-19 Thread Martok via Lazarus
Am 19.02.2018 um 11:10 schrieb Sven Barth via Lazarus:
> As long as the code does not rely on undocumented behavior, yes. 
And therein lies the issue. Things that worked the same way for >25 years and
are mentioned explicitly in numerous secondary literature are considered
"undocumented". And whatever is the official documentation anyway - the
yellow-{blue,red} books? .hlp? .hxs? Docwiki? And in which translation?

Don't get me wrong: I *get* why the choices that were made needed to be made to
get cross-platform consistency within fpc. I even agree with most of them. I
just think it would be dishonest to pretend they weren't made. That was the
entire point of my earlier post.


Am 19.02.2018 um 13:51 schrieb Michael Van Canneyt via Lazarus:
> Do you have examples where it does not ?
I listed some right below. Mind you, none of them are esoteric corner-cases: the
Interface stuff is any LINQ-alike ever, PixelFormat means Scanline and blit
performance, etc.

>> That's kinda the opposite of what the technical definition of
>> "source-code compatible" means.
> Really? Where did you find this definition ?
Wikipedia. They make it about portability of the function of a program across
platforms (read: compilers).

> And that's all there is to say about it.
Indeed it is. Once one internalizes that there is at best accidental
compatibility, a lot of pain goes away. Just treat fpc as a completely different
language system with some deceptively named syntax modes, and you end up with a
pretty great compiler.

-- 
Regards,
Martok

Ceterum censeo b32079 esse sanandam.

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


Re: [Lazarus] Form events firing order and count

2018-02-19 Thread Ondrej Pokorny via Lazarus

On 19.02.2018 13:51, Michael Van Canneyt via Lazarus wrote:
If your code relies on implementation details, it won't always work 
obviously.


But if you spot differences in behaviour, you can notify the devs. 
There are

then 2 options:
- They try to fix the behaviour.
- They explain why it works differently.

And that's all there is to say about it.


True words. IMO we can apply the same to LCL events: the order/count is 
an implementation detail and depends on the underlying widgetset.


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


Re: [Lazarus] Form events firing order and count

2018-02-19 Thread Michael Van Canneyt via Lazarus



On Mon, 19 Feb 2018, Martok via Lazarus wrote:


Am 19.02.2018 um 00:18 schrieb Michael Van Canneyt via Lazarus:

Why is it obviously not true ? It's obviously not true that it is compatible
at the binary level. FPC does not produce the same binary code

I'm more talking about the macroscopic perspective. Of course the binary code
may be different, but does it have the same concept of what a specific block of
source "means"?


It should.

It's obvious that if CloseFile() under the hood actually does nothing, this
is not what it 'means'.

The examples you give are in a gray zone, where "what it means" is not always so
clear.



Or, put differently,

But source code written for Delphi must compile in FPC.

Should it also do something *similar*?


Do you have examples where it does not ?



Just from the things that come up at least twice a year in the time since I
started actively following the lists... tempvar allocation and lifetimes
(especially with respect to interface refcounting), TBitmap Pixelformat & co,
LCL event order, my pet peeve small type memory layout...
I get why most of them are/must be different, it's just that code compiles, but
stops working. That's kinda the opposite of what the technical definition of
"source-code compatible" means.


Really? Where did you find this definition ?

If your code relies on implementation details, it won't always work obviously.

But if you spot differences in behaviour, you can notify the devs. There are
then 2 options:
- They try to fix the behaviour.
- They explain why it works differently.

And that's all there is to say about it.

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


[Lazarus] Gtk2

2018-02-19 Thread Adriaan van Os via Lazarus

Any suggestions on where to download gtk2 binaries for OS X (e.g. version 2.24) 
?

Thanks,

Adriaan van Os
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Gtk2

2018-02-19 Thread Adriaan van Os via Lazarus

Adriaan van Os via Lazarus wrote:
Any suggestions on where to download gtk2 binaries for OS X (e.g. 
version 2.24) ?


To answer my own question, maybe MacPorts is the best source ?

Regards,

Adriaan van Os

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


Re: [Lazarus] Form events firing order and count

2018-02-19 Thread Michael Van Canneyt via Lazarus



On Mon, 19 Feb 2018, Martok via Lazarus wrote:


Am 19.02.2018 um 11:10 schrieb Sven Barth via Lazarus:
As long as the code does not rely on undocumented behavior, yes. 

And therein lies the issue. Things that worked the same way for >25 years and
are mentioned explicitly in numerous secondary literature are considered
"undocumented".


I will mention 1 case in point. Const parameters.

For years, people mistakenly assumed that Const parameters were 
be passed by reference if they were "big" (records), a behaviour which

Delphi exhibited. And 'mentioned explicitly in numberous secundary
literature' as you put it so nicely. But not documented.

FPC introduced Constref to guarantee a constant was passed by
reference (I think IUnknown methods were the first to use this), 
but otherwise refused to change our view of 'Const'.


Then one day, someone on the Delphi team (I believe Allan Bauer?) makes a
blog post stating that "Const never implied that big types are passed by
reference", and that people should correct their code and use the new [Ref]
attribute if they want a const parameter passed by reference.

Thus supporting the point of view which we had all along.

So, no, we will not promise to conform to undocumented behaviour.

And documented behaviour is what the language guide of Delphi states.

So unless Delphi _documents_ that

MyClass.SomeInterfaceExpression.SomeMethod;

is 100% equivalent to

Temp:=MyClass.SomeInterfaceExpression;
try
  Temp.SomeMethod;
finally
  Temp:=Nil;
end;

It remains an implementation detail when the temp is finalized.

Which, in FPC, is currently at the end of the procedure.

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


Re: [Lazarus] Form events firing order and count

2018-02-19 Thread Michael Van Canneyt via Lazarus



On Mon, 19 Feb 2018, DougC via Lazarus wrote:


 On Mon, 19 Feb 2018 13:47:14 -0500 Michael Van Canneyt via Lazarus 
lazarus@lists.lazarus-ide.org wrote 

And documented behaviour is what the language guide of Delphi states.

Is there such a language guide for the language features introduced in the last 
10 years?

AFAIK the last one was published around 2002 so this is hardly a good basis.


The Delphi help is the only documentation available these days, so what you
find in that, this is it...

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


Re: [Lazarus] Form events firing order and count

2018-02-19 Thread DougC via Lazarus






 On Mon, 19 Feb 2018 13:47:14 -0500 Michael Van Canneyt via Lazarus 
lazarus@lists.lazarus-ide.org wrote 




And documented behaviour is what the language guide of Delphi states.




Is there such a language guide for the language features introduced in the last 
10 years?

AFAIK the last one was published around 2002 so this is hardly a good basis.




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