lazarus

Catching stack-trace in Free Pascal

I have a console application written in Free Pascal, that like most larger applications sometimes crashes. As this application is live, I usually ask people to write me down the stack-trace on crash -- I distribute it with both debug and lineinfo. However, the application uses FPC video.pas output, and sometimes the text output stacktrac...

Populate a TTreeView With Directory Tree And Filtering

On a Lazarus 0.9.28.2 project I have a TTreeView, with the name DirTree on my Form(frmConvert), but I want to populate it with all the directory tree, since C:\. Like this: And when the user select the directory, in the second TTreeView, with the name FileTree, appear all the files in that directory, but filtered to show only PDFs. A...

Output Of a Process

I'm developing a program using Lazarus, that execute gcc: var AProcess: TProcess; begin if SaveDialog1.Execute then AProcess := TProcess.Create(nil); AProcess.CommandLine := 'gcc.exe ' + SaveDialog1.FileName + ' -o ' TextField23.Text; AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes]; AProcess.Execute; AProcess.Free; en...

Use Controls Of Another Form

I have a project on Lazarus that have two Forms, FormMain and OutputForm. I want to show a output on OutputMemo at the second Form with this code: procedure FormMain.ShowButton(Object: Sender); begin if SaveDialog1.Execute then AProcess := TProcess.Create(nil); AProcess.CommandLine := 'gcc.exe ' + SaveDialog1.FileName + ' -o ...

TOpenDialog And Spaces

I have a project on Lazarus that I want to compile a source using gcc, for this I have a TOpenDialog called OpenDialog1 and a TProcess called AProcess. I call gcc with this code: procedure TFormMain.btCompileClick(Sender: TObject); begin if OpenDialog1.Execute then begin AProcess := TProcess.Create(nil); try AProcess....

Store The Content Of The Selected Line Of a TListBox On a Variable

I'm developing a ebook manager on Lazarus, but I'm having some troubles with a component that I've never used(TListBox). On the TListBox named CategoryList, I have these items: Literature and Fiction Romance Computers and Internet Poetry Professional and Technical Science Fiction and Fantasy Biographies and Memoirs Busi...

Which radio button is selected in a TRadioGroup?

As you can see in my question history, I'm developing a eBook manager, that will be open-source and I will release it in about 10 days, but I have a TRadioGroup, as you can see: And I want to store somethings in a variable(that needs to be a Integer) that will be "linked" with this TRadioGroup. I need to do a if function like this: ...

Convert Integer Into String

I have a some numbers stored in a Integer called mode, but I need to use they in a TProcess. For this I need to convert the Integer into a String, because if I don't do this, I got the error: Incompatible types: got "LongInt" expected "AnsiString" Then I want to know how I can convert a Integer into a String? ...

Hide Console When Executing a TProcess

I'm building a application that uses a TProcess called AProcess like this: procedure TFormMain.btCompileClick(Sender: TObject); begin AProcess := TProcess.Create(nil); try AProcess.CommandLine := 'gcc.exe "' + OpenDialog1.FileName + '"' + ' -o "' + OpenDialog2.FileName + '"'; AProcess.Options := AProcess.Options + [poW...

Problem with Splash Screen in Lazarus app

I am porting a Delphi application to FPC/Lazarus and this application shows info in splash screen. When unit has initialization section then this initialization section calls something like: Splash.Info(unit_name) This works in Delphi, but when I compiled this using FPC/Lazarus then I got exception when I create form with splash scre...

Check For Updates

I'm developing a application in Lazarus, that need to check if there is a new version of a XML file on every Form_Create. How can I do this? ...

Listing Files On Directory On a TListView

I'm building a program that needs to on Form_Create, populate a TListView called FileList, the directory that I want to populate is where the compiled program is + \Files, as I never used a TListView I want to know how to do this? ...

Porting From Windows To Linux

I have a project written in Lazarus on Windows, but I want to cross-compile it for Linux on my Windows computer. How can I do this? ...

Remove Path From File Name

I'm developing a program that needs to parse the file name into a TTextField. How to remove the file extension I've already know(or think that I can do like this): var FName: String; FPath: String; begin FPath := OpenDialog1.FileName; FName := ChangeFileExt(FPath, ''); end; But how can I remove the file path from FName? ...

How Is Syntax Highlighting Built?

I'm now building a developers editor using Lazarus and as every good developers editor, it needs to have a syntax highlighting, because of this that I want to know some things: How is syntax highlight normally built(using many ifs to change the font on a TextField? TSynEdit is very nice to do this? How to use TSynEdit(links and resourc...

DLLImport crash in Mono (linux): icall_wrapper_mono_marshal_free

I'm stucked with a problem with Mono Interop in Linux. I have a native shared library (made in Lazarus) that I need to use in a C# assembly. The shared library is used by a Mono C# assemblie on Windows and on Linux. The assembly loads the shared library via DllImport at runtime, and calls an exported function that generates a file and r...

Problem with WM_COMMAND on Lazarus/FPC

I have form with MainMenu and I want to intercept when the user selects a command item from a menu. This works in Delphi: type TForm1 = class(TForm) ... // Memo and MainMenu created protected procedure WMCommand(var Info: TWMCommand); message WM_COMMAND; end; procedure TForm1.WMCommand(var Info: TWMCommand); begin if (...

Publishing a property in a Lazarus component raises an 'Access violation'

Hi all, in Lazarus on Linux, I registered a class as a component, so that I can drop it on a form. Works like a charm, except that the properties that I can publish are limited to simple types like strings and integers. Whenever I try to publish a property like a TStringList or a TImage, it raises an 'Access Violation' when I click on ...

In Lazarus, how to check whether a MenuItem has a Bitmap assigned?

Hi all, I wrote some Lazarus code that loops through the menu items of the main menu and needs to see whether there's a bitmap assigned to each menu item. I tried to check with if Assigned (MenuItem.Bitmap) then... but this always returns true, whether a bitmap is assigned or not. Guess the bitmap will be filled with an empty one i...

Exist a tool to convert DFM files to sourcecode?

I'm porting a app to FreePasal/Lazarus & found that their form converter is not good. I have a small utility app, and each time I do a change I need to reconvert, relayout and reimport graphics. Plus, some things are messed up. I wonder if exist a automatic tool for convert the DFM files to delphi sourcecode, so I can do this more easil...