Re: [Lazarus] storing big dynamic matrices in file ?

2023-08-27 Thread R.Smith via lazarus

On 2023/08/27 21:46, Etienne Leblois via lazarus wrote:

Dear all,

I want to manipulate, store, later retrieve, 2-dimensions matrices of 
single or double ;


matrices may turn big and I wanted to turn to dynamic array of array

the basic solution below works, but storing (and retrieval) of big 
matrices is VERY slow.


any hint on the good way to make things quick ?



Hi Etienne,

There are two things in the method that are horribly slow, and can be 
improved by several orders of magnitude.


First problem is the method of sizing and assigning values to the 
Matrix, thought his is only about twice as slow as it could be. Second 
problem is using millions of individual file-writes - that goes horribly 
slow even on a very fast SSD. It can (and should) be done using only 1 
write.


To show the timings of the method you've used and the proposed better 
method, I've made a short program (see below) so you can run it 
yourself, where I simply named the two methods Old-way and New-way.
Your way (old way) takes 1.032 seconds to fill the data, and 6 minutes 
and 13.702 seconds to write it to disk on my relatively fast machine 
with fast SSD drive.
The good way (new way) takes 0.685 of a second to fill the data and 
0.315 of a second to write it to disk - i.e. near instant, thousands of 
times faster.


Your mileage may vary based on what kind of drive, speed, drive-cache, 
etc. you run - but simply take the code and try it.
Everything used is standard FPC code with only "Classes" and "SysUtils" 
units used - nothing fancy, no special libraries or tools.



   program lm;

   {$R *.res}

   uses Classes, SysUtils;


   const matrixSize = 1;

   var
  dt, bt, wt : TDateTime;



   procedure oldWay;
   var
  fsingle : file of single;
  m   : array of array of single;
  i,j,n   : Integer;
   begin
  dt := Now();
  n  := matrixSize;
  m  := nil;

  // I like i and j to run in 1..n, so I accept to loose line and
   column 0
  setlength(m, 1 + n, 1 + n);

  for i := 1 to n do for j := 1 to n do M[i, j] := random();
  bt := Now();

  assignfile(fsingle, 'single_test_old.bin');
  rewrite(fsingle);
  for i := 1 to n do for j := 1 to n do write(fsingle, M[i, j]);
  closefile(fsingle);
  wt := Now();

   end;



   procedure newWay;
   var
  a : array of single;
  i,j,n : Int64;

  aIdx,
  aFullSize : Int64;
  FS    : TFileStream;

   begin
  dt := Now();
  n  := matrixSize;
  a  := nil;
  aFullSize :=  n * n;
  SetLength(a, aFullSize);

  for i := 0 to (n - 1) do for j := 0 to (n - 1) do begin
    aIdx := (i * n) + j;
    a[aIdx] := random();
  end;
  bt := Now();

  FS := TFileStream.Create('single_test_new.bin', fmCreate or
   fmShareDenyWrite);
  FS.WriteBuffer(a[0], aFullSize * SizeOf(Single));
  FS.Free;
  wt := Now();

   end;




   begin

  WriteLn();
  WriteLn('Doing the old way...');
  oldWay;
  WriteLn('  Old way matrix assignment time: ',
   FormatDateTime('hh:nn:ss.zzz', bt - dt));
  WriteLn('  Old way File-Write time: ',   
   FormatDateTime('hh:nn:ss.zzz', wt - bt));


  WriteLn();
  WriteLn('Doing the new way...');
  newWay;
  WriteLn('  New way matrix assignment time: ',
   FormatDateTime('hh:nn:ss.zzz', bt - dt));
  WriteLn('  New way File-Write time: ',   
   FormatDateTime('hh:nn:ss.zzz', wt - bt));


  ReadLn();
   end.


PS: To get an index into the a matrix-array from the i and j values is 
easy - as done above:

    aIdx := (i * n) + j;
 and to get the i and j values from the index, you can simply do:
    i := (aIdx div n);
    j := (aIdx mod n);

Unfortunately, this requires using proper Zero-based indexing, else the 
formulae get unnecessarily complicated.


Reading the data from the file back into the Matrix array is as easy as:

  FS := TFileStream.Create('single_test_new.bin', fmOpenRead or 
fmShareDenyWrite);

  FS.ReadBuffer(a[0], aFullSize * SizeOf(Single));
  FS.Free;

Hope that answers the question.

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


Re: [Lazarus] Canvas.TextRec aligns to canvas and not rectangle for tlTop and taLeftJustify.

2023-02-19 Thread R.Smith via lazarus

On 2023/02/19 13:39, Werner Pamler via lazarus wrote:


Please don't change this - it will break numerous code.



I agree with Werner, God knows why it's done that way, but it is, and 
changing it will surely break almost every application project I have. 
Please don't.



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


Re: [Lazarus] TListView: Column Header Captions and Column Sorting

2022-11-17 Thread R.Smith via lazarus


On 2022/11/17 13:47, Aruna Hewapathirane via lazarus wrote:
On Thu, Nov 17, 2022 at 6:39 AM Michael Van Canneyt via lazarus 
 wrote:





Var
   aCol : TListviewColumn;

begin
   aCol:=Listview1.Columns.Add;
   aCol.Caption:='Country';
   aCol:=Listview1.Columns.Add;
   aCol.Caption:='Region';
end;


Ah.. I am now beginning to understand. So you get the column into a 
variable then use the variable to access and

set any properties?   Thank you so much for your time Michael.


Not necessarily - it's not forcibly commanded to be done like that, it's 
just an easier, faster (to program) and more homogenous way of doing. 
This next version of the same code will also work just fine, but it 
requires you to keep track of numbering, which is mental load you do not 
need, and also makes it hard to insert/delete code rows, since you have 
to adjust all the column numbers above and below the affected row:


begin
   Listview1.Columns.Add;
   Listview1.Columns[0].Caption:='Country';
   Listview1.Columns.Add;
   Listview1.Columns[1].Caption:='Region';
end;

So out of programming paradigm interest, yes this can work, but 
Michael's example is by far the more sensible preferred way of doing it.






I just want to say this has to be the fastest support I have ever 
received and always with a response that
is a concrete solution effectively diminishing the barriers for entry 
for newcomers. I am extremely grateful and humbled.



That's appreciated - also note, in light of your next question, the 
TListView docs, available both in the online Wiki 
(https://wiki.freepascal.org/TListView - though it is quite lacking in 
useful examples currently), the online Docs with short but clear 
function descriptions (see here: 
https://lazarus-ccr.sourceforge.io/docs/lcl/comctrls/tlistview.html and 
here: 
https://lazarus-ccr.sourceforge.io/docs/lcl/comctrls/tlistitems.html) 
and bundled in the install (though there is a slight trick to make it 
work on Windows since it dropped automatic support for help files (.hlp? 
.chm? - I forget the extension on windows))


The Lazarus Forum is usually also a trove of examples (ex: 
https://forum.lazarus.freepascal.org/index.php?topic=11796.0) and a good 
place to ask questions.


Welcome to FPC/Lazarus and good luck!

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


Re: [Lazarus] Lazarus 2.2 and FormResize

2022-06-28 Thread R.Smith via lazarus
Amazing coincidence, I just ran into this yesterday and contemplated 
posting about it.


The behaviour now seems as if for a "OnAfterResize" type of event - and 
it's great to have - but on occasion you really want to resize form 
internals during a resize operation by the user.


In my case, I have a form with 2 panels [alLeft, alClient] on it that I 
resize to 50% (by changing the width of the alLeft-aligned panel) when 
the form resizes. If the form was quite large and thus the panels are 
both large, then the user grabs the form-edge and drag it smaller, the 
alClient-aligned panel will resize into nothingness and the other panel 
become partly hidden (when the form becomes smaller than its original 
size, until the user releases the mouse at which point the event fire 
and they jump back to size.


To be clear - it's a fantastic feature to have, I've often wished for an 
OnAfterResize type event, and will mostly use it so, but in some cases 
would want the old behaviour. Perhaps if there was some way to change 
that for a form? A new property perhaps, or even a programmatically 
selectable variable or such.


I'm happy to say in the form's OnCreate() event for the form, or even 
application-wide if need be:

  formContinuousResize := True;

or whatever sounds feasible.


On 2022/06/28 09:03, Luca Olivetti via lazarus wrote:
With Lazarus 2.0.12 the OnResize event for a form was fired while 
resizing, but in 2.2.2 it's fired only when the resizing is done (only 
under windows, under linux it behaves the same as before).
However, if I put, say, a panel with top,left,bottom,right anchoring, 
its OnResize event is fired while resizing.

Is there a way to restore the previous behaviour for a form?

Bye

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


Re: [Lazarus] Lazarus GTK clears clipboard on exit

2022-04-22 Thread R.Smith via lazarus

On 2022/04/22 12:54, John Landmesser via lazarus wrote:

I'm fighting with google-chrome-stable on Manjaro Linux XFCE that clears
clipboard history when closed.
...
I rember, but not shure, that this behaviour of an application is
"usual" on linux??



It's Arch + X11, so yes, because of this:
https://wiki.archlinux.org/title/clipboard

i.e. There is no real "clipbaord" space, "Copy" is handled more like a 
"Promise-to-send-if-asked", but if asked after you are dead, then 
fulfilling that promise is hard.


Best option is to install one of the myriad of clipboard managers. They 
persist the copied data in local buffers and promise it forward.





Firefox for example is not doing this ...


That's because Firefox never really fully exits, its clipboard manager 
remains, I believe. They solved this their way because they encountered 
this same problem even on Ubuntu some years ago, used to be a known 
irritating bug that Firefox specifically "lost the clipboard contents" 
after exiting.

Ref: https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/21202




Tipps are welcome

As stated before, a clipboard maanger is the only real option. A Google 
search for this specifically should be very fruitful.



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


Re: [Lazarus] DCPcrypt: a package looking for a new maintainer

2022-01-15 Thread R.Smith via lazarus

On 2021/11/22 19:49, Bart via lazarus wrote:

Hi,

The DCPcrypt package (see:
https://wiki.lazarus.freepascal.org/DCPcrypt) does not have a
maintainer anymore.
Graeme unfortunately had to give up (as he pointed out: not by choice,
but by circumstances).

Is there anybody out there who is interested (and feels capable) in
maintaining that package?



I'm just always using the Hashlib4PascalPackage.
Is DCPcrypt better?

If so, who maintains Hashlib4Pascal - maybe it can be combined into a 
single better version, or


If not, maybe just deprecate it and suggest using hashlib in future?


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


Re: [Lazarus] How to convert Delphi program with TRichEdit?

2021-12-08 Thread R.Smith via lazarus

On 2021/12/08 22:44, Bo Berglund via lazarus wrote:

I need to port an old Delphi program to FPC/Lazarus and it contains two
TRichEdit components.

When I try to open the form in Lazarus 2.0.12 on Windows 10 with Fpc 3.2.0 I get
an error because the TRichEdit component does not exist

Is there some non-standard package I could install (from  OLPM or similar) in
order to get it working again?


Not really. The problem is TRichEdit was just a wrapper for the MS 
Windows RichEdit component, which was born before the days of HTML 
componenets, so far inferior to anything new. It does not exist anywhere 
else in the world and so not useful on a cross-platform development 
system. Not sure if anybody reverse-engineered the RichEdit 
functionality, but if Google doesn't know then I am relatively sure 
there isn't.





I have a new laptop now and I have no new Delphi version installed (except for
Delphi 7 with the no-nonsense license). I am only using Fpc + Lazarus nowadays.

Another question while I am here:
-

The form I have problems with is a special calculation sheet in one single form,
which is part of the source program.
But I only need to port this form into the new Lazarus program so I tried to
create a new program from scratch and intended to replace the default form as
the main form.
But I don't know really how to do this...

So How can I:

1) Replace the main form of a Lazarus program with another form?
or
2) Create a new program in Lazarus where I can specify an existing form as the
main program form.

Either of these will work, but I don't really know how to do any of them.


This is quick to do -
via the GUI:

In the Project Options, simply go to "Forms" and make sure the topmost 
one is the one you want to load as your main form.


via Code:

Open the program file (Project --> View Source) and make sure in the 
code section the very first "Application.CreateForm(...)" that appears 
is the one for your desired main form.


Basically TApplication regards the first form it opens as the "main" 
form, which simply means that that form is shown automatically first 
(unless specified not to) and that it will exit when that form closes 
(and a few more small things).



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


Re: [Lazarus] Assigning Class to object

2021-12-05 Thread R.Smith via lazarus
> if I call the following procedure with either a TButton or Panel ctrl 
(for example), how can I use the class info contained within the MyObj 
to choose the correct Class


Two things,

Firstly the correct way of determinig class (as with your current 
solution) is like this:


  if (MyObj is TButton) then TButton(MyObj).OnMouseDown := tmethod (not 
important here)  else
  if (MyObj is TPanel)  then TPanel(MyObj).OnMouseDown := tmethod (not 
important here)  else

  //  etc...

If you want to change a property/method of many descendants of class 
which all contain the same property, that is quite easy and what object 
orientation is great at, but you have to figure out what is the most 
recent ancestor class that is the ancestor of all the classes that you 
wish to treat similarly, AND if the property(ies) are defined in the 
ancestor or higher.  This is trivial to do just looking through the FPC 
help/documentation pages for the classes in question.


In the case you describe, from memory I believe TControl is the 
recent-most ancestor of both those classes that already has the 
OnMouseDown event defined, so this should work:


procedure SetThis( MyObj :TObject );
begin
  TControl(MyObj).OnMouseDown := @someMouseDownMethod;
end;


HTH.



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


Re: [Lazarus] up with Lazarus !

2021-12-01 Thread R.Smith via lazarus

Sounds like you were pressured into making a joke...

On 2021/12/02 00:04, Sergey Bodrov via lazarus wrote:

Pascal walks into a bar
There are 100 000 Pascals in the bar!

Sorry, i am drunk. Keep bugs out of Lazarus!

On Wed, Dec 1, 2021, 14:13 Etienne Leblois via lazarus 
 wrote:


We love Lazarus and Pascal programming and anyone's best effort on
this
is deeply acknowledged.

Let us stick to the topic that unites us.

Etienne

-- 
___

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

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


Re: [Lazarus] Lazarus 2.0.12 on Windows x64 cannot build command line program, complains about missing GUI symbols

2021-09-12 Thread R.Smith via lazarus
Either remove any Indy units added automatically to your main program's 
uses clause (namely IdFTP,IdFTPCommon - it's not needed there, maybe 
IniFiles too), or simply add the "Interfaces" unit to your uses clause 
(preferably at the start).



On 2021/09/11 22:33, Bo Berglund via lazarus wrote:

I have created a very simple program which is supposed to send a backup zipfile
to a webserver by FTP. I am used to Indy so I use TIdFTP as the object for this
transfer.
I started in lazarus by creating a new program which gave me a very sparse
skeleton only adding Classes as used unit.
I added indylaz to the project dependencies and the uses clause as shown below.

So now I wrote my code and checked it using Run/QuickCompile and it succeeds.
So I tried Run/Compile and get 50 errors, same with Run/Build...

And the error messages are completely wild, here are a few of them:

Compile Project, Target: FtpXferDb.exe: Exit code 1, Errors: 50
Error: Undefined symbol: WSRegisterCustomPage
Error: Undefined symbol: WSRegisterCustomNotebook
Error: Undefined symbol: WSRegisterCustomImageListResolution
Error: Undefined symbol: WSRegisterMenuItem
Error: Undefined symbol: WSRegisterMenu
Error: Undefined symbol: WSRegisterMainMenu
Error: Undefined symbol: WSRegisterPopupMenu
Error: Undefined symbol: WSRegisterDragImageListResolution
Error: Undefined symbol: WSRegisterLazAccessibleObject
Error: Undefined symbol: WSRegisterControl
Error: Undefined symbol: WSRegisterWinControl

Error: Undefined symbol: WSRegisterStatusBar
Error: Undefined symbol: WSRegisterTabSheet
Error: Undefined symbol: WSRegisterPageControl
Error: Undefined symbol: WSRegisterCustomListView
Error: Undefined symbol: WSRegisterCustomProgressBar
Error: Undefined symbol: WSRegisterCustomUpDown
Error: Undefined symbol: WSRegisterCustomToolButton

Everything seems to be about GUI stuff which I do not use at all!
This is a command line program

What can I do to remedy this?

This is my uses clause:

uses
   {$IFDEF UNIX}{$IFDEF UseCThreads}
   cthreads,
   {$ENDIF}{$ENDIF}
   Classes,
   indylaz,
   { you can add units after this }
   SysUtils,
   IniFiles,
   IdFTP,
   IdFTPCommon;



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


Re: [Lazarus] Lazarus for writing 3D Desktop Environment/Window manager for Linux?

2021-06-24 Thread R.Smith via lazarus

On 2021/06/24 14:52, Chavoux Luyt via lazarus wrote:


Questions:

 1. Is it possible to write a 3D desktop environment (with similar
functionality to KDE/Gnome) in Lazarus?
 2. Is Lazarus a good tool for writing such a desktop environment?
Why/why not?
 3. Are there better alternatives that can use OpenGL (or a game
engine using OpenGL) that can be used for writing such a Desktop
Environment (if Lazarus is not a good tool)?
 4. I have installed (but never used) Castle Game Engine (using
aptitude... but I don't see it in Lazarus). Does anyone here have
experience using it? Could it be used as the basis of writing a 3D
"desktop environment"?
 5. Is there anybody on the list that would be interested in helping
to write this as a new type of user OS GUI for Linux? Maybe as the
start of a future GSoC project?


It's certainly possible.

I used to play with this long ago when they made a 3D desktop on WIndows 
98 still - was called 3DNA and the link below here is a recent review of it.

https://www.youtube.com/watch?v=f-0WZJrISYc

It looks simplistic by today's standards but it was much better than wat 
the 3D bob thing on the windows store tries to do (which I also tried 
and hated). You may get a good few ideas for how a 3D space could be 
less finicky and more useable.


Unfortunately my hands are a bit full to devote much time to it, but 
wouldn't mind chipping in some and most certainly would be a user/tester.


Good luck with it!


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


Re: [Lazarus] How to save screenshot to jpg and png format files

2021-04-29 Thread R.Smith via lazarus

On 2021/04/29 17:49, Bo Berglund via lazarus wrote:

I have an application which can capture a regon of the desktop into an image.
It uses TBgraBitmap since it has a method for grabbing data from the screen.

So I can assign this to the clipboard and also save to a file:

var
   MyCapture : TBgraBitmap;
   Clip: TRect;
   ...
begin
   ...
   Clip := Bounds(Self.Left, Self.Top, Self.Width, Self.Height);
   MyCapture := TBgraBitmap.Create();
   MyCapture.TakeScreenShot(Clip);
   Clipboard.Assign(MyCapture.Bitmap);
   MyCapture.Bitmap.SaveToFile(ChangeFileExt(ParamStr(0), '.jpg'));
   MyCapture.Free;
   ...
end;

But the SaveToFile results in a file that is NOT a jpeg file at all...

How could I save it to a specific (known) format, like jpg or png?

Essentially you are asking a BGRA Bitmap to save itself to file, it is 
irrelevant whether the file ends in .jpg or .moonmission (although a 
TPicture or some custom image components may check the file extension).


What you need is to create a JPEG object, put the data in it and then 
use its JPEG-machinery to save the file.


I haven't tested this, typing from my head so may make syntax errors or 
such, but the idea is sound:


var
  jpg : TJPEGImage;

...

    jpg := TJPEGImage.Create;
    jpg.Assign(MyCapture.Bitmap);
   ... perhaps adjust the JPEG quality parameters etc.
    jpg.SaveToFIle('somefile.jpg');
    jpg.Free;

...

Note that this "jpg.SaveToFIle('somefile.jpg')" statement will ALWAYS 
save JPEG data to the file, even if the given filename ends in  .png or 
.bmp or .mooseknuckle




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


Re: [Lazarus] LHelp and LazMouseAndKeyInput package

2021-02-22 Thread R.Smith via lazarus


On 2021/02/22 10:52, Juha Manninen via lazarus wrote:


Yes, in Windows terminology bringing to front means blinking an icon 
in Taskbar.
A Lazarus user however wants to see the help window right after 
pressing F1.


YES, this is very important.

I am not looking to weigh in on the issue of how Lazarus help works, but 
I can say something about Windows and the next comment:.





The name is not BlinkAnIconInTaskbar().
If you know how to fix it, please do. I don't use Windows much myself. 
Does this idea go against some Windows convention?


Blinking and Bringing to Front are two very distinct ideas in Windows 
and two different use-cases, though they often coincide. If I recall the 
Microsoft discussions correctly, the idea wasn't to ever blink when a 
user clicks the application into the foreground, or for instance pulls 
up the Help. Blinking the taskbar was only to be done if your 
application is *in the Background* AND something happens that is 
important for which you need to grab the User's attention towards it. 
(If your program is in the foreground/focused, you have carte-blanche on 
how to flash it or grab attention and don't need a flickering taskbar 
icon specifically, though *also* doing it isn't a sin)


The event that lead to you needing to blink the taskbar icon may well 
also require bringing to front, but it might also not (the judgement is 
left up to the software designer).


A good example is the Lazarus IDE after a debug session in Windows. 
After running your program (i.e. once your program terminates) Lazarus 
will both pop to front *and* flash the taskbar icon IF, and only IF, the 
debugged program was the focused desktop window. If I switch to any 
other program while the debugged program was running (pushing more apps 
onto the "focus" stack of the desktrop manager), Lazarus correctly does 
not "steal" the focus back by popping to front, but it does still flash 
the taskbar icon to make the user aware.


With the above in mind, I'd say when the user press F1 (or invoke help 
in any way) there should be a help window popping up/to 
front/focusing/etc, but no need for any blinking. The user KNOWS/EXPECTS 
what is coming, no need to try and draw their attention to it.


A final note: Lots of Windows users HATE taskbar icons blinking, they 
turn it off. (Just search google on how to turn it off, you will find 
oodles of hate rants).



For more info, see:
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-flashwindowex


Cheers,

Ryan


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


Re: [Lazarus] I say a little prayer (for the Lazarus editor)

2021-02-20 Thread R.Smith via lazarus
I'm not the coder, nor have any answer or thought on the matter, but I 
would like to point out that if you select text (any text) and then use 
a multi-cursor (pressing Alt+Shift+Down Arrow several times) and then 
Ctrl-V to paste, you get such a multi-row paste very easily.


Whether the mentioned IDE thing gets fixed or not, I find this the 
easier way.


Cheers!
Ryan


On 2021/02/20 12:06, duilio foschi via lazarus wrote:

If the coder in charge of the editor reads this, I have a prayer for him:

1.

The text showed in

https://i.ibb.co/0FQV1L0/3.jpg 

is column-selected using shift+alt+arrow followed by ctrl-C

2. using the arrows key, I move the cursor to the position shown in

https://i.ibb.co/VmbVJtg/4.jpg 

3. I press ctrl-V. The text ':string' is correctly copied into the
expected position but... look at the cursor

https://i.ibb.co/PWLfsn9/5.jpg 

The cursor is now at the position after the 'g' in the same row where the
text was copied.

So in the Lazarus editor there is no difference in copying a text 
row-selected

and a text column-selected.

In Delphi there is a big difference when you copy a text (at least 
until v. 7,

when I stopped using it).

Say you copy a text of lenght L from the clipboard into point (x,y).
If the text is row-selected, Delphi sets the cursor at point (x+L,y),
like the Lazarus editor does.

But if the text is column-selected, Delphi sets the cursor at point 
(x,y+1),

in the row below.

This enables you to quickly copy several rows of text, as shown here

https://i.ibb.co/98Y9WnD/6.jpg 

This ability is a big plus for a coder...well... at least I remember I 
was using

it often :)

.


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


Re: [Lazarus] Lazarus configuration - portable between versions?

2021-02-06 Thread R.Smith via lazarus



I probably need the editoroptions.xml file instead...
Is *that* file useful? I see it contains a lot less version dependent paths but
also a lot less settings...



Version dependant?

Perhaps you mean installation dependant?


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


Re: [Lazarus] Bump issue

2021-01-22 Thread R.Smith via lazarus


On 2021/01/22 23:58, Marco van de Voort via lazarus wrote:


Op 2021-01-22 om 22:56 schreef Michael Van Canneyt via lazarus:



I have some time this weekend, I will commit it.


Is it really a good idea to accept msec=1000 for TryEncodeTimeInterval 
in a general unit like Dateutils?



Maybe - can you construe a situation where the allowance would cause 
undue error or miscalculation of a datetime?  It's essentially an 
allowance for rounding. If your date-time calculation tries to add 
999.999ms or 0. sec to a datetime value, would you really be harmed 
if one full second was added? If so, what does it say for the occasion 
where you add 0.1116s and either 0.112s or 0.111s are physically added 
after rounding/truncation - is the prior any worse? Currently rounding 
works in all cases (000.000 up to 999.99444) except the very final 0.5ms 
of the range, and code has to be added to everything to fix that small 
remainig range because rounding perfectly *valid* time values to ms = 
1000 will error out.


I can and have demonstrated a case where NOT allowing msec=1000 is in 
fact detrimental and breaks in current production code (as far as the 
MySQL connection DATETIME values go) for any datetime fraction nearing 
lim{ dt --> 1000ms }. Allow me another demonstration without the DB stuff:


Reproducible test case:
Getting the current ms can be easily written as:
ms := Round(Frac(Now() * 86400)*1000);    // ms is the fraction of the 
seconds multiplied by 1000 and rounded.


Here is a full test-case anyone can run:

procedure timetest;
  var ms   : Integer;
  dtms : TDateTime;
begin
  try
    repeat
  ms := Round(Frac(Now() * 86400)*1000);
  dtms := EncodeTime(00,00,00,ms);
    until false;
  finally
    WriteLn('ms: ',ms);
  end;
end;

It errors out rather quick with the 1000ms culprit problem.

Now as a programmer i have to either TRUNCATE the time, which is not 
great because 12.9ms will become 12ms in stead of 13ms, or add special 
code to test for ms=1000, and what is worse, that code is almost always:


  if (ms=1000) then dtms := EncodeTime(00,00,01,00) else dtms := 
EncodeTime(00,00,00,ms);


I hope it is not lost on any readers how silly that is - I mean what 
ELSE could one possibly end up doing/meaning in the case of 1000ms?.

I will even argue that can be detrimental since I have seen fixes like this:

  if (ms=1000) then ms:=999;
  dtms := EncodeTime(00,00,00,ms);

which drives me to tears of course, but one could almost understand why 
the programmer did that, sacrificing accuracy to get rif of a silly 
exception. It isn't FPC's fault though, that is just a bad programmer.


As programmers our duty is to make our code conform strictly to the 
rules of the underlying systems, and I have been quite a vocal advocate 
for this on other fora - but rules should have clear reasons, not simply 
be rules for the sake of having rules - which comes to my challenge of 
showing a case where it is detrimental.


There was a proposal to compute the specific datetime value for the 
MySQL connector itself in Floating point space, which is a perfect 
solution (and I will be very happy with that too), but does it address 
the full spectrum of plausible cases? Would this need to be fixed in the 
PostGres (etc.) connectors too? Fixing it at the root of date-time 
calculations when the change is indeed sensible, AND barring 
demonstrable "bad" cases (I hasten to add), seems the appropriate thing 
to do.


Lastly...

In other datetime calcs, if you try to add a day that doesn't exist (ex: 
dt := EncodeDate(2021,02,30); ) then the reason it is wrong is clear and 
it should error out, that date does not exist in current calendars. 
Adding 25ms to 02:15:04.975ms simply lands you at 02:15:05.000 - It's 
hard to for me to find a reasonable example of where that will cause 
undue error or a result that is fundamentally wrong.


The only thing I can think that might be a problem is a programmer 
seeing that EncodeTime(02,15,40,1000) yields --> 02:15:41.  It's not 
technically wrong, but would this be unexpected? Would it confuse 
people? (Moreso than throwing an exception?)
If this is the solution we go with, this 1000ms case should probably be 
mentioned clearly in the documentation.



PS: I work with precision time a lot, GPS tracking systems etc, so for 
my use cases this is probably way more of a niggle than everyone else, 
so I concede my opinion doesn't carry all that much weight, but I really 
do not see the harm in fixing this for everyone - unless it can be shown 
to be detrimental, in which case I will happily accept it and appreciate 
being shown it.



Thank you for caring!
Ryan

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


[Lazarus] Bump issue

2021-01-22 Thread R.Smith via lazarus

Hi all,

I would like to know how to bump an issue in the bug tracker and I'm 
asking here because I don't wish to irritate the devs.


Essentially the issue has been solved last year October already, but not 
getting committed and closed, and I'm worried it won't make it into the 
next release, and I really need it. (I've patched locally for now but 
will revert to trunk on next release).


https://bugs.freepascal.org/view.php?id=37849

LacaK found the solution and proposed a patch, and Juha Manninen asked 
that someone with commit rights to FPC commit it. The FPC committers 
probably do not read the Lazarus bugs, so it has not been done and closed.


I wish to gently remind the FPC devs to please not forget to apply this.
What is the optimal/correct way to do this?


Thank you kindly,
Ryan


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


Re: [Lazarus] Component-View Presets

2021-01-05 Thread R.Smith via lazarus

Awesome - thanks.

Will get right on with testing and report back.

On 2021/01/05 17:12, Juha Manninen via lazarus wrote:

In r64336 I made the selected tab (PageIndex) persistent.
I also added a test for define NoComponentListTreeExpand. Build 
Lazarus with it and the trees will not open as expanded. The define 
can be replaced with a proper option if you find a good place for it.

Please test.

Juha


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


[Lazarus] Component-View Presets

2021-01-03 Thread R.Smith via lazarus
Hi All, I'm using Lazarus in a multi-screen setup and prefer the 
Component-view form rather than using the menu-integrated top-palette to 
pick components from.


In the Component-view there are 3 tabs: List, Palette and Inheritence - 
All of them great for what they do.


My preference is to mainly use the Palette tab here, and then always 
start from the "Collapsed" state. (I will open the section I wish to use 
by clicking it - this is much faster than scrolling or typing in the 
search bar).


Currently, every time i start Lazarus, I have to click the "Palette" Tab 
to select it, then right-click the list and do "Collapse all". It's not 
an insurmountable pain, but it is a pain in an otherwise flawless 
environment.


Is there any way I could achieve that in a setting or such so that 
Lazarus starts by showing the Palette tab and starts it with the 
Collapsed state?



Thanks you kindly,
Ryan

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


Re: [Lazarus] Where are the coolbar and desktop config files saved?

2020-10-04 Thread R.Smith via lazarus

On 2020/10/04 10:09, Mr Bee via lazarus wrote:
Never mind. I've found all the Lazarus user setting files. They all 
are in the "/Users//AppData/Local/lazarus". The "AppData" is a 
hidden folder, make sure you enable "Hidden Items" option in the File 
Explorer. So, I just zipped the folder and saved it somewhere else. If 
I broke my Lazarus setting, I simply delete the folder and restore 
from the zip file. Simple and easy.




On Windows (which stores this in /Appdata) you don't need to show hidden 
files - you can just type %AppData%\ in the explorer address bar, same 
as when using the commandline. This will take you directly to the 
Appdata folder, and while AppData itself is hidden, all its content are not.


You can further, obviously, use it as part of a full filename in both 
eplorer and commandline, such as:

%AppData%\Lazarus\myfile.txt

Note that depending on the Windows setup and logged-in user level, the 
direct reference to %AppData% might land you in the 
"\appdata\roaming" folder in stead of /local - to remedy that, it's 
best to specify the path with an "Up-Dir" prefix ".." to indicate the 
actual parent appdata directory, so to get to a file in the Lazarus 
subdir in "Local", this will be the best method, it doesn't matter which 
subdir of appdata you land in, it will go up-one and then to local always:


%AppData%\..\Local\

or for a file:

%AppData%\..\Local\Lazarus\somefile.txt


PS: I'm not used to typing Windows paths, had to go back and change all 
the slashes to backslashes, so if I missed one, please adjust accordingly.




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


Re: [Lazarus] How to find out why a unit is used in a project?

2020-09-24 Thread R.Smith via lazarus


On 2020/09/24 11:04, Sven Barth via lazarus wrote:
Bo Berglund via lazarus > schrieb am Do., 24. Sep. 2020, 
08:08:



>If course there is. That's how the unit system is supposed to
work after
>all.
>
Yes, I realize that now.

It means that the client even though it will not interface to the
hardware will have all of the code used to do that included in the
app, right?


The compiler (and linker) only includes code that is used. Thus as 
long as you don't call the hardware functions anywhere in your program 
(this includes indirectly or through initialization/finalization 
sections) then the code won't be in the final binary either.


Regards,
Sven



Sven, I believe Bo's problem is that even though he won't need the Code 
(which the linker/compiler will surely cleverly disregard), he also do 
not even wish to "need" the physical Unit files to be in view of the 
compiler - at least not the secondary-dependency units - when he 
references a unit file in which he only needs a few declarations visible.


Sadly Bo, the entire premise of the Unit system is that every dependency 
will be in view, the compiler cannot decide BEFORE compiling that it 
would or wouldn't need a unit which appears in a "unit" clause lower 
down the dependency tree. Consider that a used unit may well declare a 
global variable that overrides one from a higher-up unit, for instance. 
So even though the program has all the participating symbols at hand 
without looking at this depended unit with the override, it will produce 
a different program (than when that override IS considered) and so 
cannot simply decide to ignore/not require a unit preemptively before 
actually parsing the physical file.


All units you use, pluse every dependent unit they use, must be 
available and visible to the compiler. That rule is absolute.



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


Re: [Lazarus] Proposal: Allow Umlaute and Accented Characters in Identifiers

2020-07-05 Thread R.Smith via lazarus


Very interesting, Graeme. Exactly this could significantly improve 
Lazarus.



This thread keeps mentioning "Lazarus" and how it will improve "Lazarus"...

Does Lazarus even have a say in this?

Surely this is solely up to FPC?


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


Re: [Lazarus] Proposal: Allow Umlaute and Accented Characters in Identifiers

2020-07-03 Thread R.Smith via lazarus

Michael:


I did a quick test in Delphi:

program doti;

{$APPTYPE CONSOLE}


...

Great job - Thanks. That came in as I was contemplating doing the same test.

I wonder how this test will go in Python - I suppose it cannot matter 
for case-sensitive languages.




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


Re: [Lazarus] SQLdb: Pseudo Transaction?

2020-06-30 Thread R.Smith via lazarus

On 2020/06/30 22:52, Special via lazarus wrote:

Hi, Ryan,

I followed your advice and removed XTransaction and all references to 
it from TestButtonClick. But now I get an exception with the message 
"Transaction not set". Any hint?

Regards --  Joe


I'm sorry, the previous problem was SQLite-related, which I'm 
initimately familiar with, but this one seems to be a Lazarus DB 
component requirement which I'm not so much familiar with, but probably 
has an easy solution someone here might know about.


The question becomes:  How to execute a query, without a transaction 
being set, using SQLdb in Lazarus?



PS: In case you wonder, we're in the process of porting an existing 
SQLite management tool (https://sqlitespeed.com) to open-source 
multi-platform from Delphi to FPC and Lazarus - It's been quite a job 
but going well, and I love the Lazarus/FPC environment more and more, 
will never go back to Delphi/VS. I do however access SQLite through the 
API rather than the SQLdb provided components, which is why I can tell 
you lots about SQL and SQLite but not so much about SQLdb... So 
apologies for that - hope someone can answer this with some more 
pertinent knowledge.




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


Re: [Lazarus] SQLdb: Pseudo Transaction?

2020-06-30 Thread R.Smith via lazarus


Ryan,

your answer helps a lot; thank you.

Another (maybe stupid) question: What exactly is the purpose of a 
'transaction'? Do I need it for each SQL statement to be executed?



That's an excellent question in fact - lots of confusion out there.

Two main reasons, which I will quickly show - 1 - ACID guarantees 
(especially Isolation and Consistency, the others [Atomicity and 
Durability] you get anyway), and 2 - Speed.

(https://en.wikipedia.org/wiki/ACID)

In most DB engines (SQLite definitely) most executed commands gets their 
own little wrapped transaction if you did not start one explicitly - 
just to make the nuts and bolts of the engine function correctly. This 
might be a "lesser" form of transaction, but it has to at a minimum 
prepare the table, lock tables/rows/whatever, do the reading/writing, 
and then release those locks.


This also means that if you issue four commands, let's use an example 
(based loosely on a contacts-list table), say you execute these three in 
order:


SELECT MAX(ID) FROM contacts;
(The result of the previous statement is put into a variable, say: X)
INSERT INTO contacts(ID, FirstName, LastName, TimeAdded, ) VALUES 
(X+1, 'Joe', 'Soap', Now, ...);
INSERT INTO contacts(ID, FirstName, LastName, TimeAdded, ) VALUES 
(X+2, 'Joe', 'Jones', Now, ...);
INSERT INTO contacts(ID, FirstName, LastName, TimeAdded, ) VALUES 
(X+3, 'Joe', 'Smith', Now, ...);


Now inside the DB Engine, it is wrapped in pseudo-code like this 
(Obviously there is more going on, but I'm just mentioning the 
interesting bits to our example):


tt = Start_Transaction;
    qq = prepare query( SELECT MAX(ID) FROM contacts; ) :
        if (qq is READ Query)
        obtain_read_lock(tt, qq); // Executed
        ELSE
            obtain_write_lock(tt, qq);// Skipped
        run_query(qq);
        output_results;
        drop_locks(tt, qq);
    release_prepared_resources(qq);
    IF ERRORS > 0
        roll_back(tt);
    ELSE
    commit(tt);
release_transaction(tt);
tt = Start_Transaction;
    qq = prepare query( INSERT INTO contacts(ID, FirstName, LastName, 
TimeAdded, ...) VALUES (X+1, 'Joe', 'Soap', Now, ...); ) :

        if (qq is READ Query)
        obtain_read_lock(tt, qq);// Skipped
        ELSE
            obtain_write_lock(tt, qq); // Executed
        run_query(qq);
        output_results;
        drop_locks(tt, qq);
    release_prepared_resources(qq);
    IF ERRORS > 0
        roll_back(tt);
    ELSE
    commit(tt);
release_transaction(tt);
tt = Start_Transaction;
    qq = prepare query(INSERT INTO contacts(ID, FirstName, LastName, 
TimeAdded, ...) VALUES (X+2, 'Joe', 'Jones', Now, ...); ) :

        if (qq is READ Query)
        obtain_read_lock(tt, qq); // Skipped
        ELSE
            obtain_write_lock(tt, qq); // Executed
        run_query(qq);
        output_results;
        drop_locks(tt, qq);
    release_prepared_resources(qq);
    IF ERRORS > 0
        roll_back(tt);
    ELSE
    commit(tt);
release_transaction(tt);
tt = Start_Transaction;
    qq = prepare query(INSERT INTO contacts(ID, FirstName, LastName, 
TimeAdded, ...) VALUES (X+3, 'Joe', 'Smith', Now, ...); ) :

        if (qq is READ Query)
        obtain_read_lock(tt, qq);   // Skipped
        ELSE
            obtain_write_lock(tt, qq); // Executed
        run_query(qq);
        output_results;
        drop_locks(tt, qq);
    release_prepared_resources(qq);
    IF ERRORS > 0
        roll_back(tt);
    ELSE
    commit(tt);
release_transaction(tt);

The "output_results;" command might be a no-op for INSERT queries, 
though some DBs do return values.


Now note some things:
Towards Point 1 above:  If someone else also were trying to insert to 
this database at the same time, they might get an X that is in-between 
your inserts, and indeed insert values in between. This is called a 
concurrancy problem and is fixed by the "isolation" in an ACID transaction.
  (I know that behaviour can well be fixed by declaring the ID column 
with AUTO_INCREMENT, but let's imagine it wasn't in this example, you 
may well have other columns that must be Unique).


Note also that the inserted values for "Now()" would be slightly 
different every time since it's just a littlebit later when the next 
INSERT happens.  Inside a transaction, the TimeAdded values will all be 
the same.
Basically, while the transaction is in progress, and for the duration of 
it, no other connection to the same database can mess with those values, 
plus those values will remain consistent for the duration of the 
transaction. This is a very important property to many people.
There are a few other considerations to get technical with, like 
Serializability modes etc, allowing Dirty-reads, Read-uncommitted data 
(they don't fall in the scope of this discussion, but you can look them 
up if interested) - i'll only say here that not everyone wants their 
transactions to be closed off completely so Database Engines have 
switches/ways 

Re: [Lazarus] SQLdb: Pseudo Transaction?

2020-06-29 Thread R.Smith via lazarus

Hi Joe,

I'm hardly a FPC/SQLdb expert, but I am somewhat familiar with SQL 
databases and SQLite in particular.


Your problem is exactly what is expected.

Basically you are trying to execute SQL code in SQLite that changes the 
underlying DB engine to change the journalling mode (or at least, a 
component of it, namely "synchronous") while you have already started a 
transaction "XConnection.Transaction:= XTransaction;".


Now in SQLite, since it is a file-based DB engine, it needs to be able 
to lock files (with standard OS file-locking semantics) during 
reading/writing as needed. It is able to provide full ACID transactions 
by using "Journals" of various types that funtion in various ways. The 
best is to use WAL journal mode, but the fastest would be DELETE mode, 
etc.  It aslo has the "synchronous" pragama switch that controls HOW the 
underlying engine confirms writes to actual hardware via the current VFS 
(virtual file system) in use. [Think of a VFS like a driver for EXT4, 
NTFS, whatever you are using.]


With "PRAGMA synchronous = OFF" you are telling the the VFS to stop 
FSYNCing after writes on your file system. i.e. to not care whether your 
data has been comitted to the physical hardware, but return immediately 
after writing and go on with the next thing. This is a nice hack to make 
it very fast, but it does cause a measure of risk for a power-cut right 
at the point between sending the write, and accepting it is completed 
when it really isn't comitted to hardware, will mean data corruption 
(detected when you next start up).


This is called "SAFETY LEVEL" and for obvious reasons, you cannot change 
how the safety mechanism acts while already inside a transaction which 
started on a certain safety level. You have to perform this swicth 
BEFORE starting that transaction.


Just remove all the transaction bits of your code, and it should work fine.

By the way, if you don't care about safety at all, also make sure the 
"PRAGMA journal_mode = DELETE;"[1] is called (also before any 
transaction), set the temp-store to memory[2] and set the cache nice and 
high[3].

[1] https://sqlite.org/pragma.html#pragma_journal_mode
[2] https://sqlite.org/pragma.html#pragma_temp_store
[3] https://sqlite.org/pragma.html#pragma_cache_size

(and if you do care about data safety, don't do any of those!)

(except the cache... you can still do the cache.) :)


Cheers,
Ryan


On 2020/06/30 00:25, Special via lazarus wrote:

Hi,

I am  using Lazarus 2.0.8, package SQLdb, under Win 10  (64). The 
following procedure raises an exception with message 
"TSQLite3Connection: Safety level may not be changed inside a 
transaction". This is strange, since I think there is no active 
transition in the moment when the exeption is raised.


Why this exception? How to fix? Is it maybe a bug in Lazarus 2.0.8 or 
in SQLdb?


Code:

procedure TForm1.TestButtonClick(Sender: TObject);
var XConnection:   TSQLite3Connection;
    XTransaction:  TSQLTransaction;
    XDatasource:   TDataSource;
    XQuery:    TSQLQuery;
begin
  XConnection:= TSQLite3Connection.Create(Form1);
  XTransaction:= TSQLTransaction.Create(Form1);
  XDatasource:= TDataSource.Create(Form1);
  XQuery:= TSQLQuery.Create(Form1);
  XQuery.DataBase:= XConnection;
  XQuery.Transaction:= XTransaction;
  XDatasource.DataSet:= XQuery;
  XTransaction.DataBase:= XConnection;
  XConnection.Transaction:= XTransaction;
  XConnection.DatabaseName:= ExtractFilePath (Application.ExeName) + 
'D.sqlite';

  XQuery.SQL.Text:= 'PRAGMA synchronous=OFF';
  try
    XQuery.ExecSQL;
    XTransaction.Commit;
  except
    on e: Exception do
    ShowMessage ('Exception "' + e.Message + '"')
  end;
  XQuery.Free;
  XDatasource.Free;
  XTransaction.Free;
  XConnection.Free;
end;

Regards --  Joe

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


Re: [Lazarus] create bng with transparent background

2020-06-10 Thread R.Smith via lazarus

On 2020/06/10 13:57, Luca Olivetti via lazarus wrote:

Hello,

is there a way to create a png with transparent background?

I tried the suggestion here

http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-How-to-create-a-transparent-PNG-td4047716.html 



to set the brush to bsClear but it doesn't work.
I also tried with a TFPMemoryImage using either a brush or a pen with 
alphaTransparent but I couldn't have a transparent png, the background 
is always black.



The brush.style:=bsClear merely dictates how any next additive drawing 
will fill its specific background area, for instance if you were to add 
Text to the image it will draw the text without a background, which is 
useful if you wish to write on pictures or transparent PNGs.


I think the best way to make a transparent PNG currently, is to do what 
you did, but then paint at least the upper left corner pixel with a 
transparency of 1 and not Zero, which you still won't see, however, may 
I suggest using the very useful BGRA Bitmap package? Then it simply 
becomes a question of:


uses
  ... BGRABitmap, BGRABitmapTypes, ...

var
  bmp : TBGRABitmap;
  png : TPortableNetworkGraphic;

...

  bmp := TBGRABitmap.Create( neededWidth, neededHeight );
  png := TPortableNetworkGraphic.Create;

  bmp.FillRect( bmp.ClipRect, BGRAPixelTransparent, dmSet );
  png.Assign( bmp );


Done. Obviously the real advantage of those BGRA tools is when you 
actually wish to draw stuff on the image.



Also, how do you know the output PNG file is not transparent? I ask 
because windows and windows viewers will sometimes show a perfectly 
transaprent PNG with a Black/White background. The only safe way to know 
is to open it in Paint or GIMP or such. (Linux typically doesn't lie 
like that, but any specific viewer may of course still do it some 
arbitrary way. A graphic editor is obliged to show the real content.)


Note: That BGRAPixelTransaprent is simply an internally defined TPixel 
with R G B and Alpha all set to 0, so you can also make up your own 
transparent pixel and use that in stead.


Good luck!


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


Re: [Lazarus] OT: thunderbird 68 (linux) and column From

2020-05-28 Thread R.Smith via lazarus
Von means "From" - change the column to "Correspondants" (Not sure what 
that would be in the Deutsche version... Korrespondenten maybe?)



On 2020/05/28 12:51, John Landmesser via lazarus wrote:


Strange behaviour of newest thunderbird 68.8.1 on Deepin Linux:

See Column "von" . I'm used to see the sender-Name there

Googled with no succes :-(

Anybody else has this issue?

Regards

John



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


Re: [Lazarus] TAction and Short-cut conflicts

2020-05-25 Thread R.Smith via lazarus
> I also noticed that it reports Alt+C (i.e. accelerators, when some 
caption is "_Cut" with underlined _C_).


> V.


Indeed, I did not mention this in the initial post because of TLDR; 
fears (though I would in the bug report, but the jury is still out on if 
this is even a bug) - thank you for bringing it up.


I think if the shortcut is a in-menu-only shortcut it should still be a 
conflict perhaps, but the extended quirk on this is that sometimes I use 
items with & in the name, (Like - actCompany.Caption:='Lyle & Sons.') 
but I don't want it to show as a shortcut (or for it to BE a shortcut).


No problem, just escape it the usual way: actCompany.Caption:='Lyle && 
Sons.'


But now, that adds a shortcut conflict to the list also, because the 
shortcut analyzer does not interpret the escaping - I assume.


For anyone else wishing to test - Just create a new Form app and copy 
the code between === lines below, and paste onto your form.
Then go to menu editor, on any item Right-click --> Shortcuts --> 
Resolve shortcut conflicts.


There are only 2 shortcuts used and they differ, so there are Zero 
conflicts here, but the Analyzer shows no less than 6 conflicts.


[ Note1: This code has no actual shortcuts assigned to any Menu-Item. 
Only the TActions have shortcuts, and they differ. ]
[ Note2: Shortcuts 16458 & 16459 are not special, they're simply 
"Ctrl+J" & "Ctrl+K", chosen arbitrarily.]


==

object ActionList1: TActionList
  left = 85
  top = 112
  object Action1: TAction
    Caption = 'Action1'
    ShortCut = 16458
  end
  object Action2: TAction
    Caption = 'Jack && Jill'
    ShortCut = 16459
  end
end
object pu1: TPopupMenu
  left = 32
  top = 64
  object MenuItem1: TMenuItem
    Action = Action1
  end
  object MenuItem2: TMenuItem
    Action = Action2
  end
end
object pu2: TPopupMenu
  left = 152
  top = 64
  object MenuItem3: TMenuItem
    Action = Action1
  end
  object MenuItem4: TMenuItem
    Action = Action2
  end
end

=



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


[Lazarus] TAction and Short-cut conflicts

2020-05-25 Thread R.Smith via lazarus
I've been using the TActionList and TAction objects, which I think is 
not only making life easier, but a good design choice, and it's been 
working a treat.


One niggle is, when I assign a short-cut to a TAction and then assign 
that TAction to any of the action-enabled controls, it lists the 
shortcut in the conflict list, which is a false positive - it's ok with 
a shortcut item to conflict with itself or it's own action (impossible 
not to, actually).


To be precise - say I have a TAction named actCut to cut text, set the 
Shortcut to "Ctrl+X", then assign the action to one menu item in my 
TMainMenu, say mmnuCut (which is new and had no other properties 
changed), I then will see the following in my ShortCut conflict list 
(accessed via the Right-click in the Menu editor --> Shortcuts --> 
Resolve Shortcut conflicts):


- Resolved Conflicts: 0

- Remaining Conflicts: 1
 "Ctrl+X" in actCut conflicts with "Ctrl+X" in mmnuCut
...

What's worse, if I also assign the same Action to another menu item 
(which is the point of using actions) in the pop-up context menu, say 
puCut, I can see a three-way false-positive like this:


 "Ctrl+X" in actCut conflicts with "Ctrl+X" in mmnuCut
 "Ctrl+X" in actCut conflicts with "Ctrl+X" in puCut
 "Ctrl+X" in puCut conflicts with "Ctrl+X" in mmnuCut

I use many Actions and shortcuts, so now resolving any REAL conflicts 
becomes really hard.


So before I log a bug report, let me ask the community first:
- Is this a bug?
- Is it a feature request?
- Is it a stupidity and there is some config setting I'm missing?

Also, in the conflict list, if the window is resized, the inner panel 
does not - like someone forgot to swicth its Align from alTop to alClient.


 Technical-
A conflict should only be positive is:
1 . The conflict is NOT between a control and its own action,
2.  The conflict is NOT with a control which uses the same action -
  2.1  Unless the Shortcut does not originate from the shared Action 
itself.

-

Thank you kindly,
Ryan


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


Re: [Lazarus] Keyboard interpreted incorrectly?

2020-04-10 Thread R.Smith via lazarus

Are you using it through a Remote desktop or VM or such?

Check the Ctrl key is not pressed. i is the 9th letter and TAB is the 
9th ASCII character. Similarly m is the 13th letter and NewLine is the 
13th ACII character - which makes  it seem to me somewhere the keyboard 
is getting confused.


Does this work correctly when you edit a text file?

If so, check the Lazarus Tools-->Options for keyboard input (keys can be 
assigned specifically there, maybe you have a weird set assigned), 
although I do not know of a standard setting that would cause this. I 
have however seen stuff like that happen when I had the Ctrl and/or Alt 
key stuck down or used it via remote desks.


Good luck!
Ryan


On 2020/04/10 14:40, Brian via lazarus wrote:

Help, please, folks!

I am just returning to using Lazarus for the first time in probably 6
months or so, certainly for the first time since I switched operating
systems. I am now using Linux Mint 19.3 64-bit with an XFCE desktop. I
used fpcupdeluxe and installed the fixes version of both fpc and
lazarus via the button at the bottom of the screen. Everything seemed
to go OK, I could see no error messages in the downloads and build,
and I am now left with (it says) a copy of lazarus v 2.0.7 r 62901 and
fpc 3.2.0.

The problem is when I try to key in my code (and I'm creating a new
program, not an application). Most of the keys work OK, at least that
I have found so far, but an 'i' produces a TAB and then an i, and an
'm' just gives me a new line. The upper case versions of these
characters work as expected, so my temporary workround is obviously to
use those and the formatter, but to say it's a nuisance is an
understatement! I'm using a standard American keyboard layout, and I
have not seen this behaviour in any other application, for sure not in
the copy of thunderbird which I'm using to write this message! I've
also tried a few other applications, and it's only (so far) the
lazarus ide that's afflicted.

Anybody have any ideas, please?


Brian.

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


Re: [Lazarus] Close all menu item ?

2020-03-24 Thread R.Smith via lazarus

On 2020/03/24 11:39, Michael Van Canneyt via lazarus wrote:



See my (held for moderation, attachment to big) answer to Ondrej for 
why this reasoning is insufficient and the current Lazarus behaviour 
is actually buggy.


It's in fact hilarious that I am forced to even discuss this ! :-)

I mean, how hard can it be to understand this ?

To any normal human being, *Close All* means close *ALL*.

'All' is just a 3 letter english word with a very clear meaning. 
Savour the simplicity of it by pronouncing it out loud, prolongue the 'l'
sound if you need that to fully grasp the meaning and beauty of this 
word :)



Firstly, Michael, that was quite fun to read, I enjoyed it :)

Secondly, I've been following this thread with some ambivalence, but 
before it gets silly - kindly remember the small feature called "Context".


What does the word "Open" mean to "any normal human being"?  It's simply 
an adjective/verb, perhaps describing a property of a thing being 
unclosed, or the action of making a thing unclosed. In the File menu the 
word "Open" only gets it's meaning via the sub-context of being in the 
"FILE" menu. If it was in the Project menu or Package menu (oh look, 
there it is...) it would bestow it's meaning on a completely different 
thing.


Why are we Ok with the sub-context bestowed on "Open" and the difference 
in meaning when it's in the Project menu vs. when it is in the File menu?


I can repeat the above for "New" or indeed "Close".

When a menu says "Close All" it must by definition mean "... for the 
stuff that this menu is about", otherwise every menu item caption must 
be altered to carry the whole menaing and a GUI will start looking like 
a shakspeare novel. (To be fair, Lazarus does actually call it "Open 
Project" on the Project menu - a superfluous text, but not exactly 
harmful/hampering).


When you want to Close (or do anything else with) the project, do it 
from the Project menu. If you want to do stuff with the files in the 
project, do it from the File menu. Asking to change the behaviour of the 
interface for everyone in the World cause your sense of English is 
offended is, well, some would say "arrogant", but I'm not like that, I 
would merely call it "highly expectant". :)



On a serious note devs, if one did click "Close All" and the project 
closed too or reopened the default project (since at the end of the day, 
a Project is also a file), I doubt anyone would complain or find it 
weird or complainable. If I did NOT want the project to close, I 
certainly wouldn't click on any menu item with the words "Close All", so 
perhaps in this case, notwithstanding what I said above, and if it isn't 
a lot of effort, evryone would be fine with this change and it would 
indeed help sort out any SVN niggles.


Cheers,
Ryan



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