Forum > Other

What I love about Lazarus' features

(1/4) > >>

_Antares_:
I posted improvement requests, so I figured I also should mention what is awesome in Lazarus already as well. Even compared to Delphi 12 which I recently installed as community edition :-X

♥ First of all: The Lazarus-IDE itself provides advanced levels of customizing syntax highlighting, editor colors, code formatting and key mappings! This is soooo am-a-zing!
Delphi 12 must rely on tools like MMX Explorer and still does not reach that level of customizability. Delphi does not even have options to change individual key bindings at all, only presets.

♥ The Object Inspector allows changing more stuff than average Delphi.
For example the BorderSpacing feature is so neat! I use it a lot.
Delphi has Margins which also allow negative numbers to align things. But a BorderSpacing.around:=8 and be done is so mighty.

♥ Also when it comes to colors, Lazarus just provides those properties to be directly accessible in the inspector (like Delphi in the old days did), including all the clBtnFace-and-whatnot constants. That's the way it should be!
In Delphi 12 you do not have any coloring or style options in the inspector anymore - they are "outsourced" to StyleBooks which I still did not figure out how to use them for even a simple thing like changing the background color of a panel. Also color properties are restricted to a palette not involving any "dynamic" cl... constants (or they are hidden somewhere). But the available predefined colors are very pretty and well named.

♥ Autocomplete features are so neat! Changing the signature and propagate back to the interface/implementation in both ways. Also I like that you can have auto complete not overwriting partial text that follow the line at the completion spot. Seems minor, but it feels so smooth.

♥ The Object Inspector allows a Favorites section. So handy!

While I am at it, now some credit to Delphi 12:
♡ The debugger is awesome compared to Lazarus. It provides all information and presents it nicely colored and browsable. No "This field is not available due to compiler optimizations" and stuff. You can inspect anything, even if not directly in scope of the current method and properties/fields are named like in the inspector, not like in the source code.

♡ Minor quality of life things involve changing all the caption/text properties to just a text property for all components.

♡ The Filter/Effect-components are cool. Adding 3D shadow or blur effects just by adding it with a click.

♡ A very mighty feature is the option to use any control as a container like a TPanel to build the layout hierarchy. Having a TLabel allows having a TButton "inside" of it without needing to wrap them into a TPanel first. Especially useful for integrating buttons into a TEdit for various options like open dialog or clear field etc. Even allows auto-alignment with alTop/alRight etc.

Do you have some favorite features? 8-)

Handoko:
Interesting.
Thank you for sharing your thought on Lazarus vs Delphi.

These are the things I like about Lazarus:

* Lazarus allows me to easily write cross platform programs.
* Online Package Manager (thanks GetMem)
* Lazarus Android Module Wizard (thanks jmpessoa)
* Very helpful communityWhat I don't like about Delphi:
* It cannot run on Linux

Dzandaa:
Hi,
Like Hadoko,
an important possibility is to be able to write code that is compatible with Windows Linux and MacOS, without much modification.
OLM, code completion, and The community is pleasant and helpful.

B->

Martin_fr:

--- Quote from: _Antares_ on November 17, 2024, 11:07:30 am ---While I am at it, now some credit to Delphi 12:
♡ The debugger is awesome compared to Lazarus. It provides all information and presents it nicely colored and browsable. No "This field is not available due to compiler optimizations" and stuff. You can inspect anything, even if not directly in scope of the current method and properties/fields are named like in the inspector, not like in the source code.

--- End quote ---

True... Unfortunately.  Properties are a problem with FPC debugging.

Though a couple of notes for all those who need workarounds. And some advice.

In many (most) cases (with Lazarus 4.0 / with 3.6 only a small subset works) you can call the getter method of a property. However, you have to know the method name, and type it "MyStringList.GetText()". And enable function calling (global, and on each watches' properties).

You can also (use the "debug inspect" to assemble the watch) watch this

--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---(MyStringList.FList)^[0..MyStringList.FCount-1].FStringAnd it shows you all entries of a stringlist, without having to call the getter function.
See https://wiki.freepascal.org/FpDebug-Watches-Intrinsic-Functions#Array_slice_MyArray[n..m]_with_mapping


A word (warning) on function calling.
And a word on what (afaik) Delphi does. At least it did, back in the day of Delphi 5, and it is still the same underlying issue.

This was the first thing, that Delphi burnt me with. Really burnt me good.

I had an app that crashed (as I later found because of "Handle" not being created). I debugged it in Delphi, and added "TheControl.Handle" as watch.
And it wouldn't crash in the debugger.
I lost a good bit of time, till I found the answer.

Because "Handle" is a property with getter, the only way for the debugger to show the value, is to call the getter method. But that getter method would actually create the Handle. (unlike my crashing code, that somehow called something that used the handle, but bypassed creation).

So watching any property with getter in Delphi (at least older Delphi, but afaik any Delphi) can modify the state of your debugged app. And the app may behave different in the debugger, and you may not be able to find your bug.
And when this will have been added to FPC then the same danger will be there.

That said, it is still a feature that would be good to have. But anyone using it should be aware, that it is a dangerous feature.

Other than that, I wasn't aware that Delphi colors watches. What is it used for? Some pattern in the data? Or "changed during last step/run"?
"changed during last step" is an my Todo.

And (in a feeble attempt to even the balance):

- Have you tried to watch a long array in Delphi (say 1000 entries)? What happens if you "unfold" it? Last I asked someone (I don't have Delphi), they got the full list with 1000 rows. Happy scrolling down, if you have more watches below. Lazarus has pagination.

- And we now (4.0) have :flatten (see intrinsic link above) to display linked lists and tree structures. Though again, you have to enter the expression by hand. (maybe in future that can be automated for known types)
I don't know what/if Delphi has for this.

- For types like

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---TModalResult = low(Integer)..high(Integer);  mrNone = 0;  mrOK = mrNone + 1; you can now create a value formatter https://wiki.freepascal.org/IDE_Window:_IDE_Options_-_Debugger_Value-Formatter#Convert_Ordinal_to_name to display the names, instead of numbers.

(Actually, probably could add a pre configured one for TModalResult..., just had not yet thought of that / well, maybe if I find some time)

VisualLab:

--- Quote from: _Antares_ on November 17, 2024, 11:07:30 am ---♥ Also when it comes to colors, Lazarus just provides those properties to be directly accessible in the inspector (like Delphi in the old days did), including all the clBtnFace-and-whatnot constants. That's the way it should be!
In Delphi 12 you do not have any coloring or style options in the inspector anymore - they are "outsourced" to StyleBooks which I still did not figure out how to use them for even a simple thing like changing the background color of a panel. Also color properties are restricted to a palette not involving any "dynamic" cl... constants (or they are hidden somewhere). But the available predefined colors are very pretty and well named.

--- End quote ---

Maybe you mean applications using the FireMonkey (FMX) library? In this situation, you need to use styles to handle color. However, if you choose a VCL application, then color handling in the Object Inspector works as before and similarly to Lazarus. I just checked it in Delphi 12 (Professional with Mobile).

Navigation

[0] Message Index

[#] Next page

Go to full version