Re: [Lazarus] components\aggpas\gpc - non-commercial use only

2016-05-17 Thread Jürgen Hestermann


Am 2016-05-17 um 18:15 schrieb Ondrej Pokorny:
> On 17.05.2016 18:09, Jürgen Hestermann wrote:
>> I don't use AGGPAS but I assume that the GPC unit is part of the package.
>> If that is true, then it would not be enough to check for the licencing of 
the package.
> Of course it is. Please try to find information before you post wrong 
statements. There is an info about it in the package. See 
components/aggpas/readme.txt

Well, to me it only sounded contradikting that there is "one licence per 
package" and
on the other hand *some* units in packages may have different licences.

I was (am) just not sure that we can rely on having *all* licence information 
for a package
summed up in just one readme file (of this package) for all packages (not just 
AGGPAS).


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


Re: [Lazarus] components\aggpas\gpc - non-commercial use only

2016-05-17 Thread Jürgen Hestermann

Am 2016-05-17 um 15:52 schrieb Graeme Geldenhuys:
> Getting back to AggPas. If you use the AggPas code as-is from the
> "components" directory, there are no licensing restriction for
> commercial projects. So there is NO issue by default. You have to
> explicitly include the gpc unit somewhere in YOUR code before a license
> restriction applies. AggPas functions perfectly well without the gpc
> unit, hence it is not referenced anywhere in the standard AggPas units.

I don't use AGGPAS but I assume that the GPC unit is part of the package.
If that is true, then it would not be enough to check for the licencing of the 
package.
Every unit can have different licencing restrictions which makes it quite
cumbersome to find all licencing information.


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


Re: [Lazarus] Lazarus Digest, Vol 99, Issue 32

2016-04-18 Thread Jürgen Hestermann

Am 2016-04-18 um 12:53 schrieb Michael Schnell:

On 04/18/2016 12:40 PM, Ondrej Pokorny wrote:


No, the equation includes everything along with everybody's interests.

Example:
You spend X hours to write documentation for A that saves Y hours to Z users 
that otherwise had to study the code.
Then you can compare X to Y*Z.


That was my initial proposal leading to "extremely hard to define", as (due to 
no intended and hence measurable revenue) the developers don't have any idea about the 
count of users and the effort they need to get their work done.

As an extreme you would say: no documentation at all is best, as that means no 
hours to create it and there supposedly will be at least a single user who is 
able to make some small benefit from the project and hence the positive ratio 
is infinite .


It's not the ratio (quotient) that is of relevance here but the difference.

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


Re: [Lazarus] Bashing the developers

2016-04-11 Thread Jürgen Hestermann

Am 2016-04-11 um 17:38 schrieb Dennis:
> That is so rude of you (Jürgen) to say that. By your reasoning, let us all 
attack you (Jürgen) and your attitude and you should just ignore it or filter your 
mails.

I don't know why I am the bad guy now.
I did not start these personal attacks.
I just reacted on them.
Please read the whole thread(s) to see how this all started.
What did I write that justifies such a personal attack on me and request a "public 
apology"?


> We should all thank the developers for their selfless contribution to this 
open source project. They work for free and deserve our respect at the very least.
> I, myself, am very thankful to Lazarus and FPC. Without them, I had to pay a 
lot of money to upgrade to Delphi, which I hate after version 7, for my work to 
make a living. I make money from a FREE open source project which developers work 
without reward.  I want to say loudly here, THANK YOU ALL!

Of course, nobody here wants to miss any of the current state of Free 
Pascal/Lazarus.
So anybody who was/is involved in coding here can be thanked very much.
But does that mean that any discussions about improvements is forbidden?


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


Re: [Lazarus] Bashing the developers

2016-04-09 Thread Jürgen Hestermann

Am 2016-04-09 um 15:57 schrieb Juha Manninen:
> Regarding posts from Jürgen Hestermann.
> Unfortunately this is not the first time he finds excuses to blame
> Lazarus developers.
> The main theme is that developers have done a poor job and did not
> serve him well enough.
> Earlier it was about the new Unicode support. All the work I had done
> for it was irrelevant, he wanted to emphasize how poorly I had done
> the job.
>
> This all reminds me of the horrible flame wars against FPC/Lazarus
> developers mostly in the forum. Many of the arguments were pure lies
> meant to agitate people and it worked well because there was nothing
> to stop them.
> The people with admin rights were afraid to do anything because they
> would get all the blame.
> Things escalated into surreal proportions.
> In the horrible CodeTyphon flame war I took initiative and finally the
> issue calmed down. Yes, I took lots of mud on me during the process.
>
> I have learned that no logical reasoning helps with such agitators.
> We need some rules instead. This is the "home" of our project. All
> important communication happens here and in the forum.
> Nobody should be allowed to come here only in the purpose of attack.
> For example: If I dislike some people, I don't go to their home to
> attack them and shit on their floor. Instead I stay away.
> The same rule should apply here. If somebody does not like us, he
> should write a hate-blog or something but stay away from our home.
>
> Every healthy and strong community needs ways to protect itself.
> This project need them, too.
> I know the flame-wars have caused motivation problems for developers
> and maybe caused them to leave. They have also scared away potential
> future contributors.
> Something must be done. I myself feel strongly unmoticated after
> reading the attacks.
>
> When somebody takes the effort and contributes something, he
> inherently "buys" voting power for the thing he implemented.
> Then he also has moral rights to criticise the work of other
> developers, but that right is not used much among the developers /
> active contributors.
> They understand how much it takes to contribute stuff. Why would they 
criticise?
>
> Thus, I want Jürgen Hestermann to make a public apology for the
> developers he has attacked here.
> Further attacks should go to a personal blog somewhere. I promise to ignore 
it.
>
> For future needs, do we a have a mechanism to ban people from this list?
> In forum the threads can be locked, posts deleted and accounts banned.
> Those tools were used at least during the CodeTyphon episode.

Oh my god!! What a histerical tirade!
Why do you answer to all these posts if it brings you near to a heart attack?
Just ignore them if it you don't want to discuss them.
If you cannot live with any converse meanings then filter your mails
from all these evil people like me.


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


Re: [Lazarus] *** GMX Spamverdacht *** help writing help [was: Re: Re: Suggestion for TRadioGroup documentation]

2016-04-09 Thread Jürgen Hestermann



Am 2016-04-09 um 13:26 schrieb Michael Thompson:
> What?  How's that going to work?  I prefer my open source projects alive and 
kicking :-(
> I'm not interested in theoretical "wouldn't it be nice".  I agree that it 
would be nice if we have documentation, and I like putting a plan in place to forward this.  
But the proposal above is insane.

It highly depends:

If you think that open source projects are *exclusivley*
for those people who contribute on it and who are so involved
that they don't need any documentation because they already
know everything and have the time to keep track on all changes
then, yes, there is no need for documentation.

But if you want to attract a wider audience of people who
just use it then documentation is essential.
Otherwise you have to answer the same questions here over
and over again (or ignore them and let people use other,
better documented tools for programming).



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


Re: [Lazarus] Lazarus Digest, Vol 99, Issue 32

2016-04-09 Thread Jürgen Hestermann



Am 2016-04-09 um 12:20 schrieb Giuliano Colla:
> An answer such as: "Your patch is good, it adds a desirable functionality, but 
without proper documentation, nobody will be able to take advantage of it. Please add some 
concise comments on variable and procedure usage, and we will be glad to commit it." 
would do a lot of good, IMHO.
> Should this become a general rule, the situation might strongly improve with 
time.

+1

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


Re: [Lazarus] *** GMX Spamverdacht *** help writing help [was: Re: Re: Suggestion for TRadioGroup documentation]

2016-04-09 Thread Jürgen Hestermann

Am 2016-04-08 um 20:36 schrieb Martin Frb:
> On VirtualTreeView: I dont know if the Author is around, and if he could/would answer 
questions, or even proof read contributed docs. But if he was, then the question  "How 
long do you think would it take to (fully) understand" is just the wrong question. The 
question should be: how much time do you have? Is there a chance, that in that time you can 
document at least one property or method? If yes, well then start. If you get more done (now 
or later), then even better.

Okay.
Then please find the bug that you cannot collapse/expand nodes with the
mouse if the main column is not the most left one.
Moving this column to the left (even at runtime) makes it working again.
And please: No excuse that you have no time or such! ;-)

And believe me, I have already spend a lot of time on reading the code of
the VirtualTreeView unit (and many other units too) but it is impossible
to dig that deep into each to fully understand them.
I cannot do the documentation for every single function and concept in Free 
Pascal/Lazarus.
Is that a reason that I am not allowed to complain about missing documentation?


> The problem is, everyone (including me) is very good at pointing out why 
someone else should do it. And everyone just keeps pointing out it needs to be 
done.
> Well that is fine. Lobbying for a cause is great. But the expectations in 
that case must be set correct. Someone else may also have a reason not to do it.

I don't think that this is my attitude.
I just see it is a waste of time if someone is forced to read and
understand code that someone else has written (thereby
(mis-)interpreting things that the original coder already knew)
while the person who originaly wrote the code was already at that step.
Freshly after writing the code he could have written
the documentation much easier.

I know, many (most) programmers do not like writing documentations.
But leaving it to others is just that attitude that I am blamed for here.

What I would vote for is:
Do not implement any new features until all existing features are documented!




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


Re: [Lazarus] *** GMX Spamverdacht *** Re: Suggestion for TRadioGroup documentation

2016-04-09 Thread Jürgen Hestermann

Am 2016-04-09 um 00:54 schrieb Giuliano Colla:
> I'm not an expert in avionics, but from my general knowledge even I could 
have told them the reason for pumping fuel from one tank to another, which is to 
balance the weight on the wings (fuel tanks are located on the wings). This 
function must be handled by some part of software related to the aircraft flight 
attitude most likely fully documented, but completely apart from the section which 
takes care of pumping fuel to motors!

Of course they knew that the general purpose of pumping aroung the fuel was for 
balancing reasons.
They only did not understand why it was done *in the current situation*. They 
did not expect that it happened at that time.
I do not know whether they understood it in the end but I thought it should 
have been clear and understandable immediately.


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


Re: [Lazarus] *** GMX Spamverdacht *** Re: Suggestion for TRadioGroup documentation

2016-04-08 Thread Jürgen Hestermann

Am 2016-04-08 um 18:18 schrieb Martin Frb:

Or the person reading the code with the intend of documentation, is more clever 
than this. They could report any suspicious parts, and clarify the intend. That 
way the code would be additionally be checked for bugs.
Bugs where the original implementer may have had a wrong understanding of what 
he was doing. In which case had the original coder documented it, the bug would 
have gone into docs.
Assuming the original coder is available for comment, then a person different 
from that coder can often write much better documentation. (simple because then 
2 (or more) people will have though about what it should be)


I aggree  that this can happen.
But it requires that the reader has at least the same skills
regarding the topic of what has been coded.
How long do you think would it take to (fully) understand the code for 
VirtualTreeView?
I have already found bugs in it but never understood why they occur
because I do not understand how the whole unit is coded.
So how should I even write documentation for it?


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


Re: [Lazarus] *** GMX Spamverdacht *** Re: Suggestion for TRadioGroup documentation

2016-04-08 Thread Jürgen Hestermann

Am 2016-04-08 um 18:54 schrieb Ondrej Pokorny:

If everybody shared your approach, there wouldn't be anything like FPC and 
Lazarus. You should change your way of thinking.


You mean I should ignore facts?

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


Re: [Lazarus] *** GMX Spamverdacht *** Re: Suggestion for TRadioGroup documentation

2016-04-08 Thread Jürgen Hestermann

Am 2016-04-08 um 18:38 schrieb Ondrej Pokorny:

On 08.04.2016 19:29, Jürgen Hestermann wrote:

But in the same way as others complain here about lack of coders
I am complaining about the lack of documentation.


Feel free to reduce this lack of documentation.


If I could only.
It would take me months to understand all the code
where the documentation is missing/wrong.


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


Re: [Lazarus] *** GMX Spamverdacht *** Re: Suggestion for TRadioGroup documentation

2016-04-08 Thread Jürgen Hestermann

Am 2016-04-08 um 18:18 schrieb Ondrej Pokorny:
> This doesn't apply to Alan's problem. We try to document important things. It's not our 
problem that "it is not enough stressed that functionality XYZ is not available on 
ZYX". We really don't have crystal balls to know what people may think is not enough 
stressed.

I was answering to your statement: "If you think the documentation is bad, check the 
code and write it."
which was an answer to me writing: "When asking for documentation here I am often 
answered: Check the code."
I thought this was in general (at least my statements were).


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


Re: [Lazarus] *** GMX Spamverdacht *** Re: Suggestion for TRadioGroup documentation

2016-04-08 Thread Jürgen Hestermann

Am 2016-04-08 um 18:18 schrieb Michael Thompson:

I do agree though, we're open source.  We should all pull our own weight and 
not expect others to pick up our own slack.  It's only in a corporate 
environment that I'd insist on professionals doing the documentation.


Well, of course, nobody can be forced to do anything in open source projects.
The same applies to coding:
If nobody is willing (or not has the skills) to code for an open source project 
then it is as it is.

But in the same way as others complain here about lack of coders
I am complaining about the lack of documentation.
And IMO all discussions about what should be coded should also end in the 
question:
And who will document it?
Code without documentation is a pain.
Documentation saves a lot more time than it cost to write it.

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


Re: [Lazarus] *** GMX Spamverdacht *** Re: Suggestion for TRadioGroup documentation

2016-04-08 Thread Jürgen Hestermann

Am 2016-04-08 um 18:04 schrieb Ondrej Pokorny:

On 08.04.2016 18:56, Jürgen Hestermann wrote:

When asking for documentation here I am often answered: Check the code.


Yep. Correct. If you think the documentation is bad, check the code and write 
it. Alan, you are welcome to modify the domunentation in the LCL and send a 
patch. You can also freely update the wiki docs. There's no problem about it 
and you don't have to ask for permission.


That's a bad idea.
The person who wrote the code is the only person who knows what he intended.
This person has to write the documentation.

Not only that it would take a lot of (unneccessary) additional time to wade 
through
foreign code (while the original coder already knew this after writing it).
Also, every bug would become part of the documentation as it is "how it is 
coded".


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


Re: [Lazarus] Suggestion for TRadioGroup documentation

2016-04-08 Thread Jürgen Hestermann

Am 2016-04-08 um 17:59 schrieb Bart:
> But even if you don't read a manual or something like that, and just
> play with the component, after just a few minutes you must have seen
> the Items property, played with it and see what it does?

But then you only *think* you know how it works.
It maybe that some conditions exist, when things behave different.
You would never know about them if you have not read it somewhere.
It could be that you just wonder why things *sometimes* crash (or whatever).



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


Re: [Lazarus] *** GMX Spamverdacht *** Re: Suggestion for TRadioGroup documentation

2016-04-08 Thread Jürgen Hestermann

Am 2016-04-08 um 17:35 schrieb Michael Van Canneyt:
> Thinking that you start without reading any form of documentation is an 
attitude which I highly condemn.

I would love to read documentations but very often there is none (or even worse 
it is wrong, outdated, confusing and incomplete).
When asking for documentation here I am often answered: Check the code.


> Unfortunately, this attitude seems typical for IT.

It has evolved into this.
When I started with Turbo Pascal very excellent documentation was wide spread.
Today with fast version cycling it seems that nobody has the time for it anymore
or (even worse) not even has the knowledge about how things exactly behave.
So we are all left to use trial and error which is realy sad.


> If NASA or Airbus or Boeing engineers would use that approach, I guess a lot 
of rockets, planes and whatnot would fall on our heads.
> I am glad they do not seem to have this attitude.

I am not sure that they do not have it.
I saw a report on TV about a test flight of the A380 some years ago
where technicians were wondering, why the air craft computer was
pumping fuel from one tank to the other in a certain flight situation.
It seemed they needed a lot of time to find it out.
I would have expected that the complexity was not driven to a point
where even the engineers do not fully understand what they have built.
Could be that we just had a lot of luck.


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


Re: [Lazarus] German umlauts in component names

2016-04-02 Thread Jürgen Hestermann

Am 2016-04-02 um 12:32 schrieb Special:
> Why? What's so bad with TButton.Name "StraßeButton" to select "Straße" in, 
for instance, a school program for german kids?

I am german too and I also would not like to have this.
Just think about programs written by japanese or chinese
programmers using their (unicode) characters in identifiers.
Can you read such programs?
Same for the opposite case when german umlauts and such
are read by programmers from asia.
What an unnecesseriy increase of complexity.



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


Re: [Lazarus] Feature Request: hide button text in windows with toolbars

2016-02-25 Thread Jürgen Hestermann

Am 2016-02-25 um 17:40 schrieb Michael Van Canneyt:
>
> On Thu, 25 Feb 2016, Jürgen Hestermann wrote:
>> The best would be to avoid all these toolbars and
>> use on demand popup (text) lists where I can select from.
>> Such a text list can be filtered, sorted and searched for but pictograms 
cannot.
>
> That's called a menu ?

A sort of.
But directly invokable via shortcut key and with filter and/or sorting.
A (possibly long) list of text entries but you can type some characters and
it immediately filters the list to the matching entries only (as in the 
component/view all-dialog).
They could be sortable by last usage or lexically (or others) by the user.
Windows start menu search finally uses this too (although this has other 
issues).

Or a tree like list where typing takes you to the next matching entry and enter 
invokes it.

When programming I would not like to move away my hands from the keyboard to 
reach for the mouse.
That's not ergonomical.

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


Re: [Lazarus] Feature Request: hide button text in windows with toolbars

2016-02-25 Thread Jürgen Hestermann



Am 2016-02-25 um 16:46 schrieb Graeme Geldenhuys:
> In the "IDE Options -> Environment -> General" you can disable images on
> buttons (in ide dialogs) and menus.
>
> Would it be possible to have another option to disable text in ide
> windows that have toolbars? Take a look at the attached screenshot. Many
> ide windows look like the red rectangle (that isn't zoomed in the
> screenshot, that's actual size). Yet look at how much less space is
> taken up by the toolbars in the green rectangles.
> These massive toolbars are wasted screenspace, and if you resize windows
> like the Project Group window and make it narrower to fit the content of
> the treeview better, then I get 3 rows of buttons - waisting even more
> vertical space!
>
> A image with a tooltip should suffice. The added text is just bloat.

It's just the other way round:
The images are bloat.
They contain no information at all.

The best would be to avoid all these toolbars and
use on demand popup (text) lists where I can select from.
Such a text list can be filtered, sorted and searched for but pictograms cannot.

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


Re: [Lazarus] Warning about integer constant and expression

2016-02-23 Thread Jürgen Hestermann

Am 2016-02-23 um 19:42 schrieb Mattias Gaertner:

On Tue, 23 Feb 2016 18:28:29 +0100
Jürgen Hestermann <juergen.hesterm...@gmx.de> wrote:


WIth this definition:

var  i64 : Int64;

and this code:

if i64>High(SizeInt) then

I get:
"Warning: Comparison might be always false due to range of constant and 
expression"
And even more strange, if I convert the constant to int64 as in

if i64>int64(High(SizeInt)) then

I still get this warning.
Why?

Because on a 64bit system SizeInt = int64.


Yes, you are right.
I am using 64bit free pascal only for a short while now.
And because I compile for 32 bit too I will leave it as it is.
Thanks for clarifying/reminding me.


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


[Lazarus] Warning about integer constant and expression

2016-02-23 Thread Jürgen Hestermann

WIth this definition:

var  i64 : Int64;

and this code:

if i64>High(SizeInt) then

I get:
"Warning: Comparison might be always false due to range of constant and 
expression"
And even more strange, if I convert the constant to int64 as in

if i64>int64(High(SizeInt)) then

I still get this warning.
Why?


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


Re: [Lazarus] FileExistsUTF8 and long paths

2016-01-19 Thread Jürgen Hestermann

Am 2016-01-17 um 18:12 schrieb Bart:
> On 1/17/16, Jürgen Hestermann <juergen.hesterm...@gmx.de> wrote:
>> 2. without forward slashes and
> But then the function would not act on \\?\C:\maxpathchars\foo/bar if
> you omitted the \\?\, which seems to be the intention of your
> proposal?

I don't understand.
If the file path is already prepended by \\?\ then
forward slashes would not be resolved by the Win API anyway.
From 
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx

"Note:  File I/O functions in the Windows API convert "/" to "\" as part of 
converting the
name to an NT-style name, except when using the "\\?\" prefix as detailed in the 
following sections."

Nevertheless, we can also simply replace all / by \ before handing it over
to the Win API function.


> If I understood you correctly you would want to have
> function FileXXXUtf8(Fn) do:
> begin
> if (Length(Fn) > MaxPath) and (not StartsWith('\\?\',Fn) then
>   FileXXXUtf8('\\?\' + Fn)
> else
>   OriginalImplementationOfFileXXXUtf8()
> end;
> (With the exception of ExpandFilenameUtf8)

Yes, more or less.
Slashes should be converted to backslashes too.

Also, expanding (relative or incomplete) paths can be done
by Lazarus internally so that this would even work with long paths.

> To me, the better solution would be that a program that must be able
> to handle this should prepend the prefix itself (and taking care of
> all relevant issues like expanding, allowing/replacing '/' with '\'
> etc. beforehand) and then call the FileXXXUtf8 functions on the
> resulting string.

IMO this is just the wrong approach.
If Lazarus offers functions like FileExists then they should be rock solid.
Otherwise (if I have to find out the glory details anyway) I would
write my own FileExist (which I did now).
I have abandanded already many of these LCL functions because in
the end they did not help me avoiding any work.
There were always side effects that I had to overcome
with self written functions anyway.
So of what use are they?
Not only am I forced to know about all the OS specific details
I also need to find out what and how it has been implemented
in the Lazarus functions.
If I already know everything I can write my own
function that fits my needs much better.


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


Re: [Lazarus] Testing Unicode and Windows system codepage in Lazarus 1.6

2016-01-17 Thread Jürgen Hestermann

Am 2016-01-17 um 19:48 schrieb Juha Manninen:
> Jürgen and taazz,
...
> The wiki page explaining it
> should be improved and maintained by people who actually use the
> system which means Jürgen, taazz, michl and others.

Now that is cynical!
Telling those who do not know anything about what
has been developed over the last years
to write the documentation theirselfs.

Not the developers who know what they changed
and what they had in mind when doing so should
document their work but those who just use it.

For whom is the documentation meant at all?
Why not drop it and everything is fine?
The code is there, just read it!

I think with this attitude the whole project is doomed to fail.


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


Re: [Lazarus] Testing Unicode and Windows system codepage in Lazarus 1.6

2016-01-17 Thread Jürgen Hestermann

Am 2016-01-17 um 12:34 schrieb Juha Manninen:
> LCL continues to work as before when you define "DisableUTF8RTL". Then
> AnsiString is coded with the system codepage by default. The UTF-8
> conversion functions still work.

You may have a false impression of how Free Pascal/Lazarus is used by most 
people.
At least I did not wait until the current version to use Unicode (and long 
paths)
for file names and others. I think many did so.
Therefore we have build our own infrastructure/functions to work with the
Windows unicode API functions. In this case using "DisableUTF8RTL" would
be no option as it bombs us back to ANSI/short paths and still requires to do 
code changes.
That's not good.

So we need to live with the changes and understand the logic behind it (which 
IMO
is much more complicated than before). The amount of time we have to invest
is unforseeable for us and therefore many get frustrated (especially, because
the documentation is poor).

I have done the changes to (some) of my programs now and it works quite okay
but it was a hard time until this was finished (and I still don't know whether
bugs lurk here and there).


> I don't know why you always find excuses to complain. It is not nice.
> Please stop it.

Please stop ignoring and gibing those who have problems with the new unicode 
types.
I know how they feel and such statements are not helpful.
If you don't want to help then ignore these mails.
I know that those who have already worked on this for a long time
cannot understand why not everybody instantly knows how the new
codepage aware ansistrings work but be assured that for many this is
completely new. So bare with our frustration and better ignore such
mails than revile the writers.


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


Re: [Lazarus] FileExistsUTF8 and long paths

2016-01-17 Thread Jürgen Hestermann

Am 2016-01-17 um 12:42 schrieb Bart:
> On 1/16/16, Jürgen Hestermann <juergen.hesterm...@gmx.de> wrote:
>> Well, at least when the path is too long (length(FileName>MAXPATH))
>> it can prepend \\?\ because it will fail without it anyway.
> That won't do for the same reasons as explained above.
> Say you have a directory: c:\maxpathchars\1\2\3\
> Now cehcking for ..\..\foobar will still fail if
> c:\maxpathchars\1\foorbar exists, unless you have a folder in
> c:\maxpathchars\1\2\3\ that actually has the name  '..' etc.
> I.o.w expanding the filename cannot be done anymore.

Yes, that's true.
Additional checks (i.e. for dots) are needed
but I think it should be possible to find out
when a path is:

1. not relative and
2. without forward slashes and
3. too long to be resolved without prepended \\?\

so that adding \\?\ would make the request successful
when it otherwise would fail.


> Note that even Windows itself (at least windows explorer) cannot handle this.

Windows (the API) *can* handle this, only explorer can't.
I have written a file manager that has no problem to copy/move/rename etc.
files with paths of arbitrary length.
Of course, many special things (like deleting to recycle bin and setting
current directory) do not work with such long paths,
but at least those things that work should be made functional.


> I once unzipped a file with such a filename (produced on linux of course).
> It unzipped well and FileexistsUtf8('\\?\realfilename) worked well.
> (Testing this was the reason I did this.)
> After that windows was unable to remove the file in question.
> I tried various tools for that, icluding rm - R *.
> No such luck.

It seems that the unzip tool you used *was* able to handle long paths.
In such cases you can use more appropiate file managers like Total Commander or
Ztree that have larger limits than 255 (but still Ztree has a limit of 400 and
Total commander of 1000 character which I don't understand).
When using the W functions the limit is near 32000 so why don't they all 
support this?
Strange.


> To me it looks like a rather odd design desicion by MS have a MAXPATH
> but then have obscure ways to circumvent that.

Yes, again it is very bad design from MS that all (Windows users) have to live 
with.
But we should not make it worse than it already is.
So if the W functions support long paths we should support this too.


> AFACS it cannot be resolved/fixed in a manner that will not break
> backwards compatibility.

I think it is possible (see above).
You only need to find out the exact limitations and detect them before adding 
\\?\


> Further more: this is not something that belongs to Lazarus, but to fpc.

I am not sure. I thought FileExistsUTF8 is part of Lazarus, not Free Pascal.


>> I did not find any comments that mentions long paths
> You need new glasses then ;-)
> === code ==
>   //if Filename uses ExtendedLengthPath scheme then it cannot be expanded
>   //AND it should not be altered by ForcePathDelims or ResolveDots
>   //See: 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx
>   if (Length(Fn) > 3) and (Fn[1] = PathDelim) and (Fn[2] = PathDelim) and
>  (Fn[3] = '?') and (Fn[4] = PathDelim) //Do NOT use
> AllowDirectorySeparators here!
>  then Exit;
> === end code ===

I have read this but how is this related to \\?\ and long paths?
What is ExtendedLengthPath scheme?
I don't see any information about W functions and \\?\ prefix.



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


Re: [Lazarus] FileExistsUTF8 and long paths

2016-01-17 Thread Jürgen Hestermann

Am 2016-01-17 um 14:23 schrieb Jürgen Hestermann:
> Additional checks (i.e. for dots) are needed
> but I think it should be possible to find out
> when a path is:
> 1. not relative and
> 2. without forward slashes and
> 3. too long to be resolved without prepended \\?\

Even better would be to do the expansion of relative paths
internally before handing it over to the Windows API
so that they even work when Windows would fail.
The same applies to forward slashes.


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


Re: [Lazarus] FileExistsUTF8 and long paths

2016-01-17 Thread Jürgen Hestermann

Am 2016-01-17 um 15:25 schrieb Bart:
> Quoted from the link:
> "To specify an extended-length path, use the "\\?\" prefix. For
> example, "\\?\D:\very long path"."
> Maybe you need new eyes, not new glasses ;-)

I know the Windows API specification very well.

But you seem to forget the original thread.
I asked:

> Why not prepend "\\?\" at this last Windows step so it works for long paths

to which you answered:

> This will break existing programs, including the ide.
> Currently you can use both / and \ in filenames on Wndows filename
> functions, because the API does not care.
> That is unlues you prepend \\?\, then character in the given string
> MUST be in the filename.
> Also this will then return false on '..\foo.bar', sincenow te APi
> expects that the two dots are part of the filename.
> See the comments in ExpandFilenameUTF8 (I think I put a reference there).

How does the comment bring any new facts to the discussion?
It just repeats the text you wrote before.
I expected more information in the comment which I did not find.


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


Re: [Lazarus] FileExistsUTF8 and long paths

2016-01-17 Thread Jürgen Hestermann

Am 2016-01-17 um 15:39 schrieb Bart:
>>  > AFACS it cannot be resolved/fixed in a manner that will not break
>>  > backwards compatibility.
>> I think it is possible (see above).
>> You only need to find out the exact limitations and detect them before
>> adding \\?\
> Only if we decide to _always_ try that (under specified circumstances).
> If not it will be an optional parameter and the function then will
> have a different signature, which will be incompatible with existing
> programs using it as a function variable.

If you check for \\?\ (which is already done),
detect (or even expand) relative paths and
detect slashes (or even convert them to backslashes)
then no backward compatibility would be broken.
No drawback but the advantage of no failure for long paths.


>>> Further more: this is not something that belongs to Lazarus, but to fpc.
>> I am not sure. I thought FileExistsUTF8 is part of Lazarus, not Free Pascal.
> The only difference between File* and File*UTF8 functions
> (fpc<->Lazarus) is that the UTF8 versions were/are able to handle any
> unicodecharacter inside the given path/filename (regardless of you
> current Windows codepage).
> Otherwise it does not behave different compared to the fpc File*
> functions, nor should it.

Still the original function I mentioned was from Lazarus.
Therefore I wrote this to the Lazarus forum.
Otherwise I would have been blamed for not using the right forum. ;-)


BTW:
The following code in ExpandFileNameUtf8 seems to be not quite correct:

 if (Length(Fn) > 3) and (Fn[1] = PathDelim) and (Fn[2] = PathDelim) and
 (Fn[3] = '?') and (Fn[4] = PathDelim) //Do NOT use 
AllowDirectorySeparators here!
then Exit;

When PathDelim='/' it would make no sense.
Only Windows has the '\\?\' prefix and as far as I know it cannot be '//?/'.
For Linux this maybe a valid file/directory name (but I don't know).


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


Re: [Lazarus] Testing Unicode and Windows system codepage in Lazarus 1.6

2016-01-17 Thread Jürgen Hestermann

Am 2016-01-17 um 15:19 schrieb Juha Manninen:
> I don't understand how DisableUTF8RTL bombs your system because it is
> the backwards compatible thing.
> If your system worked with FPC 2.6.4, it should work with FPC 3.0 +
> DisableUTF8RTL.

Yes, you are right.
DisableUTF8RTL resets *some* of the changes (those related to the API interface)
and does not harm functions that already used the Win API directly.

But as one example, since FPC 3.0 you cannot use UTF8Delete on UTF8Strings 
anymore.
This requires changes to existing programs that cannot be avoided by a compiler 
switch.
Not everybody is prepared to invest this time just now.

This is no criticism of the good work that has been done to finally
make the long overdue step to codepage-aware strings.
Still everybody should also be aware that this is a radical change in
the already complicated area of string handling and due to its complexity
many FPC users experience these changes as a burden in the first place.
On the long term it was unavoidable of course but just now it generates 
frustration.


> Excuse me! Are you really saying I have not helped with the Unicode issues?

No, that's not what I said.
But if you got fed up with all these questions about unicode
it would be better to ignore some of the mails that bother you
instead of increasing the frustration of others by telling them
they are just too lazy (or dumb) to read (and understand) some wikis.


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


Re: [Lazarus] Web vs desktop development

2016-01-16 Thread Jürgen Hestermann

Am 2016-01-15 um 19:16 schrieb JuuS:
> I've always been of the opinion that the web is great for displaying
> information. To use it as the central processor bugs me.

+1


> When I ask my program to do something I want the attention of the
> processor. I don't want it going over the web (security issues) and then
> asking for some perhaps overworked server processor time.

I think it is even worse:
When code is run on the web server then it cannot infect my local machine.
But todays web pages use scripting more and more (which I mostly block
with NoScript). In this case I would download and run code with each and
every click. In terms of security this is a nightmare!

With local software I can do backups so I can go back to a system that works
in case something smashed it. I have full control and can use it offline too.
I would do changes only seldom (if everything runs ok),
i.e. I have switched off most update mechanism (including Windows updates).
No need to change a running system.

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


Re: [Lazarus] FileExistsUTF8 and long paths

2016-01-16 Thread Jürgen Hestermann

Am 2016-01-16 um 00:11 schrieb Bart:
> On 1/15/16, Jürgen Hestermann <juergen.hesterm...@gmx.de> wrote:
>> Why not prepend "\\?\" at this last Windows step so it works for long paths
> This will break existing programs, including the ide.
> Currently you can use both / and \ in filenames on Wndows filename
> functions, because the API does not care.
> That is unlues you prepend \\?\, then character in the given string
> MUST be in the filename.
> Also this will then return false on '..\foo.bar', sincenow te APi
> expects that the two dots are part of the filename.

Well, at least when the path is too long (length(FileName>MAXPATH))
it can prepend \\?\ because it will fail without it anyway.

I have found this issue the hard way as I checked for file existence in
my program and it reported false although the file existed.
So I overwrote it. IMO this is a bug.
A function that claims to check for file existence should be as reliable
as possible and not have some obscure side effects.


> See the comments in ExpandFilenameUTF8 (I think I put a reference there).

I did not find any comments that mentions long paths

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


[Lazarus] FileExistsUTF8 and long paths

2016-01-15 Thread Jürgen Hestermann

With Lazarus RC2 (and I think before too) "FileExistsUTF8" uses
"_FileGetAttrUtf8" which again uses FileGetAttrWide (on Windows if Unicode is 
enable)
which again uses "Windows.GetFileAttributesW(PWideChar(UTF8Decode(FileName)))"

but this fails for long paths (if Length(FileName)>255).
Why not prepend "\\?\" at this last Windows step so it works for long paths too?


BTW:
I am not sure whether this leads to errors but while the result of the Windows 
API-function
GetFileAttributesW is declared to be DWORD
this result is converted (or is ist just typecasted?) to Integer in

function FileGetAttrWide(const FileName: String): Longint;
begin
Result:=Integer(Windows.GetFileAttributesW(PWideChar(UTF8Decode(FileName;
end;

Doesn't this provoke at least a range check errors?
What happens when I compare the integer result with (DWORD) constants which 
havbe the first bit set?

This seems to be done at many places with many DWORD results from Windows API 
functions.
Is this a bug?

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


[Lazarus] IDE, source editor, file not opened when jumping to bookmark

2016-01-01 Thread Jürgen Hestermann

Lazarus 1.6 RC1:
If I have a bookmark in a file that has not (yet) been opened in the
source editor shouldn't the file be opened when I jump to this bookmark?
It's quite annoying that nothing happens and I only find out later that
this is not because the bookmark was deleted but simply because the file has 
been closed.

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


[Lazarus] Project option "UI Access" unclear

2015-12-31 Thread Jürgen Hestermann

What does it mean,
if I check the project option "UI Access" for Windows?
Is it set to true or false?
Shouldn't it be renamed to:
"Check to set UI Access to TRUE (FALSE if not checked)"
(or whatever is correct)?
Not even the help gives more information about how it is meant.

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


[Lazarus] Fwd: Lazarus 1.6 RC1: IDE, watch list, DEL key does nothing if language=german

2015-12-28 Thread Jürgen Hestermann


> Within Lazarus 1.6 RC1 I can not delete an entry from the watch list with the 
DEL key when I use german language settings. When I switch to english it works 
okay.

The same applies to the INS key.

Why does changing the language change the keys used?


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


Re: [Lazarus] Lazarus 1.6 and QuestionDLG

2015-12-21 Thread Jürgen Hestermann

Am 2015-12-20 um 18:21 schrieb Ondrej Pokorny:

On 20.12.2015 17:51, Jürgen Hestermann wrote:

Where do I find it?
I use official (pre) releases only.


Btw. if you read http://wiki.lazarus.freepascal.org/Lazarus_1.6.0_release_notes 
, you find this information there:

  * Added 'iscancel' parameter to QuestionDlg. If no cancel button is 
explicitely set, mrCancel is returned in case the dialog is closed with ESC or 
system close button.

I added it there on Dec 14th 2015...



Well, I downloaded RC1 on Dec 10th and read the release notes before
but it came not to my mind to read it again daily just in case some changes
were made (to the changes ;-)).

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


Re: [Lazarus] Lazarus 1.6 and QuestionDLG

2015-12-20 Thread Jürgen Hestermann

Am 2015-12-20 um 08:06 schrieb Ondrej Pokorny:
> I just add that you had to care for mrCancel before as well (if default 
dialog was shown).
> It was returned when the dialog was closed with the system close button in 
the window caption. So the test code you sent isn't good for 1.4 either.

Before (with Lazarus 1.4) typing escape had the expected behaviour.
Now (with Lazarus 1.6) the same code does nothing on escape.
So something has changed.

> Now the behavior should be consequent:
> no 'iscancel' button defined: mrCancel is returned on ESC/close.
> 'iscancel' defined: its modal result is always returned on ESC/close.

As already written in my other mail there is no documentation of 'iscancel' on
http://wiki.freepascal.org/Dialog_Examples#QuestionDlg
and here
http://lazarus-ccr.sourceforge.net/docs/lcl/dialogs/questiondlg.html
neither 'isdefault' nor 'iscancel' is mentioned.

I simply did not know about 'iscancel' at all.
How should I, if it's undocumented?

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


Re: [Lazarus] Lazarus 1.6 and QuestionDLG

2015-12-20 Thread Jürgen Hestermann


Am 2015-12-19 um 16:34 schrieb Mattias Gaertner:
> On Sat, 19 Dec 2015 11:17:26 +0100 Jürgen Hestermann 
<juergen.hesterm...@gmx.de> wrote:
>> Can the result be mcCancel even when it's not part
>> of the parameter list of the QuestionDlg function?
> Yes. Many widgetsets support an Escape key and/or have a close button.
> That's why there is the 'IsCancel' option to redirect the cancel
> to a button of your choice.

I just had a look at this
http://wiki.freepascal.org/Dialog_Examples#QuestionDlg
but I can't find any mentioning of 'IsCancel'.

It also says:
"If the user cancels the dialog, be sure to check the result! In the above code, the 
result on cancelling the original dialog will be mrNo."
That seems to be wrong if the result is always mrCancel.


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


[Lazarus] Lazarus 1.6 RC1: IDE, watch list, DEL key does nothing if language=german

2015-12-20 Thread Jürgen Hestermann

Within Lazarus 1.6 RC1 I can not delete an entry from the watch list
with the DEL key when I use german language settings.
When I switch to english it works okay.



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


Re: [Lazarus] Lazarus 1.6 and QuestionDLG

2015-12-20 Thread Jürgen Hestermann

Am 2015-12-20 um 13:41 schrieb Ondrej Pokorny:
> It's a feature from trunk added by me on Dec 13th 2015 and it is documented 
in trunk (although with some delay).
> I also merged it to 1.6 branch on Dec 14th 2015. Don't get me wrong - I don't 
want to be offensive but I expect
> everybody asking for bug fixes to check the trunk/fixes_1_6 SVN changes. You 
cannot see the implementation details otherwise.

I did not even know that 'iscancel' is a bug fix.
I thought it existed in version 1.4 too.


> You have to understand that new features in trunk are being developed and so 
they can change.

How do I know what are new features?
I just upgraded from Lazarus 1.4 to Lazarus 1.6 RC1
not knowing that the latter is just a development version.
I never use(d) trunk versions.


> Writing a documentation for features in development is not very reasonable.

Realy?
I thought that it is very important to document the *intended*
behaviour somewhere before (or at least while) coding it
so that everybody knows how things *should* work and
can distinguish bugs from features.
Without documentation every bug becomes an intended behaviour.


> Always look for documentation in trunk or the fixes branch.

Where do I find it?
I use official (pre) releases only.


> It is told to be updated with new stable versions so now it should reflect 
1.4.
> Of course you don't find the latest features there.

Okay, so the main reason for my problems is that I did not wait until the
official release of Lazarus 1.6. I thought that RC1 should already be stable
and wanted to help with testing (expecting only minor bugs only).
But it seems that was not a good idea.


> As latest, you have the source code, so you can check it as well - that 
usually is better than any documentation.

You cannot mean this seriously, do you?
You mean I should wade through *all* the
lines of code and understand each and every
line to discover new features and how they work?
Otherwise I would not have known that 'iscancel' was added recently.
There could be changes in many other functions too.

What if there is a bug?
When looking at the code I would consider this bug
to be an intended behaviour and rely on it (until it
gets fixed and bytes me back).

Not a good advice IMO.


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


Re: [Lazarus] Lazarus 1.6 and QuestionDLG

2015-12-19 Thread Jürgen Hestermann

Am 2015-12-13 um 16:52 schrieb Ondrej Pokorny:
> The escape key selects mrCancel now (this was changed) -

I am not sure I understand this right.
Does it mean, mrCancel needs to be
checked too in a case statement like this?

case QuestionDlg('COPYING',
 'Abort?',
 mtConfirmation,
 [mrNo, '','IsDefault',
 mrYes,''],0) of
   mrYes : ...
   mrNo : ...
   end; // of case

Can the result be mcCancel even when it's not part
of the parameter list of the QuestionDlg function?
That would be strange.

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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-13 Thread Jürgen Hestermann

Am 2015-12-12 um 19:34 schrieb Bart:
> There is no need for such a tone, please!

That's what I thought too as I read Juha's answer
telling me that I was just too "dummy" to have used UTF8Strings.


> Grasping the concepts of the new CP aware strings and all it's
> implications is not that easy.

True. Still many here say that you just need "to read the wiki"
and all is clear. But that's not true.


> And hence, at that point in time, there would (for programmers using
> Lazarus) bee no need to use the type Utf8String at all.

Then I would suggest to remove this type.


> I can see why you felt it was logical to have your strings being of
> type Utf8Strings, but unfortunately for you, it now turns out to be
> not such a good choice.

It is of course quite easy to rename string types, but that's not the point.
It is just totally confusing that Free Pascal (still) provides
an UTF8String type but it cannot be used anymore (not even for
routines that *only* work on UTF-8 strings).
If UTF-8 is the choice (which is good) then STRING should be replaced
by UTF8String so everybody instantly knows what he is using.

But I still don't understand the rationale behind the decision to not allow
ansistring(A) to be fed into a var parameter of ansistring(B).
I would expect that *all* ansistrings are assignement compatible.
Insisting on having the same *static* codepage does not make sure that these
strings have the same (dynamic) code page at run time.
Assigning 2 strings with different static code pages has the same risk as
if their static code pages are equal, they still may or may not have the
same encoding.

Allowing all ansistrings to be compatible would also remove the
problem with UTF8String and LazUTF8 routines.


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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-13 Thread Jürgen Hestermann

Am 2015-12-12 um 23:28 schrieb Juha Manninen:
> On Sat, Dec 12, 2015 at 8:38 PM,  wrote:
>> especially those readers from the ancient past (TP/BP days) who are trying
>> to catch up to the modern future...
> LCL has supported UTF-8 for > 10 years. As a long time Lazarus user you 
should know it.

I think we all know this, but this is not the point.


> For most cases things did not change very much. Earlier you had to use
> the explicit UTF8...() functions, now you don't need them.

What does this mean?
If I use DELETE on a String type (that is an UTF-8 string)
does it now use UTF8Delete internally?
Does it delete bytes or code points?
Does LENGTH now give back the number of bytes or the
number of characters (when used on an UTF-8 String)?


> Things are better!

Maybe, but without fully understanding the mechanism it is worse in the first 
place.


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


Re: [Lazarus] Lazarus 1.6 and QuestionDLG

2015-12-13 Thread Jürgen Hestermann

Am 2015-12-13 um 16:52 schrieb Ondrej Pokorny:

On 13.12.2015 16:38, Jürgen Hestermann wrote:

Also, the escape key no longer selects mrAbort.
I cannot exit from the dialog with escape.
Is this intended?

The escape key selects mrCancel now (this was changed) - but you should 
definitely be able to exit the dialog with escape. See 
http://bugs.freepascal.org/view.php?id=26019 .

As you may have seen from my code snippet I do not use mrCancel.
What happens in this case?
Should mrAbort used instead?
At least I am (no longer) able to exit from this dialog with Escape (on Windows 
8.1)




If you have any trouble with the code change, please attach a sample project so 
that we can discuss it more precisely.

I would have no problem to switch from mrAbort to mrCancel.
I am just wondering, why Escape no longer lets me exit at all.

Nevertheless, the TMemo issue is more severe to me
(even though I am planning to write my own QuestionDLG but
this may take a while, too many other things in the pipeline)

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


[Lazarus] Lazarus 1.6 and QuestionDLG

2015-12-13 Thread Jürgen Hestermann

I just saw that with Lazarus 1.6 QuestionDLG has been changed (too).
My code:

  Answer := QuestionDlg('File overwrite',S2,
 mtConfirmation,[mrNo, 
'','IsDefault',
 mrYes, '',
mrIgnore,'ne',
 mrAll, 'a',
 488, ' files 
only',
 588, 'files with different 
 and date only',
 188, 'copy/move with 
 name',
 288, 'rename existing 
 file (prior to '+S+')',
 388, ' files',
 mrAbort, ' 
'+S],0);

(with S2 beeing the text) showed this dialog with Lazarus 1.4 :




Now it looks like this:



The idea of using a TMemo is not bad but then it should have the width of the
window so that my text is not broken into more lines than neseccary.


Also, the escape key no longer selects mrAbort.
I cannot exit from the dialog with escape.
Is this intended?

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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-12 Thread Jürgen Hestermann

Am 2015-12-11 um 19:14 schrieb Sven Barth:
> Windows uses multi byte strings (one byte per character or more)
> and UTF-16 (which is mostly 2 Byte and 4 for surrogate pairs).
> The functions WideCharToMultiByte and MultiByteToWideChar which
> are also used inside FPC for string conversions both take a
> CodePage parameter that can also be CP_UTF8.

As far as I know, (current) Windows versions only use UTF16 internally.
But it provides the old legacy ANSI functions too (which convert to UTF16).
MultiByteToWideChar and WideCharToMultiByte are just helper
functions to convert from arbitrary encodings to UTF16 (and back).
But UTF-8 is nowhere used internaly in Windows (not even ANSI anymore,
except the legacy functions which convert to and from UTF16) and
you cannot use UTF8 as string encoding for WIN API functions.
Otherwise we would not have this problem and could use UTF-8 as
a standard for everything.

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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-12 Thread Jürgen Hestermann

Am 2015-12-12 um 17:16 schrieb wkitt...@windstream.net:

On 12/12/2015 10:47 AM, Bart wrote:

Anyhow, as stated before, there should be noneed to use the type
Utf8String in Lazarus programs.


i've been trying to follow along and keep up with this but this statement 
confuses me... how do you designate that a string is utf8 if you don't use that 
type?


Exactly that is my problem too.
There is a string type UTF8String (provided by Free Pascal)
but we cannot use it with routines like UTF8Delete (which
was designed to work on UTF8 strings only).
This is hard to understand.

I want to make my code readable and therefore I use(d)
UTF8String types in all my programs and now I have to
move back to the chimera STRING and somehow make
sure with crude system settings that its codepage is UTF-8
while UTF8String already *is* UTF-8.
That's confusing.

And I have read the "wiki"(s)
 (there are so many and some are still refering to the older versions of FPC)
but I don't get it:

Is it correct that now every ansistring has a static code page
and a dynamic code page (as mentioned in
http://wiki.freepascal.org/FPC_Unicode_support)?

Is it correct that each ansistring type can store strings with any
encoding (dynamic code page) but there is a "genuine" (static) code
page which is preferred (in cases a target encoding needs to be chosen)?

What is the difference between

UTF8String = type ansistring(cp_UTF8);

and

String = type ansistring(cp_ACP);
when cp_ACP=cp_UTF8?

Both would have the same static code page (UTF-8) but may contain
a different encoding at run time. So why can't I use an UTF8String
in the same way as a String type as parameter?
Why are they not assignment compatible?


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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-12 Thread Jürgen Hestermann

Am 2015-12-12 um 18:20 schrieb Sven Barth:

Yes, internally Windows uses UTF-16, but if you set your Windows Ansi code page 
or at least the current thread's locale to UTF-8 (indirectly by choosing a 
locale that has UTF-8 as code page, I don't know one right now though) then the 
*A functions *do* work with UTF-8, simply because they use the current locale's 
code page to convert from Ansi to Unicode and in this case Ansi includes UTF-8.

If that would be true then we could simply switch the Windows (API)
interface to UTF-8 and nobody needs to worry about code pages anymore.
I doubt that this can be done.

How do you set the Win API interface to now
expect UTF-8 strings in all *A functions?
Any link?



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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-12 Thread Jürgen Hestermann

Am 2015-12-12 um 18:02 schrieb Sven Barth:

On 12.12.2015 17:37, Jürgen Hestermann wrote:

Is it correct that now every ansistring has a static code page
and a dynamic code page (as mentioned in
http://wiki.freepascal.org/FPC_Unicode_support)?


Yes.



Is it correct that each ansistring type can store strings with any
encoding (dynamic code page) but there is a "genuine" (static) code
page which is preferred (in cases a target encoding needs to be chosen)?


Yes.


What is the difference between

UTF8String = type ansistring(cp_UTF8);

and

String = type ansistring(cp_ACP);
when cp_ACP=cp_UTF8?


CP_ACP is *never* CP_UTF8. It is *always* CP_ACP. So these two will *always* be 
different types. However the specific codepage that CP_ACP refers to is 
determined at runtime and that can indeed be CP_UTF8.



Both would have the same static code page (UTF-8) but may contain
a different encoding at run time. So why can't I use an UTF8String
in the same way as a String type as parameter?
Why are they not assignment compatible?


They are assignment compatible (all AnsiStrings are) and the compiler will 
insert a code page conversion if necessary (if CP_ACP refers to CP_UTF8 and if 
one of the two strings is CP_ACP the other CP_UTF8 then the conversion routine 
won't do a code page conversion of course). However since they are different 
types you can't simply pass a AnsiString(CP_UTF8) to a var parameter of type 
AnsiString(CP_ACP).


Thanks for your answers.
At least some of my questions are answered now.
The wikis are not clear about it.
Especially, the role of CP_ACP is not clearly documented.


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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-12 Thread Jürgen Hestermann

Am 2015-12-12 um 18:10 schrieb Juha Manninen:
> That was kind of dummy thing to do because UTF8String was an alias for
> AnsiString then.
> You could have used "String" always.
> Now UTF8String is no more an alias.

What an arrogant answer!
I read it like:
"You should have known that UTF8String was just introduced
to later make it incompatible to all system routines.
It was just there to irk programmers."

Why wasn't it mentioned before that you should not use it?
And what was the purpose of UTF8String (and what is it now)?



>> I have now to move back to type STRING and
>> somehow (did not find out yet) tell the system
>> that STRING should be UTF-8 all the time.
>
> "did not find out yet" -- it means you still did not read the wiki page. :(
> Why not?

Again a very arrogant attitude.
I read it dozen of times but it is totally confusing and contradicting.


> Still, in most cases our new UTF-8 system "just works".

I see how "it works". Thank you.


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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-12 Thread Jürgen Hestermann

Am 2015-12-12 um 18:04 schrieb Bart:

On 12/12/15, Jürgen Hestermann <juergen.hesterm...@gmx.de> wrote:


"Since FPC 2.7.1 the default system codepage of the RTL can be changed to
UTF-8 (CP_UTF8). So Windows users can now use UTF-8 strings in the RTL. "

It *can* be changed (but how?).

DefaultSystemCodePage := CP_UTF8;


So I need to add this to my program(s) now?
Where?
In each unit?
In the main program?


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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-12 Thread Jürgen Hestermann

Am 2015-12-12 um 18:21 schrieb Juha Manninen:

On Sat, Dec 12, 2015 at 6:54 PM, Jürgen Hestermann
<juergen.hesterm...@gmx.de> wrote:

Am 2015-12-10 um 18:22 schrieb Juha Manninen:

   http://wiki.freepascal.org/Better_Unicode_Support_in_Lazarus
"String" type is UTF-8 and it works now (almost) transparently without
explicit conversions.


Where do you read this?

The page says among other things :
  "The new mode is enabled automatically when compiling with FPC 3.0+."

Then why does it say:
"Since FPC 2.7.1 the default system codepage of the RTL can be changed to UTF-8 
(CP_UTF8)"
It should say:
"Since FPC 2.7.1 the default system codepage of the RTL *is* UTF-8 (CP_UTF8)"
That's contradicting to your cite and lets room for other interpretations.

Also, in other mails and wikis I read that cp_ACP *can* be UTF-8 (on windows) 
but it is not nessesarily so.
But how it is set to UTF-8 is left in the dark.



Then it explain the technical details how it was implemented.


This may be true for those who coded the new string mode
or those who wrote the wiki but not for the readers who
tries to find out without knowing it already.


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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-12 Thread Jürgen Hestermann

Am 2015-12-12 um 17:25 schrieb Juha Manninen:

On Sat, Dec 12, 2015 at 1:46 PM, Jürgen Hestermann
<juergen.hesterm...@gmx.de> wrote:

Otherwise we would not have this problem and could use UTF-8 as
a standard for everything.

What is the problem exactly?
Always call the Windows API 'W'-functions and use proper data types for them.
The dynamic string encoding and conversion will take care of everything else.



The problem is the "proper data type".

In the past I used UTF8String for all my strings
and converted to UTF-16 before feeding them into
Windows API 'W' functions.
That worked very well it was totally clear what happened.

Now these programs do not compile anymore
because UTF8Delete expects STRING and cannot
be used with UTF8String (which is realy rediculous:
a function which only works on UTF-8 strings but
refuses to work with type UTF8String).
I have now to move back to type STRING and
somehow (did not find out yet) tell the system
that STRING should be UTF-8 all the time.

To add to the confusion there are multiple global
code page variables which can be switched to UTF-8
but I don't know which to use and what side effekts each have.

Before FPC 3.0 everything was clear but now
I don't know how to do it.

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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-12 Thread Jürgen Hestermann

Am 2015-12-10 um 18:22 schrieb Juha Manninen:

On Thu, Dec 10, 2015 at 6:49 PM, Jürgen Hestermann
<juergen.hesterm...@gmx.de> wrote:

How can I use UTF8Delete on an UTF8string?

You can't. Please read this :
  http://wiki.freepascal.org/Better_Unicode_Support_in_Lazarus
"String" type is UTF-8 and it works now (almost) transparently without
explicit conversions.


Where do you read this?
I only found:

"Since FPC 2.7.1 the default system codepage of the RTL can be changed to UTF-8 
(CP_UTF8). So Windows users can now use UTF-8 strings in the RTL. "

It *can* be changed (but how?).

And what happens to the UTF8String type?
It can never be used anymore?
Why does it exist?

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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-12 Thread Jürgen Hestermann

Am 2015-12-12 um 19:00 schrieb Bart:
>> Then why does it say:
>> "Since FPC 2.7.1 the default system codepage of the RTL can be changed to 
UTF-8
>> (CP_UTF8)"
>> It should say:
>> "Since FPC 2.7.1 the default system codepage of the RTL *is* UTF-8 (CP_UTF8)"
> Why in the world would you think so?

Because Juha wrote:
> Please read this :
>   http://wiki.freepascal.org/Better_Unicode_Support_in_Lazarus
> "String" type is UTF-8 and it works now (almost) transparently without
> explicit conversions.

and

>The page says among other things :
> "The new mode is enabled automatically when compiling with FPC 3.0+."

That should tell me that STRING is now UTF-8 all the time.
And I wondered about the text in the wiki which says that it *can* be changed.
But if it not only can be changed but already *is* changed
then the wiki text needs a change too.

As said: The docu in the wikis is very confusing and contradicting,
fully understandable only for those who already know the details.

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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-11 Thread Jürgen Hestermann

>> For what else should I use UTF8delete if not for UTF8strings?
>For "UTF8 strings".
>An "UTF8String" and an "UTF8 String" are two different things for the
>compiler. See below.

 

What is the difference? The link does not tell me.

 

As fas as I know, there is no (useful) usage of LazUTF8-Routines

with strings of other encodings than UTF8.
So why is it used?

And was not the addition of encodings to strings

introduced to overcome all this encoding hassle?
So the FCL should be able to use a different encoding than the LazUTF8-Routines.
It makes no sence to use the LazUTF8-Routines for strings other than UTF8Strings.

Who would do this? The outcome would be an invalid UTF8String.

Therefore, whenever I use LazUTF8-Routines I would always

have an UTF8String to be manipulated and I am forced to do

conversions in any case anyway.

 


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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-11 Thread Jürgen Hestermann

>> >An "UTF8String" and an "UTF8 String" are two different things for the
>> >compiler. See below.
>> What is the difference? The link does not tell me.
>An "UTF8 String" is a String encoded in UTF-8.

>String and UTF8String are two different things for the compiler.

 

Of course String and UTF8String can be (but not neccesarily are) different, but you wrote:

" An "UTF8String" and an "UTF8 String" are two different things for the compiler. "
I know the type "UTF8String" but what is an "UTF8 String" (which you say differs)?

 


>My link explains some differences important for Lazarus.

 

But it does not explain the difference between an "UTF8String" and an "UTF8 String"

 

 

>The encoding hassle is built into Windows. The compiler cannot overcome
>it. It can only give you tools to make it easier.

 

That is not true.

Windows uses 2 kinds of strings: ANSI (one byte) and/or UTF16 (2 byte).
None of them can be used with UTF8 functions so a conversion is needed anyway.
Either I am forced to do this prior to using these UTF8 functions myself or (if possible)
the compiler/system routines can do this in the background.
Why was this not done?

 

There are procedures in LAZUTF8 that only work on UTF8Strings.
So why not force the parameters of these UTF8 routines to be UTF8Strings?
Anything else makes no sense because when feeding a non-UTF8-String
into such a routine that expects UTF8 leads to garbage.

 


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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-11 Thread Jürgen Hestermann

Am 2015-12-11 um 16:48 schrieb Graeme Geldenhuys:

On 2015-12-11 13:23, Mattias Gaertner wrote:

http://wiki.freepascal.org/Character_and_string_types

I haven't seen that page yet. That is a brilliant explanation of the
different string types. This really should live in the FPC Language Ref
document too.

Thanks for sharing. ;-)


Be aware that this wiki is outdated (not FPC 3.0).
It says:

Currently, the type *UTF8String* is an alias to the type *AnsiString 
*. It is 
meant to contain UTF8 encoded strings (i.e. unicode data) ranging from 1..4 bytes per 
character.

which is wrong.
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-11 Thread Jürgen Hestermann

Am 2015-12-11 um 16:28 schrieb Juha Manninen:

On Fri, Dec 11, 2015 at 4:20 PM, "Jürgen Hestermann"
<juergen.hesterm...@gmx.de> wrote:

I know the type "UTF8String" but what is an "UTF8 String" (which you say
differs)?

"UTF8 String" is a String which has UTF-8 encoding.
Our UTF-8 system changes the default codepage of String to UTF-8 and
then (almost) everything magically works.
Read the wiki page again.


type UTF8String = type ansistring(cp_UTF8)

Are there any other string types with UTF8 encoding in Free Pascal?
As far as I know it can only be this one.
So it should be used for all functions which require
an UTF8 string as parameter, no?
Any other encoding makes no sense (because these
UTF8 functions cannot be used with it).

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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-11 Thread Jürgen Hestermann

Am 2015-12-11 um 17:09 schrieb Mattias Gaertner:

On Fri, 11 Dec 2015 15:20:14 +0100
"Jürgen Hestermann" <juergen.hesterm...@gmx.de> wrote:


[...]

An "UTF8 String" is a String encoded in UTF-8.

[...]
I know the type "UTF8String" but what is an "UTF8 String" (which you say 
differs)?

You lost me here.

Maybe I can help you if you explain what you want to program and
why do you think that UTF8String is needed for that.


Just read my emails in this thread.
I have written it dozen of times:
I want to use UTF8Delete with an UTF8String (which seems
natural to me because that's what this function was made for).

And I am wondering why these functions in LazUTF8 unit
(which only work with UTF8 strings) do not use UTF8String
as parameter.


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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-11 Thread Jürgen Hestermann

UTF8Delete probably takes an AnsiString (or String) as var parameter and for var parameters the static codepages have to match exactly (String has CP_ACP while Utf8String has CP_UTF8).


 

Just please help me understanding this:

The unit LazUTF8 unit is for manipulating UTF8 strings only, correct?

Is there any reason that all functions are declared with

parameter type STRING instead of UTF8String?

For what else should I use UTF8delete if not for UTF8strings?

And what happens if the string has a different encoding than UTF8?

I doubt that the function will produce any useful result in this case

because it expects UTF8.



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


[Lazarus] UTF8String and UTF8Delete

2015-12-10 Thread Jürgen Hestermann

Today I tried Lazarus 1.6 RC1 (on Windows 7 32 bit).

The installation hat a problem with missing access rights.
I chose to uninstall the previous version but afterwards
some folders of fpc 2.4 still existed and I did not have
access rights to these folders. I am not sure whether
this was caused by Lazarus or by the crappy rights
management of Windows.
Well, in the end I could solve the problem.

But now I have a problem with UTF8Strings:
With this declaration

var S : UTF8String;

I want to delete a character

UTF8Delete(S,1,1);

but I get an error that the (var) parameter mismatches.
S is UTF8String but expected is AnsiString (I thought that
an AnsiString on its own no longer exists but that it has
to be declared with a codepage).
UTF8Delete is declared with a "string" parameter (I hate
these chameleons as I never know what they realy mean
in a certain case).

My question:
How can I use UTF8Delete on an UTF8string?



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


Re: [Lazarus] UTF8String and UTF8Delete

2015-12-10 Thread Jürgen Hestermann



Am 2015-12-10 um 18:22 schrieb Juha Manninen:

On Thu, Dec 10, 2015 at 6:49 PM, Jürgen Hestermann
<juergen.hesterm...@gmx.de> wrote:

How can I use UTF8Delete on an UTF8string?

You can't. Please read this :
  http://wiki.freepascal.org/Better_Unicode_Support_in_Lazarus
"String" type is UTF-8 and it works now (almost) transparently without
explicit conversions.


Then why does the compiler complain when I
feed UTF8Delete with an UTF8String?


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


Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Jürgen Hestermann

Am 2015-11-09 um 14:26 schrieb Sven Barth:


> The docs already note that the compiler uses a temporary register
> for 'With'.
> http://www.freepascal.org/docs-html/ref/refsu58.html#x155-16500013.2.8
> Of course if there is no register left the compiler uses the stack.

Please note that this is an implementation detail. The point a user should care 
about is that the expression of the with is evaluated only once (before the 
block of the with is entered). Everything else is up to the compiler.
(I would prefer if it wouldn't be mentioned as is in the documentation)



This information is very important IMO.
The programmer should know which coding has which performance.

The reason for many slow programs is that
the programmer(s) do not know about such details.
If i.e. a loop over a huge array can be speeded up with
a slight coding change  it should be done.
The attitude: "don't worry about the details" is wrong IMO.

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


Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Jürgen Hestermann

Am 2015-11-10 um 11:32 schrieb Sven Barth:

The user doesn't need to know the detail that the value is kept in a temporary 
register, because that statement by itself is utterly useless for the user, as 
on load/store architectures like ARM you /always/ have values in registers if 
they are worked with and the compiler will happily spill around the contents if 
necessary.


Does that mean, that local variables and with statements are treated completely 
identically?
Are both held in registers with the same mechanism and will there never be an 
(speed) adavantage of one of them?
If there is only the chance that it may speed up the code (even when only on 
certain platforms) then I would like to know it.

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


Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-07 Thread Jürgen Hestermann


Am 2015-11-06 um 18:26 schrieb Ondrej Pokorny:
> So yes, let's not use with :)
> ... There is no problem with long variable names at all. There are CodeTools 
:)

CodeTools do not help you *read* the code.

I prefer to have this:

-
with PathArray[High(PathArray)]^ do
   fillchar(StatisticOfFiles,sizeof(StatisticOfFiles),0);
-

instead of this:

-
fillchar(PathArray[High(PathArray)]^.StatisticOfFiles,sizeof(PathArray[High(PathArray)]^.StatisticOfFiles),0);
-

Also, the problem of the WITH statement is the same as for identifiers declared 
in other units.
Do you also preceed variables from a used unit with the unit name?



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


[Lazarus] VirtualTreeView, clicking to expand collapse only on works for first column

2015-11-03 Thread Jürgen Hestermann

In a VirtualTreeView I have icons to expand and collapse
subnodes (the + and - in a square).
When clicking on them with the mouse it only works
when the column with these icons is the first (left) column.
When I change the main column or when I move the first
column to the right (so that it's not the most left one anymore)
clicking on these icons does nothing.

Is this a known bug?

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


Re: [Lazarus] annoying (attn: Michael Schnell)

2015-10-26 Thread Jürgen Hestermann

Am 2015-10-26 um 11:36 schrieb Sven Barth:

If you look at this month's archive you'll see that it's only your mails that add this 
(see here: http://lists.lazarus.freepascal.org/pipermail/lazarus/2015-October/thread.html 
). Your mail today regarding the widgetset initialization added yet another 
"*SPAM*" for example.


This happens for my mails too.
The email provider GMX can be be configured
to detect SPAM (which is of course very unreliable)
and then there are multiple options:
Either I can let GMX move such mails to a special folder
or delete them or GMX adds "SPAM Spamverdacht" to the subject line.

The latter is the best for me because I am warned to have a
closer look but it does not move mails out of sight.
And there are lots of false positive which I would not see otherwise.

Of course, here in the mailing list it is annoying to have the subject line
messed up (but "Re" or "Antwort" do that too).

I have to pay more attention to this to remove this addition when replying

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


Re: [Lazarus] Working on big units

2015-10-24 Thread Jürgen Hestermann

Am 2015-10-24 um 17:50 schrieb Alexsander Rosa:

2015-10-22 13:11 GMT-02:00 Aradeonas >:

/
From my 600+ KLOC project:
Total Files:
961
Average File Size:
629,3 lines
Source: StatSVN report
/

How,Why?! ;)


How: coding this way since day one.
Why: IMHO it's easier to maintain.


I am currently working on a program where the main unit
has >20k lines but never found that the length is a problem.
Alt+G to find procedures/functions helps a lot,
Bookmarks can be used, Ctrl+F(ind) is there too
so I don't know why I should split the unit without need.
Just the opposite: Spreading the code over many files/units
makes it much harder to find something (at least it does not
make it easier IMO).
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] GetTextExtent on Windows

2015-09-14 Thread Jürgen Hestermann

Am 2015-09-13 um 22:09 schrieb Marc Weustink:


On September 12, 2015 2:12:32 PM GMT+02:00, "Jürgen Hestermann" 
<juergen.hesterm...@gmx.de> wrote:

I think many of my problems come from using this deprecated API
function.
Are there any plans to change this?

If you had a look at the win32 implementation of GetTextExtentPoint then you 
would have seen that GetTextExtentPoint32 is used internally.


Realy?
Where do you find this?
I only find the opposite.
When I follow where Canvas.TextWidth comes from
I end up on in this function from "canvas.inc" (line 1763):

function TCanvas.TextExtent(const Text: string): TSize;
begin
Result.cX := 0;
Result.cY := 0;
if Text='' then exit;
RequiredState([csHandleValid, csFontValid]);
GetTextExtentPoint(FHandle, PChar(Text), Length(Text), Result);
end;

Even more, there is a function declaration for "GetTextExtendPoint32"
but it still uses "GetTextExtendPoint" (line 1162 in "intfbasewinapi.inc"):

function TWidgetSet.GetTextExtentPoint32(DC: HDC; Str: PChar; Count: Integer; 
var Size: TSize): Boolean;
begin
Result := GetTextExtentPoint(DC,Str,Count,Size);
end;


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


[Lazarus] GetTextExtent on Windows

2015-09-12 Thread Jürgen Hestermann

I use "LCLIntf.DrawText" for drawing text on the screen and "Canvas.TextWidth"
to determine its width to increment a TRect for the next text output.
But these functions cause some trouble with drawing (UTF-8-) text on Windows.
In general it works okay but sometimes peculiar clipping or other pixel 
differences occur.
Are the functions above the correct ones to draw and measure text?

After looking a bit at the code I saw that in the file "intfbasewinapi.inc" 
almost
everywhere the Windows API function "GetTextExtentPoint" is used to determine 
text metrics.
But
https://msdn.microsoft.com/en-us/library/windows/desktop/dd144937%28v=vs.85%29.aspx
says:
"This function is provided only for compatibility with 16-bit versions of 
Windows.
Applications should call the *GetTextExtentPoint32* 

 function, which provides more accurate results."

I think many of my problems come from using this deprecated API function.
Are there any plans to change this?
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Run/Compile ignores changes in inline functions

2015-08-14 Thread Jürgen Hestermann

Am 2015-08-13 um 23:35 schrieb Sven Barth:

 Am 13.08.2015 12:48 schrieb Jürgen Hestermann juergen.hesterm...@gmx.de:
 
  It seems that if I change something within a function that is declared 
inline
  and I then use run/compile in Lazarus it does not rebuild this function.
  I have to use run/build to see my changes in the program.
  Is this a known issue?

 Does this also happen if you compile on the commandline using fpc directly? 
Which compiler version are you using?

I am using the standard Lazarus IDE 1.4.2 with FPC 2.6.4 (on Windows).
I have not tested this on the command line yet (I don't even know how to invoke 
it).

But maybe it was not precise what I wrote.
I am using the Run command (invoked with key) which IMO
does a Run/Compile with additonal start of the program.
The inline function is declared in one unit while it is called
in another unit. Maybe this plays a role here.

Now that I think about it it could be a problem of FPC, not Lazarus.
But I don't know how it works in the background.
The unit with the inline function seems to be recompiled but
not the unit(s) which use these functions.
Because of the nature of inline functions I would expect them
to be recompiled too.

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


Re: [Lazarus] Improving UTF8CharacterLength?

2015-08-13 Thread Jürgen Hestermann

Am 2015-08-09 um 14:31 schrieb Jürgen Hestermann:

I just had a closer look at the function UTF8CharacterLength in unit LazUTF8.
To me it looks as if it can be improved (made faster) because it checks too 
many things.

According to https://de.wikipedia.org/wiki/UTF-8 the number of bytes of an
UTF-8-character should be computable by the first byte only.
So it seems not to be neccessary to check for any following bytes (which also 
bears
the danger of accessing bytes out of the range of the string).
Isn't it enough to just do it like this:

--
if p=nil then
   exit(0);
if (ord(p^) and %1000)=% then // First bit is not set == 1 byte
   exit(1);
if (ord(p^) and %1110)=%1100 then // First 2 (of first 3) bits are set 
== 2 byte
   exit(2);
if (ord(p^) and %)=%1110 then // First 3 (of first 4) bits are set 
== 3 byte
   exit(3);
if (ord(p^) and %1000)=% then // First 4 (of first 5) bits are set 
== 4 byte
   exit(4);
exit(0); // invalid UTF-8 character
---

Currently, further bytes are checked even when
the first byte already determines the number of bytes.
But if the following bytes would not be as expected
it would not be a valid UTF-8-character.
But should this be checked by the UTF8CharacterLength function?
There is no error condition in the result of the function anyway.
I think errors should be checked when accessing the character as a whole.
Or is there any reason for handling invalid UTF-8-bytes more fault-tolerant?



Realy nobody has has an opinion to this topic?
Strange.
Well, I take this as an implicit answer that I did not make any error in 
reasoning.
I am now using my own UTF8CharacterLength but I thought others could make use 
of it too.


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


Re: [Lazarus] Improving UTF8CharacterLength?

2015-08-13 Thread Jürgen Hestermann

Am 2015-08-13 um 13:01 schrieb Mattias Gaertner:
 On Thu, 13 Aug 2015 12:38:00 +0200
 Jürgen Hestermann juergen.hesterm...@gmx.de wrote:
 Am 2015-08-13 um 11:55 schrieb Mattias Gaertner:
   A string always ends with a #0, so checking byte by byte makes sure you
   stay within range.
 Not quite true:
 
 if ((ord(p^) and %) = %1110) then
 begin  // could be 3 byte character
 if ((ord(p[1]) and %1100) = %1000) and
((ord(p[2]) and %1100) = %1000) then ...
 ...
 
 In the above (current) code 3 bytes are accessed which may step behind the 
zero byte.
 The and operator stops evaluating if left side is already false.

Only if you have a valid UTF-8 string.
I thought we are talking about *invalid* UTF-8 strings where
it can happen that p[2] is accessed although it is not part
of the string.



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


Re: [Lazarus] *** GMX Spamverdacht *** Re: *** GMX Spamverdacht *** Re: Improving UTF8CharacterLength?

2015-08-13 Thread Jürgen Hestermann

Am 2015-08-13 um 13:29 schrieb Michael Van Canneyt:



On Thu, 13 Aug 2015, Jürgen Hestermann wrote:


Am 2015-08-13 um 12:59 schrieb Michael Van Canneyt:



On Thu, 13 Aug 2015, Jürgen Hestermann wrote:


Determining the character length of a invalid UTF-8 string is quite useless.


Because it's not about getting a correct result then, but about not crashing 
due to invalid memory access.


But invalid memory access takes place anyway (within UTF8CharacterLength).


Why do you say so ? Unless you give a really bogus pointer, one of p[0] till 
p[3] is guaranteed to have #0 in it.
In such a case, no scan of the next byte is done ?


Sorry, I missinterpreted the code.
You are right.
I now see that the zero byte would stop any futher access to bytes after it.




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


[Lazarus] Error in UTF8CompareText comment

2015-08-13 Thread Jürgen Hestermann

There is a comment for UTF8CompareText in LazUTF8 which is contradictorily:

// Returns:  0 if S1  S2, 0 if S1 = S2,  0 if S2  S1.

But S1  S2 is the same as S2  S1.
In the first case the result should be  0 and in the second one  0.

It cannot even be retrieved from the code how it realy works (unless you are 
fit in assembler).
So when will the result be positive and when negative?


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


Re: [Lazarus] Improving UTF8CharacterLength?

2015-08-13 Thread Jürgen Hestermann

Am 2015-08-13 um 11:55 schrieb Mattias Gaertner:
 A string always ends with a #0, so checking byte by byte makes sure you
 stay within range.

Not quite true:

if ((ord(p^) and %) = %1110) then
   begin  // could be 3 byte character
   if ((ord(p[1]) and %1100) = %1000) and
  ((ord(p[2]) and %1100) = %1000) then ...
   ...

In the above (current) code 3 bytes are accessed which may step behind the zero 
byte.
UTF8CharacterLength raises an exception in this case because it does not check 
for string length (zero byte).


 If you only read the first byte of a codepoint to determine its length,
 you must check the length of the string.

Thats something that needs to be checked in all cases anyway.
So it's double code (in UTF8CharacterLength and in my program).
Also, as stated at the beginning, the code in UTF8CharacterLength does
not prevent from accessing bytes behind the last (zero) byte.


 The UTF8CharacterLength function handles invalid UTF-8 gracefully.

Not realy (see above).


 If you know that you have a valid UTF-8 string you can simply use the
 first byte of each codepoint (as you pointed out). So, for that case a
 faster function can be added.
 Maybe UTF8QuickCharLen or something like that.

Determining the character length of a invalid UTF-8 string is quite useless.
What do you do with such a result? IMO the UTF8CharacterLength
funtion should always assume a valid UTF-8 string.
Using this function on invalid UTF-8 strings lets you run into problems anyway.


  Isn't it enough to just do it like this:
 
  --
  if p=nil then
  exit(0);
  if (ord(p^) and %1000)=% then // First bit is not set == 1 
byte
  exit(1);
  if (ord(p^) and %1110)=%1100 then // First 2 (of first 3) bits are 
set == 2 byte
  exit(2);
  if (ord(p^) and %)=%1110 then // First 3 (of first 4) bits are 
set == 3 byte
  exit(3);
  if (ord(p^) and %1000)=% then // First 4 (of first 5) bits are 
set == 4 byte
  exit(4);
  exit(0); // invalid UTF-8 character
  ---
 Yes, although afaik the compiler can optimize a CASE better than a
 series of IFs.
 case p^ of
 #0..#127: exit(1);
 #192..#223: exit(2);
 #224..#239: exit(3);
 #240..#247: exit(4);
 else exit(0); // invalid UTF-8 character, should never happen
 end;

Realy? With the if statements only constants are used.
In the case statement you have ranges and I think that more
code is necessary to determine whether a value is whithin a range
than only checking whether it is a certain constant (or not).
But I don't know how far the compiler can optimze which cases
(which may also depend on the optimisation opition used).


 Note: because it is an optimized version the check for p=nil can be
 omitted.

Yes.


  Or is there any reason for handling invalid UTF-8-bytes more 
fault-tolerant?
 The last, more fault-tolerant.
 This allows to use the function like this:
 while p^#0 do begin
   CharLen:=UTF8CharacterLength(p);
   // ...
   inc(p,CharLen);
 end;
 This works even with invalid UTF8.

Not true (as stated at the beginning).
You may already get an exception within UTF8CharacterLength.

It makes no sense if you try to compensate one error (invalid UTF-8 string)
by another error (giving back wrong results of UTF8CharacterLength).
It will never result in a proper program.


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


Re: [Lazarus] Error in UTF8CompareText comment

2015-08-13 Thread Jürgen Hestermann

Am 2015-08-13 um 12:15 schrieb Mattias Gaertner:

On Thu, 13 Aug 2015 11:52:26 +0200
Jürgen Hestermann juergen.hesterm...@gmx.de wrote:


There is a comment for UTF8CompareText in LazUTF8 which is contradictorily:

// Returns:  0 if S1  S2, 0 if S1 = S2,  0 if S2  S1.

But S1  S2 is the same as S2  S1.

It should be 0 if S1  S2. I changed the comment.


Thanks.

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


[Lazarus] Run/Compile ignores changes in inline functions

2015-08-13 Thread Jürgen Hestermann

It seems that if I change something within a function that is declared inline
and I then use run/compile in Lazarus it does not rebuild this function.
I have to use run/build to see my changes in the program.
Is this a known issue?

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


Re: [Lazarus] *** GMX Spamverdacht *** Re: Improving UTF8CharacterLength?

2015-08-13 Thread Jürgen Hestermann

Am 2015-08-13 um 12:59 schrieb Michael Van Canneyt:



On Thu, 13 Aug 2015, Jürgen Hestermann wrote:


Determining the character length of a invalid UTF-8 string is quite useless.


Because it's not about getting a correct result then, but about not crashing 
due to invalid memory access.


But invalid memory access takes place anyway (within UTF8CharacterLength).
So what is gained?

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


Re: [Lazarus] Improving UTF8CharacterLength?

2015-08-13 Thread Jürgen Hestermann

Am 2015-08-13 um 13:01 schrieb Mattias Gaertner:

On Thu, 13 Aug 2015 12:38:00 +0200
Jürgen Hestermann juergen.hesterm...@gmx.de wrote:


Am 2015-08-13 um 11:55 schrieb Mattias Gaertner:
   A string always ends with a #0, so checking byte by byte makes sure you
   stay within range.

Not quite true:

if ((ord(p^) and %) = %1110) then
 begin  // could be 3 byte character
 if ((ord(p[1]) and %1100) = %1000) and
((ord(p[2]) and %1100) = %1000) then ...
 ...

In the above (current) code 3 bytes are accessed which may step behind the zero 
byte.

The and operator stops evaluating if left side is already false.


Yes, I see now that I somehow missinterpreted the code.
You are right that for the case that a zero byte exists
it would not access further bytes within UTF8CharacterLength.

Still I think it would be better to give back 3 in case the byte actually
means 3 because 1 byte does not form a valid UTF-8 character.
If I rely on this result I would try to use this 1 byte as a valid UTF-8 
character
which would be wrong so I have to apply further checks to cope with this 
situation anyway.
Then I can also check whether the 3 or 4 bytes of the correct result exist.
I would not loose anything for invalid UTF-8 strings but I would gain 
performance if
I can guarantee valid UTF-8 string.

And if no zero byte exists (for whatever reason) it currently fails anyway.


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


Re: [Lazarus] Improving UTF8CharacterLength?

2015-08-13 Thread Jürgen Hestermann

Am 2015-08-13 um 14:19 schrieb Mattias Gaertner:
 On Thu, 13 Aug 2015 14:05:19 +0200
 Jürgen Hestermann juergen.hesterm...@gmx.de wrote:
 Still I think it would be better to give back 3 in case the byte actually
 means 3 because 1 byte does not form a valid UTF-8 character.
 If I rely on this result I would try to use this 1 byte as a valid UTF-8 
character
 which would be wrong so I have to apply further checks to cope with this 
situation anyway.
 Do you mean like UTF8CharacterStrictLength?

I did not know that yet another quite similar function like 
UTF8CharacterStrictLength exists.
So many functions doing nearly the same thing is very confusing

If I am right (after a quick look) then UTF8CharacterStrictLength gives back 0
in cases where UTF8CharacterLength would give back 1.

IMO this does not change the underlying problem that if you have an invalid 
UTF-8
string then you cannot fix this situation within functions like 
UTF8CharacterLength
or UTF8CharacterStrictLength. There is no way around it other than:

1.) Make sure your strings are all valid UTF-8 or
2.) Do error checking and error handling in your program yourself

In both cases I think no further error handling is needed within such helper 
routines.


 Then I can also check whether the 3 or 4 bytes of the correct result exist.
 I would not loose anything for invalid UTF-8 strings but I would gain 
performance if
 I can guarantee valid UTF-8 string.
 For this the UTF8QuickCharLen function would suffice, would it not?

Yes, of course.
Although I am wondering whether yet another function needs to be added.
To have an overview over all the UTF-8 functions is already quite complex
and I still think that error checking should not be part of such helper 
functions
so that only one is needed.


 And if no zero byte exists (for whatever reason) it currently fails anyway.
 Till now the Lazarus code didn't have such a case.

Yes, maybe it's quite unlikely to have such a situation.
If a pchar pointer points to arbitrary data it will be impossible to cope with 
this situation anyway.


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


[Lazarus] Improving UTF8CharacterLength?

2015-08-09 Thread Jürgen Hestermann

I just had a closer look at the function UTF8CharacterLength in unit LazUTF8.
To me it looks as if it can be improved (made faster) because it checks too 
many things.

According to https://de.wikipedia.org/wiki/UTF-8 the number of bytes of an
UTF-8-character should be computable by the first byte only.
So it seems not to be neccessary to check for any following bytes (which also 
bears
the danger of accessing bytes out of the range of the string).
Isn't it enough to just do it like this:

--
if p=nil then
   exit(0);
if (ord(p^) and %1000)=% then // First bit is not set == 1 byte
   exit(1);
if (ord(p^) and %1110)=%1100 then // First 2 (of first 3) bits are set 
== 2 byte
   exit(2);
if (ord(p^) and %)=%1110 then // First 3 (of first 4) bits are set 
== 3 byte
   exit(3);
if (ord(p^) and %1000)=% then // First 4 (of first 5) bits are set 
== 4 byte
   exit(4);
exit(0); // invalid UTF-8 character
---

Currently, further bytes are checked even when
the first byte already determines the number of bytes.
But if the following bytes would not be as expected
it would not be a valid UTF-8-character.
But should this be checked by the UTF8CharacterLength function?
There is no error condition in the result of the function anyway.
I think errors should be checked when accessing the character as a whole.
Or is there any reason for handling invalid UTF-8-bytes more fault-tolerant?


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


Re: [Lazarus] *** GMX Spamverdacht *** Re: TEdit: Find character at caret position

2015-08-03 Thread Jürgen Hestermann

Am 2015-08-02 um 20:32 schrieb Howard Page-Clark:
 On 02/08/2015 18:33, Jürgen Hestermann wrote:
 In a TEdit component, how do I find out which character is at the
 caret/cursor position?
 Or in other words: At which (string) position will the next typed
 character be inserted?
 I want to insert text at just that position myself but cannot find out
 where this (character) position would be.

 Edit1.SelStart gives the character position of the caret/cursor. The next 
typed character is inserted at Succ(Edit1.SelStart).

Sure? I thought SelStart gives the start of the selected text, not of the 
cursor.


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


[Lazarus] How to detect that the Alt-key is released?

2015-08-02 Thread Jürgen Hestermann

According to http://wiki.lazarus.freepascal.org/LCL_Key_Handling
the KeyUp event should be triggered when the Alt-key is released.

But how do I tell this procedure that I want to check for the Alt-key?
The key parameter is of type word.
What is the representation of the Alt-key here?
vk_alt does not exist.

And how about the Shift parameter?
It would tell me whether Alt is currently pressed or not
but not whether it has been released.

A bit confusing
Anybody knows how it works?


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


Re: [Lazarus] How to detect that the Alt-key is released?

2015-08-02 Thread Jürgen Hestermann

Am 2015-08-02 um 14:33 schrieb JuuS:

(btw. this WON'T work in onkeyup with just the alt key...when you lift
alt (ie, keyup) it is no longer down and so is not in Shift, to see it
work do something like alt-a).


But that's just what I want:
Detect the release of the Alt+key (independend from other keys state).

So it's not possible?

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


[Lazarus] Fwd: Re: How to detect that the Alt-key is released?

2015-08-02 Thread Jürgen Hestermann

Am 2015-08-02 um 14:42 schrieb Jürgen Hestermann:
 Am 2015-08-02 um 14:33 schrieb JuuS:
 (btw. this WON'T work in onkeyup with just the alt key...when you lift
 alt (ie, keyup) it is no longer down and so is not in Shift, to see it
 work do something like alt-a).
 But that's just what I want:
 Detect the release of the Alt+key (independend from other keys state).
 So it's not possible?

Well, I just found out how it works myself:

---
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key=vk_Menu then
   ShowMessage(' ALT key released');
end;
---

The main point I missed was that I did not know that the Alt-key is vk_Menu.
A strange name for the Alt-key. ;-(

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


[Lazarus] TEdit: Find character at caret position

2015-08-02 Thread Jürgen Hestermann

In a TEdit component, how do I find out which character is at the caret/cursor 
position?
Or in other words: At which (string) position will the next typed character be 
inserted?
I want to insert text at just that position myself but cannot find out where 
this (character) position would be.

Any help appreciated.

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


Re: [Lazarus] Ways of making new style design

2015-06-18 Thread Jürgen Hestermann

Am 2015-06-18 um 18:22 schrieb aradeonas:
 and if making beautiful new age app was easy with
 Lazarus or your library for sure I didn't looking for slow way.

Beauty is very subjective.
I see the beauty in programs that respond and process data with
high speed and have a clear minimalistic user interface without any 
distractions.
I would not want a toy program that is meant for kids in the first place
so that it looks more like a game than like a serious tool.

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


Re: [Lazarus] Formkeydown

2015-06-12 Thread Jürgen Hestermann

Am 2015-06-12 um 15:08 schrieb Larry Dalton:
 The following worked fine in Delphi. I can't get it to work in Lazarus. Tips, 
please!
What is the problem?

 const FunctionKeys:array[vk_f1..vk_f12] of string[3]= 
('F1','F2','F3','F4','F5','F6','F7','F8','F9','F10','F11','F12');
Where do you use FunctionKeys?

 if messagedlg('Home Key Pressed',mtconfirmation,[mbok],0)=mrok then
top:=0;left:=0;vertscrollbar.Position:=0;
What is intended here? Only the first statement (top:=0) is omitted when the 
IF statement is false.
All others are executed in all cases.

 horzscrollbar.Position:=0; }
What comment ends here?


Why not use a case statement instead of the many IF statements?
For example:

---
Case Key of
   vk_f1 : agentbuttonclick(application);
   vk_f2 : custom_form.CreateCar('Cars');
   vk_f3 : custom_form.CreateDeal('Deal');
   vk_f4 : f4panelclick(application);
   vk_f5 : custom_form.CreateAgent('Insurance Agent');
   vk_f6 : custom_form.CreatePreset('Presets');
   vk_f7 : custom_form.CreatePrinter('Print Forms');
   vk_f8 : begin 
custom_form.F8PanelClick(application);top:=0;left:=0;vertscrollbar.Position:=0;end;
   vk_f9 : custom_form.F9Panelclick(application);
   vk_f10 : sendnamebuttonclick(application);
   vk_home :
  begin
  if messagedlg('Home Key Pressed',mtconfirmation,[mbok],0)=mrok then
 top:=0;
  left:=0;
  vertscrollbar.Position:=0;
  horzscrollbar.Position:=0;
  end;
   end; // of case


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


[Lazarus] Open handles on USB drives (Windows)

2015-06-06 Thread Jürgen Hestermann

Very often when I debug a program with Lazarusand have connected an external
USB drive and then want to eject the external USB drive I get an “in use” error.
When looking with Unlocker it is always Lazarus who has open handles to this 
drive (root)
although it has nothing to do with it. Even drives on different drive letters 
are affected by this.
Does Lazarus open handles for each and every drive letter it finds (on Windows)?
If yes, why?

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


[Lazarus] record initialization

2015-05-30 Thread Jürgen Hestermann

when I try to initialize a record as in


var X : record
A : Sizeint;
B : boolean;
C : Sizeint;
D : boolean;
E : Sizeint;
F : boolean;
G : Sizeint;
H : boolean;
end = (A : 0;
   B : false;
   C : 0;
   D : boolean;
   E : 0;
   F : false;
   G : 0;
   H : false);


then this works as expected.
When omitting some entries from the end it works too:


var X : record
A : Sizeint;
B : boolean;
C : Sizeint;
D : boolean;
E : Sizeint;
F : boolean;
G : Sizeint;
H : boolean;
end = (A : 0;
   B : false;
   C : 0;
   D : boolean;
   E : 0);


I only get a warning, thatSome fields coming after E weren't initialized.

But when I leave out variables in the middle or at the beginning as in:


var X : record
A : Sizeint;
B : boolean;
C : Sizeint;
D : boolean;
E : Sizeint;
F : boolean;
G : Sizeint;
H : boolean;
end = (B : false;
   C : 0;
   D : boolean;
   H : false);


then I get an error Some fields coming before B weren't initialized and it 
does not compile.

I found no words about this restriction in 
http://www.freepascal.org/docs-html/ref/refse23.html
Shouldn't it appear there?
It took me quite a while to find out why it did not compile
because omitting from the end works so why does it not work
when omitting from the beginning (or in the middle)?



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


Re: [Lazarus] Date value 0

2015-05-28 Thread Jürgen Hestermann


Am 2015-05-28 um 17:14 schrieb waldo kitty:

i don't know why it isn't confident... am is morning so 12am is the very first 
entry into morning as 12pm is the very first entry into afternoon...
i don't understand the confusion or the problem...



So the day starts with 12 at midnight and then switches to 1 an hour later?
If that isn't confusing...

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


[Lazarus] ShowMessage-Window size on newer versions of Windows

2015-04-23 Thread Jürgen Hestermann

When I use ShowMessage then often long file names (or other text)
require to break them into lines. I use a function for this.
But since Windows 8 (or maybe other versions of Windows too) the size
of the WidgetSet-Window is of fixed size (instead of that it widens to
the longest line in the window as it was before). This is a completely
nonsense-change! Who is doing all these bullshit API changes at MS?
I don't get it.

Today I stumbled about this web page
http://zarko-gajic.iz.hr/displaying-long-non-breakable-text-file-path-in-messagedlg-truncationellipsis-issues/
where the author complains in the same way about this issue
but offers a workarounds (but only for Delphi).

My question:
Is this workaround (usage of old style message windows)
available in Lazarus too?
If yes, how?
If no, can it be added?

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


Re: [Lazarus] Hide mouse cursor while typing

2015-03-24 Thread Jürgen Hestermann


Am 2015-03-24 um 12:53 schrieb Graeme Geldenhuys:

Is there an option to hide the mouse cursor while I'm typing?


Even better would be to only show the mouse cursor when the mouse is moving 
(and a small delay time after stopping).
Of what use is a mouse cursor when not using the mouse?
I programmed it this way in one of my program and it is a boon!


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


Re: [Lazarus] Compare record

2015-03-11 Thread Jürgen Hestermann

Am 2015-03-10 um 22:23 schrieb aradeonas:
 How can I compare two record?
 Like this :
 type
 TRec=record
 na:string;
 end;

 var
 R1,R2:TRec;
 Begin
 R1.na:='A';
 R2.na:='B';

 if R1R2 then
 Showmessage('Error')

In your example you would not need the record
if it consists of only one string component.
But you can write:

if R1.naR2.na then
   Showmessage('Error')

In general there cannot be a standard
compare function for records because
you can have a lot of different types
within a record. So you need to write
your own compare function.

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


Re: [Lazarus] Lazarus Release Candidate 1 of 1.4. Message cannot be stopped

2015-03-04 Thread Jürgen Hestermann

I use Lazarus V1.4RC1 on Win7 and today I had a strange situation:

I started to build and run an application with F9.
But my machine was quite slow so nothing (visible)
happened for many seconds.
It could be that I then hit F9 again.
After a while I got an error message saying:

Stop current debugging and rebuild project?

But this message could not be stopped.
Clicking on Yes or No had no effect.
The message stayed (or reappeared quickly).
I had to exit from Lazarus and restart  it to be able to continue.

Maybe someone can fix this easily.


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


[Lazarus] Typecast set to byte in mode OBJFPC

2014-12-31 Thread Jürgen Hestermann

I have a unit that is compiling in DELPHI mode
but now wanted to change it to OBJFPC mode
(in DELPHI mode I cannot use binary constants %10011100).

But OBJFPC mode I get an illegal type conversion with the following code:

---
type FlagType= (Flag1,Flag2);
 FlagSetType   = set of FlagType;
var i : SizeInt;
  S : FlagSetTyp;

S := [Flag1];
i := byte(S); //  Error illegal type conversion
---

Any idea how to convince the compiler to typecast
the set to byte in OBJFPC mode too?

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


Re: [Lazarus] Typecast set to byte in mode OBJFPC

2014-12-31 Thread Jürgen Hestermann


Am 2014-12-31 um 16:40 schrieb Jürgen Hestermann:

---
type FlagType= (Flag1,Flag2);
 FlagSetType   = set of FlagType;
var i : SizeInt;
  S : FlagSetTyp;

S := [Flag1];
i := byte(S); //  Error illegal type conversion
---


I have already found a solution:

i := SizeInt(S);

works (although I don't know why this is accepted but byte(S) is not).

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


  1   2   3   4   5   >