Lazarus

Programming => General => Topic started by: Aruna on December 03, 2022, 11:18:53 pm

Title: Juggling Multiple Lazarus Projects
Post by: Aruna on December 03, 2022, 11:18:53 pm
I have multiple Lazarus projects. Let's say we have 4 separate projects.
For example:

Proj1.lpi
Proj2.lpi
Proj3.lpi
Proj4.lpi

I have 3 buttons in the main form of Proj1 that when clicked I want:

Button1 clicked should  invoke Proj2.lpi .
Button2 clicked should invoke Proj3.lpi .
Button3 clicked should invoke Proj4.lpi .

Can this be done?

Thank you.

Aruna
Title: Re: Juggling Multiple Lazarus Projects
Post by: dbannon on December 03, 2022, 11:31:43 pm
Yes, its possible. But its also possible to ride a push bike across the Simpson Desert, I would not want to either !

Seriously, its reasonable to include units from other projects if you are very careful about what you do, including a project would be quite awkard.

I prefer to make a copy of an existing unit from an "other" project - make a note at the top where it came from and try not to change it too much. using ifdefs works -
Code: Pascal  [Select][+][-]
  1. {$ifdef PROJ1}
  2. ....
And the unix diff or sdiff -bs commands will easily show you the differences between two versions of the same unit.

Davo
Title: Re: Juggling Multiple Lazarus Projects
Post by: Martin_fr on December 03, 2022, 11:47:31 pm
(Sorry, short answer / but I don't know what exactly you ask)

Invoke as in create a TProcess?

The forum has tips on how to run an external exe/process. Any of your Projects (once compiled) is an exe, and you can launch that exe (if your Proj1 knows were those exe are)

If you meant reusing the code, and compile all in on => create packages for the shared code.


On a side note, if you develop in several projects like this (potentially changing the open project often), install the ProjectGroups package into the IDE.
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 03, 2022, 11:51:10 pm
Yes, its possible. But its also possible to ride a push bike across the Simpson Desert, I would not want to either !

Seriously, its reasonable to include units from other projects if you are very careful about what you do, including a project would be quite awkard.

I prefer to make a copy of an existing unit from an "other" project - make a note at the top where it came from and try not to change it too much. using ifdefs works -
Code: Pascal  [Select][+][-]
  1. {$ifdef PROJ1}
  2. ....
And the unix diff or sdiff -bs commands will easily show you the differences between two versions of the same unit.

Davo
Sorry  I should have given more 'context' to the question. The "Testall" that you so painstakingly restructured and organized when I last checked gives me 85 folders containing fully working 'examples'. I was thinking of reading the filenames into a Tlistbox and having the end user choose the example he/she may be interested in. Instead of the TListbox I asked for buttons to make this simpler if that makes sense. So what would be the best way to write a wrapper around the 85 separate examples?

Ps: What would be wrong with riding a push bike? I am in the great white north so sadly do not have anything remotely like Simpson desert down under but I am told the current weather up in Edmonton two days back was -29 degrees celsius so riding a push bike will keep you warm? You could also keel over from frost bite if your not properly attired for the weather  :-\
Title: Re: Juggling Multiple Lazarus Projects
Post by: Martin_fr on December 04, 2022, 12:01:50 am
I don't follow that other thread, but first of all: Why not use the existing list inside the IDE?
Menu: Tools > Example Projects
?



But back to your question, still not clear what launch means....
If someone clicks you button, then your code knows the project as c:\lazarus\examples\foo\SomeBar.lpi

That file isn't executable.
Do you want to:
1) Open it in an IDE?
2) Compile it, and run the created exe?

In either case you need to look at TProcess (TUtf8Process) or alternatives (IIRC .... there is some routine to "launch" - as in start the associated exe, if the OS supports that....)

1) you launch lazarus.exe as new process, and give the lpi as argument.
It depends on how the user did configure their IDE. It either opens the project in a running IDE, or it opens a new IDE.

2) you first launch lazbuild to build the project.
I don't know if you can specify the name for the final exe, or if you need other means to find that exe.
Then you run the exe.
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 04, 2022, 12:07:24 am
(Sorry, short answer / but I don't know what exactly you ask)
Please allow me to shed some light on the matter. We have a brand new examples directory put together by @dbannon which currently has 85 separate folders containing separate projects. I want to have a simple way to allow a end user to browse then select the example they want and run/execute it.

Invoke as in create a TProcess?
I prefer not to at this time Martin_fr usually TProcess will mean extra ram being used and if things go south I get smoked. Definitely will try what you suggested at a later  date just for my learning but right now uh-uh nope.

The forum has tips on how to run an external exe/process. Any of your Projects (once compiled) is an exe, and you can launch that exe (if your Proj1 knows were those exe are)
This is the other thing I am running Linux Debian and my executables are deb's  :-X

If you meant reusing the code, and compile all in on => create packages for the shared code.


On a side note, if you develop in several projects like this (potentially changing the open project often), install the ProjectGroups package into the IDE.
Thank you @Martin_fr I will definitely explore ProjectGroups.
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 04, 2022, 12:40:14 am
I don't follow that other thread, but first of all: Why not use the existing list inside the IDE?
Menu: Tools > Example Projects ?
Use it by all mean that is a fantastic piece of work. That being said take another look at it carefully. It does give you a list of available examples but you are unable to select immediately using the list. Try pressing Enter and see. 

You can double-click and it grabs the displayed example and opens it in the ide but again we have to run it by pressing F9 to see what it looks like.  More keystrokes again.

Or once you select the example you have to copy it to the work area then open it. All this is fine and I am really happy but just for my own sake I would like to be able to scroll up or down in that list and press Enter and I want a running instance of the example. Simple right? Scroll through the List press enter and boom running instance. ( or maybe not..) I am yet too new and insufficiently experienced to see if what I want to do is not feasible or is a waste of time. Still, I want to give it a go...


But back to your question, still not clear what launch means....
If someone clicks you button, then your code knows the project as c:\lazarus\examples\foo\SomeBar.lpi

That file isn't executable.
Do you want to:
1) Open it in an IDE?
2) Compile it, and run the created exe?

2)I want to compile it, and run please.
Title: Re: Juggling Multiple Lazarus Projects
Post by: Martin_fr on December 04, 2022, 03:01:18 am
I don't follow that other thread, but first of all: Why not use the existing list inside the IDE?
Menu: Tools > Example Projects ?
Use it by all mean that is a fantastic piece of work. That being said take another look at it carefully. It does give you a list of available examples but you are unable to select immediately using the list. Try pressing Enter and see. 
Well, for me Enter works (though that is on Windows / not tested on Linux).
Of course, "Enter works" once I selected the listview. By default it is on the filter edit. It would be a nice extension, if e.g. the up/down keys would affect the selection in the list, even while the filter has focus.... And then consequently enter could be made to work.... But that is another story.

Yes well, if you just quickly want to run each example that is a different usecase.


Quote
2)I want to compile it, and run please.
Well since compilation, needs to know about packages used by each example the only way you have is to run (TProcess or similar)
   lazbuild demo.lpi
and then run the exe.

So when you click, you will have the time that compilation takes... Unless you have a batch job, and precompile them all.

However you need to find where the final exe was put by lazbuild, otherwise you want be able to run it.
Not sure how to do that best. Maybe read the lpi, and see if an output for the exe is defined?

Title: Re: Juggling Multiple Lazarus Projects
Post by: dbannon on December 04, 2022, 08:19:44 am

I suspect key to what I think you want is in the function that is told to open a project after its chosen in the Example Window -

Code: [Select]
ide/main.pp:813:    function DoOpenProjectFile(AFileName: string;
You should add a parameter to that that tells it that after it has opened the project, it should compile and run it.


Alternatively, you could have a stand alone app that displays the list of examples (easily copied from existing exampleswindow code) and it would compile (using lazbuild) and run the resulting app (using, sorry, TProcess).

> .....which currently has 85 separate folders containing separate projects.

Please don't forget all the "other" example projects, there are many more in the Lazarus SRC tree associated with the relevant parts of Lazarus code. There are a touch over 200 from memory.

I cannot think of a practical way to do it otherwise. And, honestly, I don't see a need. In most cases, the value to the end user of the Examples is the chance to look at the code. yep, they might compile and run to ensure its the example they think it is but browsing across the code is the benefit.

> This is the other thing I am running Linux Debian and my executable are deb's

If you have executable debs, I'd be quite worried. But seriously, it does not matter about the executable format, Lazarus is cross platform. In all (supported) cases, Lazbuild makes an appropriate binary as determined from the project file. By default, Lazbuild uses the "default" mode. So, you would need to check all 200 metadata files and maybe add a mention of the correct project mode to use ensuring cross platform.

> Ps: What would be wrong with riding a push bike?
Nothing, but don't expect to see me riding one across the Simpson. https://www.traveller.com.au/dune-busters-crossing-the-simpson-desert-go0wjx and it will be over 45 degrees tomorrow.

> current weather up in Edmonton two days back was -29 degrees celsius so riding a push bike will keep you warm
No, if its -29 outside, they should be waiting for the rescue team to arrive and take them away from such a terrible place.

 :D

Davo




Title: Re: Juggling Multiple Lazarus Projects
Post by: JuhaManninen on December 04, 2022, 09:19:29 am
I suspect key to what I think you want is in the function that is told to open a project after its chosen in the Example Window -
Code: [Select]
ide/main.pp:813:    function DoOpenProjectFile(AFileName: string;You should add a parameter to that that tells it that after it has opened the project, it should compile and run it.
No need for a new parameter. The IDE interface already has functions DoRunProject and DoRunProjectWithoutDebug.
There can be an option for ExampleWindow to run a project right after opening it.

Quote
In most cases, the value to the end user of the Examples is the chance to look at the code. yep, they might compile and run to ensure its the example they think it is but browsing across the code is the benefit.
Yes, the request sounds unusual. Usually people want to look at an example project's forms and/or code for a while before running it. Also, pressing F9 is a rather small task.
Still, if somebody wants such an option, it makes no harm to others.

I opened the Example Projects window after a long pause.
The list is empty. :(
The option "Directory where Examples go" is : /home/juha/.lazarus/examples_work_dir/
which is correct.
That directory is empty but the projects under Lazarus source examples/ directory should be shown.
I have the latest Git main branch on a Manjaro Linux and start Lazarus as "./lazarus &" from the source dir which is ~/SW/lazarus.
I remember having the same problem in the early tests a long time ago. I don't remember how it was solved. Maybe I had to change the code somehow.

[Edit] Oops, actually it works with a clean Lazarus configuration, like "./lazarus --pcp=~/.lazarus_test &".
The default config is old and must be corrupt somehow.
I must delete it and tweak the settings again. I will lose file and project history and some settings but it is OK.

[Edit2] No, the example list becomes empty right after opening any project, eg. lazarus.lpi or one of the examples.
To reproduce on a Linux system :
1. Start Lazarus with a clean configuration, either by --pcp= parameter or by deleting the default config directory (~/.lazarus).
2. Open the Tools -> Example Projects window. The list is filled.
3. Close the Example Projects window. Open ide/lazarus.lpi.
4. Open the Example Projects window again. The list is empty.

An alternative step 3.: Open one of the example projects from the window. It opens OK.
Then continue with step 4.

This is annoying. Project settings should not affect the Example Projects window anyhow.
How is it possible that nobody has noticed this?
Title: Re: Juggling Multiple Lazarus Projects
Post by: dbannon on December 04, 2022, 10:52:21 am
No need for a new parameter. The IDE interface already has functions DoRunProject and DoRunProjectWithoutDebug.
There can be an option for ExampleWindow to run a project right after opening it.
Ah, I did not look through the code, just grepped for the call its using now.

I opened the Example Projects window after a long pause. The list is empty. :(
.......
The default config is old and must be corrupt somehow.
I must delete it and tweak the settings again. I will lose file and project history and some settings but it is OK.
Hmm, thats surprising, it generates its list of examples at each startup, does not cache that content in PCP. 

We do keep projects the user has opened there and there is a single setting, where to keep that stuff, in the Lazarus Settings. Nothing I can think of thats likely to upset indexing the projects. But we do scan through PCP looking for potential Examples that are there, eg, OPM. If there was an invalid metadata file, it should report it to console and continue on.

If you have saved that PCP, can you see if there are any metadata files in there please ?  *.ex-meta

Davo
Title: Re: Juggling Multiple Lazarus Projects
Post by: KodeZwerg on December 04, 2022, 12:09:25 pm
I guess when I would want to do such project, I would invent my own little scripts that be loaded at runtime into my app, txt/xml/json/whatever....

So I would have a prepared ListView (one visible column for a mini project description and invisible columns for filepath and parameter switches)
That data comes from the "script" file.

When clicking on of the entries, a bigger description of project appear on a memo/richtext/whatever type of control to display text.
That data comes from the "script" file.

Optional have some TImage display snapshot of GUI showing the used control.
That data comes from the "script" file.

Offering a "Run" and a "Show" button, run would compile and run the actual .lpi/.lpr file and show would open project in IDE.
That data comes from the "script" file.

An example for a script could be looking like this (.ini file exemplary since its usage is enorm simple for everyone)
Code: Pascal  [Select][+][-]
  1. [project]
  2. MainFile=project1.lpi                <- what is project main file to use
  3. Parameter=                             <- special compiler parameter needed to compile project
  4. Description=TButton handling   <- small description about what this project cover
  5. LongDescription=project1.txt    <- long text file for the description
  6. BuildPath=                              <- a folder that be created for binary
  7. SnapShots=image1.png           <- a comma seperated list of path+image filename, for basepath no path is needed to add
  8.  
Having such kind of file in each directory for all projects helps you to create an automated way of doing if you understand my meaning.

So you just need to crawl thru all folders, find the script file and store data in your app to be used at runtime.
Title: Re: Juggling Multiple Lazarus Projects
Post by: dbannon on December 04, 2022, 12:36:42 pm
We really need to get you using -main KodeZwerg !

I guess when I would want to do such project, I would invent my own little scripts that be loaded at runtime into my app, txt/xml/json/whatever....
I called them example metadata files, <projectname>.ex-meta, json !

So I would have a prepared ListView (one visible column for a mini project description and invisible columns for filepath and parameter switches)
Image attached !

Optional have some TImage display snapshot of GUI showing the used control.
We forgo the images now because of the size issues but its possibly an online system might develope in the future.

Offering a "Run" and a "Show" button, run would compile and run the actual .lpi/.lpr file and show would open project in IDE.
We "copy to Work Area" (because in some *nix installs, the main copy of the Examples is in read-only space). The IDE then opens automatically and displays the project. The user can, if they choose, press the Run button. Its pressing that Run button Aruna wants to avoid.

An example for a script could be looking like this (.ini file exemplary since its usage is enorm simple for everyone) .....
Pretty close, we also have Keywords and Categories to make searching easy. See attached image.

 :D

Davo

EDIT: But again, we are off topic, this is about juggling multiple Lazarus installs ...
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 04, 2022, 01:57:59 pm
Well, for me Enter works (though that is on Windows / not tested on Linux).
This is easily fixed with ListBox1KeyUp or ListBox1KeyDown and checking for #13.

Of course, "Enter works" once I selected the listview. By default it is on the filter edit. It would be a nice extension, if e.g. the up/down keys would affect the selection in the list, even while the filter has focus.... And then consequently enter could be made to work.... But that is another story.
If I remember right the TListBox has a built-in search functionality? I was actually wondering why David used a separate search text box? The way it is right now when searching the results are displayed only after you have typed in what your are searching for and then pressed the enter key. Until you press the enter key no possible matches/results are shown/updated. If we use the built-in functionality that comes with the TListbox when searching the results are updated instantly. Anyway, this is not a big issue I am just sharing what I found when I was testing. I am sure there must have been a very good reason he did things the way they are now. Then again this behaviour could be happening just on my Linux system?

Yes well, if you just quickly want to run each example that is a different usecase.
Yes there is a reason why I want to do this. I will get to that in my reply to what Juha has said in this thread. Have patience and have faith.

Well since compilation, needs to know about packages used by each example the only way you have is to run (TProcess or similar)
lazbuild demo.lpi and then run the exe.

So when you click, you will have the time that compilation takes... Unless you have a batch job, and precompile them all.

However you need to find where the final exe was put by lazbuild, otherwise you want be able to run it.
Not sure how to do that best. Maybe read the lpi, and see if an output for the exe is defined?
True and fair enough...
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 04, 2022, 02:22:49 pm
Alternatively, you could have a stand alone app that displays the list of examples (easily copied from existing exampleswindow code) and it would compile (using lazbuild) and run the resulting app (using, sorry, TProcess).
This is what I was also thinking. Aargh.. TProcess  eh? Oh well if there is no other way so be it  :-\

> .....which currently has 85 separate folders containing separate projects.

Please don't forget all the "other" example projects, there are many more in the Lazarus SRC tree associated with the relevant parts of Lazarus code. There are a touch over 200 from memory.
Oh dear I totally missed the other examples. Thank you for reminding me.

I cannot think of a practical way to do it otherwise. And, honestly, I don't see a need. In most cases, the value to the end user of the Examples is the chance to look at the code. yep, they might compile and run to ensure its the example they think it is but browsing across the code is the benefit.
Agreed 100% but there is a corner case which to me is rather important because 'I' had to go through that pain and grief and if I am able to do something that will make life easier for someone else and ensure they do not have to go through the same pain and grief, why not? Again this is just my own thoughts and opinion I am not asking/requesting changes or new implementations in the code. Things are fine the way they are.


Ps: What would be wrong with riding a push bike?
Nothing, but don't expect to see me riding one across the Simpson. https://www.traveller.com.au/dune-busters-crossing-the-simpson-desert-go0wjx and it will be over 45 degrees tomorrow.
Sweet Jesus, 45 degrees celsius?

> current weather up in Edmonton two days back was -29 degrees celsius so riding a push bike will keep you warm
Nothing, but don't expect to see me riding one across the Simpson. https://www.traveller.com.au/dune-busters-crossing-the-No, if its -29 outside, they should be waiting for the rescue team to arrive and take them away from such a terrible place.
You get used to it after a while. I have a friend he works at the Air base at Cambridge Bay way up north in Nunavut try Googling current weather Cambridge Bay, Nunavut. Actually let me just give you a screenshot and my apologies to everyone this is quite unrelated to coding or anything Pascal related but may make you appreciate the warmer weather you all may have  :)

 :D
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 04, 2022, 02:47:54 pm
Quote
In most cases, the value to the end user of the Examples is the chance to look at the code. yep, they might compile and run to ensure its the example they think it is but browsing across the code is the benefit.
Yes, the request sounds unusual. Usually, people want to look at an example project's forms and/or code for a while before running it. Also, pressing F9 is a rather small task.
Still, if somebody wants such an option, it makes no harm to others.
Hi, now let me try and clear up this mess I seem to have caused. I am not, I repeat not requesting any changes in the code. I was simply sharing my own experiences and observations.

Now think about this ok.. let us all forget for a moment that most of us here in the forum are highly experienced and veteran programmers who over the years have gained broad spectrum skill sets that only life can teach you. Let us go back to when we were all newbies who had never seen a line of code.

If you are coming in with absolutely nil/zero coding experience and are fortunate enough to stumble across the holy grail of all IDE's ( I like to call it that please do not ask why just makes me feel really good )what is the first thing you are going to be doing? Browsing through code you do not understand? Browing through code that in a few minutes is going to make you scream, pull out your hair possibly leave you bald for life and more importantly you will walk away. Because there was nothing you could see and immediately understand? That skill comes with experience and many long years of typing away on the keyboard before one can look at code and 'understand' what someone else has done.

So long years ago when I first looked around for tutorials on C there were not many available and the internet was in it's early infancy this was way back in 1990 or so. And the codebase I was looking at I did not understand neither did it have any GUI examples. So I  gave up and walked away and stuck with my trusted Clipper5.3 and dBaseIII and advantage database server and to keep our network alive we had Novell Netware.

Many years later, actually, decades later I stumbled across gtk2 and that codebase had examples ( Google GTK+ Demo ) and suddenly I had what was missing all these years. Something I could run and immediately see what that piece of code did. To a newcomer, this helps tremendously and is the key between someone walking away and getting involved. And Lazarus is growing and we need more people who can help and contribute. Again this is simply me sharing my thoughts this is not a request to change anything in our codebase. My apologies if at any time what I have said made anyone think I was asking for changes. I hope this will help clear up things.

Title: Re: Juggling Multiple Lazarus Projects
Post by: Martin_fr on December 04, 2022, 03:34:32 pm
Many years later, actually, decades later I stumbled across gtk2 and that codebase had examples ( Google GTK+ Demo ) and suddenly I had what was missing all these years. Something I could run and immediately see what that piece of code did.

Ok, ... And again I did not read the other thread, so I hope I do not duplicate.

I guess those gtk examples, you had to compile them yourself (gcc), or open them in an editor that could run gcc => so they are very likely like our examples....
Btw, my first exploration (decades ago) was to just drop stuff on the form designer, and use the Object inspector and run it. Did not need an example to figure that out...




Of course there are various expectations you could have towards examples:

1) Find out specifics about a component that you already know. IMHO that is what our examples do....

2) Find a component for a specific purpose / compare components. Probably less easy with what we have.

3) ...?


IMHO, 2 would be helped by having examples like
- Compare all type of buttons
- Compare all type of "text" (label, static-text, caption, OnPaint, ....)
....
Then you would still have to open the project and compile it. But you only need one or two projects that you look at.




The other part that would help (either use case) is improving the presentation....
- Better, more verbose descriptions
- Preview-Images. (2nd search window, to browse those images, rather than text)

Of course with 200+ images that's a lot of work: initial and maintenance.
And there will always be new demos that miss some part...



Worst is, we have so much info, that we don't even know if something already exists.
Maybe a wiki page. That wouldn't be interactive, yet it could list all buttons and describe the diffs.

Title: Re: Juggling Multiple Lazarus Projects
Post by: JuhaManninen on December 04, 2022, 07:22:05 pm
My apologies if at any time what I have said made anyone think I was asking for changes. I hope this will help clear up things.
Why do you apologize? Asking for changes is perfectly OK, but then you must be prepared for somebody opposing your suggestion. That is how FOSS development works.
It is basically a meritocracy. Those who contribute quality code get more voting power.
If you provided a patch that makes the ExamplesWindow to run a project after opening it, you would get much more attention and the patch would very likely be applied. Now it is just vague suggestion which nobody takes seriously.  :)

FYI:
I will study my ExamplesWindow bug further tomorrow and start a new thread about it.
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 04, 2022, 09:40:57 pm
[Edit] Oops, actually it works with a clean Lazarus configuration, like "./lazarus --pcp=~/.lazarus_test &".
The default config is old and must be corrupt somehow.
I must delete it and tweak the settings again. I will lose file and project history and some settings but it is OK.
Why not keep a backup of that old config? Then you do not lose anything  :) You delete that config all that history goes POOF!
Keep a back up and use it when ever you need to know project history and details?

How is it possible that nobody has noticed this?
Most experienced and knowledgeable programmers rarely look for examples. That could be why...  :)
Title: Re: Juggling Multiple Lazarus Projects
Post by: dbannon on December 05, 2022, 01:14:58 am
Sounds like you like to use keyboard commands while using a GUI.  Personally I use the mouse where ever possible in a GUI but when in a terminal window, thats where I use the keyboard. I am a vi user for example.
 
......It does give you a list of available examples but you are unable to select immediately using the list. Try pressing Enter and see. 

Thats because the tab order is set to [ Searchbox - ListView - .....]   
So, as the Window opens, the focus is on the SearchBox, thats the most likely thing the user wants to use. But you can, at any time, press tab, that moves you to the ListView, you can now cursor (up or) down to a target project and press Enter.

 
.....we have to run it by pressing F9 to see what it looks like.  More keystrokes again.
Or one click of the green triangle, its a GUI, use the Mouse Luke !

But don't forget, not all Example project have a GUI, several do something "behind the scene". For example, there is one that generates a PDF from some content, you only know its run by looking for a fresh PDF in the working directory.

 
Or once you select the example you have to copy it to the work area then open it.
No ! All you need do is double click on a project, that will select it, copy it to the work area, open the IDE on it. Its a GUI, use the mouse.

The way it is right now when searching the results are displayed only after you have typed in what your are searching for and then pressed the enter key.
Yes, there is no reason while I did not implement Search While You Type, there is even a comment in the code where I note that would be a better way, its easy. Maybe I will implement that. Further, it should remove the search prompt when you click into the search box, again something I should have done. (Incidentally, something my own app does do in similar circumstances)

And, while I was testing why you think the Enter key does not work, I have triggered an AV. Some some work on my part is needed !

Aruna, I suggest you make a standalone project that does what you want, as I suggested before, grab the code that reads the project meta data from Lazarus, uexampledata.pas in particular. Make something that works and then you can consider if it remains as stand alone or implement it as a Lazarus plugin (as the Example Window is). If people like it, they can choose to plug it in, if the developers like it, they can include it with eg, bigide. Its vastly easier and quicker to develop something standalone and later integrate it into a something like Lazarus. 

On the other hand, having it standalone may not be a bad idea, it means you could run it and look at a example project without disrupting the project you are working on. My solution to that is to open the Example source in a browser from the remote repository but GitLab's syntax highlighting leaves a lot to be desired.

As Linus says, shown me the code !

If you need any help, do not hesitate to ask, looks like I am going to be refreshing my memory of the present code right now anyway so good time to ask !

Davo
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 05, 2022, 05:34:18 am
I guess those gtk examples, you had to compile them yourself (gcc), or open them in an editor that could run gcc => so they are very likely like our examples....
Yes we had to use gcc but with a very strange set of flags I had not seen before
Code: Pascal  [Select][+][-]
  1. $ gcc -o simple simple.c `pkg-config --libs --cflags gtk+-2.0`
it was the first time I saw `pkg-config --libs --cflags gtk+-2.0` For anyone who may be interested the tutorial is still here:GTK2 C Tutorial/ (https://zetcode.com/gui/gtk2/)

IMHO, 2 would be helped by having examples like
- Compare all type of buttons
- Compare all type of "text" (label, static-text, caption, OnPaint, ....)
...
I am working on a demo that does this  :)
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 05, 2022, 05:38:11 am
Code: [Select]
[quote author=JuhaManninen link=topic=61473.msg462655#msg462655 date=1670178125]
It is basically a meritocracy. Those who contribute quality code get more voting power.
If you provided a patch that makes the ExamplesWindow to run a project after opening it, you would get much more attention and the patch would very likely be applied. Now it is just vague suggestion which nobody takes seriously.  :)
I am working on the code but taking things slow like I was advised to do  :)

FYI:
I will study my ExamplesWindow bug further tomorrow and start a new thread about it.
So what is the latest with your ExamplesWindow bug? In a new thread of course :)
Title: Re: Juggling Multiple Lazarus Projects
Post by: dbannon on December 05, 2022, 05:47:36 am
OK, patch submitted to fix that corner case AV I mentioned. And improves handling of the "Search Here" prompt as a user tabs or clicks in or out of the EditSearch Box.

https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40034

@Aruna
Quote
The way it is right now when searching the results are displayed only after you have typed in what your are searching for and then pressed the enter key.
Yes, there is no reason why I did not implement Search While You Type,
Wrong, I did in fact implement Search While You Type. I am not sure how Aruna thinks its not there, has been there since early days. With each keypress in the EditSearch, the contents of the ListView is updated.....

Davo

edit: typo
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 05, 2022, 06:45:09 am
Sounds like you like to use keyboard commands while using a GUI.  Personally I use the mouse where ever possible in a GUI but when in a terminal window, thats where I use the keyboard. I am a vi user for example.
 
That depends on what is involved at any given time and what I may be trying to do. It has been years since I last used vi, now a days most of the time I use Geany (https://www.geany.org/l)
You are aware we also have gVim (https://www.vim.org/download.php) right?

Or one click of the green triangle, its a GUI, use the Mouse Luke !
Tsk..Tsk.. Luke does not have the IDE CoolBar enabled so I do not have that green triangle. Just to prove a point (humour me ok) disable the mouse. Pull that USB cable out, please. If it's a wireless mouse pull out the dongle. Now enable that IDE CoolBar and if you are able to make that green triangle work using that keyboard I will never dispute or oppose anything ever again. Prove me wrong Yoda  :P I prefer not to assume anything about an end user's system ( especially guys like us ) who may have disabled the IDE CoolBar to regain some screen real estate or for whatever reason. 

But don't forget, not all Example project have a GUI, several do something "behind the scene". For example, there is one that generates a PDF from some content, you only know its run by looking for a fresh PDF in the working directory.
Ah.. thank you. Good to know..

Yes, there is no reason while I did not implement Search While You Type, there is even a comment in the code where I note that would be a better way, its easy. Maybe I will implement that. Further, it should remove the search prompt when you click into the search box, again something I should have done. (Incidentally, something my own app does do in similar circumstances)
Yes I saw that a few minutes back when I started to go through your code. No biggie we will fix things soon.

And, while I was testing why you think the Enter key does not work, I have triggered an AV. Some some work on my part is needed !
Huh? Say what? Oh my... FTW is a AV? Anti Virus? Audio Visual? AV as in Adult Video? Jokes aside I seriously have no clue what you meant by AV? Hope it is nothing serious.

Aruna, I suggest you make a standalone project that does what you want, as I suggested before, grab the code that reads the project meta data from Lazarus, uexampledata.pas in particular. Make something that works and then you can consider if it remains as stand alone or implement it as a Lazarus plugin (as the Example Window is). If people like it, they can choose to plug it in, if the developers like it, they can include it with eg, bigide. Its vastly easier and quicker to develop something standalone and later integrate it into a something like Lazarus.
Yes David your absolutely right and spot on and this is what I think I will try and do. I also felt a plugin will be the best way to go.

On the other hand, having it standalone may not be a bad idea, it means you could run it and look at a example project without disrupting the project you are working on. My solution to that is to open the Example source in a browser from the remote repository but GitLab's syntax highlighting leaves a lot to be desired.
I actually once opened up two separate instances of Lazarus IDE and opened two different projects and had absolutey no issues switching between them Lazarus managed everything beautifully. I was again amazed and humbled.

As Linus says, shown me the code !
Uh-Uh and Hell NO! Very bad idea. I am not showing Linus anything until we have this working bug free. Even then am not showing him anything. Yes I am scared of Linus and GregKH and I am even more afraid of Valdis but that is another story for another time.

If you need any help, do not hesitate to ask, looks like I am going to be refreshing my memory of the present code right now anyway so good time to ask !
Thank you very much David for offering to help. Yes I will need help understanding what you have done in the 'package' the *.lpk I meant. Please try to understand what may be obvious to you may not be so visible to a new comer like me so have patience when I may ask silly questions. It is 42 minutes after midnight here in Toronto been a long day for me I am a wee bit tired so will be calling it a day soon. I will take you up on that offer come tomorrow morning.

Thank you once again for your patience and sense of humour.

Aruna
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 05, 2022, 07:13:13 am
Wrong, I did in fact implement Search While You Type. I am not sure how Aruna thinks its not there, has been there since early days. With each keypress in the EditSearch, the contents of the ListView is updated.....
David please watch this to the very end very carefully: Examples Window Seach Text Not Updating ListBox (https://youtu.be/sSbfbrRiJyA) it is only 3 minutes.
Title: Re: Juggling Multiple Lazarus Projects
Post by: dbannon on December 05, 2022, 07:36:57 am
You are aware we also have gVim (https://www.vim.org/download.php) right?
Hmm, that probably reinforcess my point. In Text mode, use Text tools. In GUI mode, use GUI tools. There is a pattern there ....

Tsk..Tsk.. Luke does not have the IDE CoolBar enabled so I do not have that green triangle. Just to prove a point (humour me ok) disable the mouse.
Now I understand, have I got a solution for you !  Open a terminal, type fp and press enter. Problem solved.

My work here is done.     O:-)   Queue the riding off into the sunset music .....

(The CoolBar buttons are speed buttons, they don't have a tab stop. But, honestly, Lazarus is meant to be used with a full GUI. Running it without the cool CoolBar really does not make sense IMHO. But even without the green triangle, there are Menu short cuts and they a do have tab stops .....)

Quote
Oh my... FTW is a AV? Anti Virus? Audio Visual? AV as in Adult Video? Jokes aside I seriously have no clue what you meant by AV? Hope it is nothing serious.
An Access Violation, for this purpose (only), a Seg Fault https://xkcd.com/371/

Quote
Watch this video ...
What, after you mention Adult Videos ?  Ok, I watched it, very unexpected. I note that you have only 166 Examples available. Are you sure you are using lazarus-main from the Official Lazarus gitlab site ?  https://gitlab.com/freepascal.org/lazarus/lazarus  ?
There should be about 205 Example Projects, has been for over six months.

Or, perhaps, are you running very old hardware that is not updating in time ?  I wonder if I should have a checkbox, "Do NOT SWYT" for people who's systems are not capable of keeping up with the demand.

OK, so, now you have had time, what do you think of the cool (but no coolbar) fp text IDE ?

Davo
Title: Re: Juggling Multiple Lazarus Projects
Post by: JuhaManninen on December 05, 2022, 09:10:51 am
So what is the latest with your ExamplesWindow bug? In a new thread of course :)
I created a new thread "Bugs in Example Projects window".

BTW, please provide your fixed / improved version of the TestAll project at some point so we can add it to lcl/tests or somewhere.
The latest changes in "main" for TestAll before it was deleted should be included.
Title: Re: Juggling Multiple Lazarus Projects
Post by: Martin_fr on December 05, 2022, 01:09:37 pm
Wrong, I did in fact implement Search While You Type. I am not sure how Aruna thinks its not there, has been there since early days. With each keypress in the EditSearch, the contents of the ListView is updated.....
David please watch this to the very end very carefully: Examples Window Seach Text Not Updating ListBox (https://youtu.be/sSbfbrRiJyA) it is only 3 minutes.
Interesting, may be a linux bug.
On Windows the list is filtered while I type.

@dbannon: That should be a filter edit (there is a special control). The "Search here" should be .TextHint, i.e. you don't need to clear it...
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 05, 2022, 01:18:53 pm
Now I understand, have I got a solution for you !  Open a terminal, type fp and press enter. Problem solved.
Oh man this is a blast from the past and I suppose that is one way to solve a problem. Thank you I have a new toy.

My work here is done.     O:-)   Queue the riding off into the sunset music .....
45 degrees you said? Riding off into the Simpson desert sunset is going to make Mr.Clint Eastwood have issues because that is his job :-D

(The CoolBar buttons are speed buttons, they don't have a tab stop. But, honestly, Lazarus is meant to be used with a full GUI. Running it without the cool CoolBar really does not make sense IMHO. But even without the green triangle, there are Menu short cuts and they a do have tab stops .....)
Relax I was just messing with the IDE, the CoolBar will be enabled but after I am done testing and messing with the ide first. Know your tools well said Yoda to Luke and Luke said to yoda ya-ya I know... use the mouse Luke :-D

An Access Violation, for this purpose (only), a Seg Fault https://xkcd.com/371/
Serious request here please consider expanding any and all acronyms after this. I had no idea what AV meant and there may be others out there who are lost just like I was.
Quote
Watch this video ...
What, after you mention Adult Videos ?  Ok, I watched it, very unexpected. I note that you have only 166 Examples available. Are you sure you are using lazarus-main from the Official Lazarus gitlab site ?  https://gitlab.com/freepascal.org/lazarus/lazarus  ?
There should be about 205 Example Projects, has been for over six months.
See..? I was not fibbing and I am not sure which branch I am on but I will now delete everything and start from scratch with lazarus-main.

Or, perhaps, are you running very old hardware that is not updating in time ?
Here you go this is  my setup: system info bare metal and friends (https://arunajh.neocities.org/davo/system.html) you tell me if it's ancient hardware or not.

I wonder if I should have a checkbox, "Do NOT SWYT" for people who's systems are not capable of keeping up with the demand.
[/quote] Please don't not even in jest. Never discourage anyone from exploring the codebase or going bald by doing so. Some folks take things literally and may simply walk away after reading something like "Do NOT SWYT"

OK, so, now you have had time, what do you think of the cool (but no coolbar) fp text IDE ?
First impression was omg this is sweet. I am yet to do anything useful with it. But definitely beautifully designed text interface very impressive. Now Luke has to get text mode fp ide to talk to the mouse. Just kidding mouse works fine in my shell/terminal.  :D
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 05, 2022, 01:25:38 pm
So what is the latest with your ExamplesWindow bug? In a new thread of course :)
I created a new thread "Bugs in Example Projects window".

BTW, please provide your fixed / improved version of the TestAll project at some point so we can add it to lcl/tests or somewhere.
The latest changes in "main" for TestAll before it was deleted should be included.
Hi Juha I will be happy to send it in please give me a little more time.
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 05, 2022, 03:09:22 pm
Interesting, may be a linux bug.
Yes could be a linux bug or could be just my system. Debian is usually rock solid, stable and robust with zero surprises this being said when it does decide to surprise you things are definitely no longer fun  :) 

@dbannon: That should be a filter edit (there is a special control). The "Search here" should be .TextHint, i.e. you don't need to clear it...
@Martin_fr  please have a look at this, we already have this functionality built in to TListBox: TListBox built-in search+filter functionality (https://youtu.be/PfuiRoJxpc8)
Title: Re: Juggling Multiple Lazarus Projects
Post by: JuhaManninen on December 05, 2022, 06:48:35 pm
@Martin_fr  please have a look at this, we already have this functionality built in to TListBox: TListBox built-in search+filter functionality (https://youtu.be/PfuiRoJxpc8)
Why? Because the Examples window does not use TListBox. It uses TListView.
Besides the feature in TListBox you demonstrated is a search, not a filter, and it depends on a widgetset's native behavior. May not work the same on every platform.
Title: Re: Juggling Multiple Lazarus Projects
Post by: Aruna on December 05, 2022, 08:56:29 pm
@Martin_fr  please have a look at this, we already have this functionality built in to TListBox: TListBox built-in search+filter functionality (https://youtu.be/PfuiRoJxpc8)
Why? Because the Examples window does not use TListBox. It uses TListView.
Besides the feature in TListBox you demonstrated is a search, not a filter, and it depends on a widgetset's native behavior. May not work the same on every platform.
Oh dear, you are right I am using GTK and that could very well be native behaviour I totally forgot that.
TinyPortal © 2005-2018