Forum > General
Writer.WriteDescendent SIGSEGV error on calling CreateLFMFile
matthius:
Hello !
I want to create a LFM file from a registered form TF_FormDico.
But there is a SIGSEGV error on Writer.WriteDescendenton calling CreateLFMFile.
What can i do ?
speter:
What can you do?
Easy, provide some code! :)
cheers
S.
matthius:
Here it is :
--- 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";}};} ---function fb_CreateForms ( var amif_Init : TIniFile; const as_destination : String ) : Boolean;var li_i : Integer; LFileLFM : TFileStream; aform : TF_XMLForm; aformdico : TF_Formdico;Begin FreeAndNil(gxdo_FichierXML); if fb_CreateProject ( amif_Init, Application ) and fb_LoadXMLFile ( gxdo_FichierXML, fs_getLeonDir + gs_ProjectFile ) Then Begin Result := True; // La fenêtre n'est peut-être pas encore complètement créée gchar_DecimalSeparator := ',' ; DecimalSeparator := gchar_DecimalSeparator ; for li_i:=0 to High(ga_Functions) do with ga_Functions [ li_i ] do Begin aform:=fxf_ExecuteAFonction ( li_i, true ); aformdico := TF_FormDico.Create(Application); aform.p_exchangeSources(aformdico); if Assigned(aform) Then try LFileLFM := TFileStream.Create(as_destination+Clep+'.lfm',fmCreate); CreateLFMFile(aformdico,LFileLFM); finally LFileLFM.Destroy; aform.Destroy; aformdico.Destroy; end; end; End Else Result := False; end;
The source is here :
https://sourceforge.net/p/xml-frames-vrad-lazarus/code/ci/default/tree/XMLToLFM/u_createproject.pas
https://sourceforge.net/p/xml-frames-vrad-lazarus/code/ci/8a78bcb3267b78a2a4b71e99bcb129c9505b3345/tree/demos/weo_firebird/builder.lpi
matthius:
I want to create a lfm file with every porperties saved. I do not want to select some properties because there are a lot to save.
What is the method which save properties on TApplicationProperties ?
lucamar:
TApplicationProperties is not meant to save/load properties; for that one should rather use the form's SessionProperties along with any of the TFormPropertyStorage descendants (TIniPropStorage, TXMLPropStorage, etc.), which have convenient events which are called before/after saving/restoring and allow you to store any additional value you might want.
An example, from one of my own apps, which loads a Memo after reading the file name from a TXMLPropStorage instance on application restart:
--- 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";}};} ---procedure TMain.RestoreProperties(Sender: TObject);begin CurrentFile := XMLStore.ReadString('File', ''); if CurrentFile = FDefaultFile then CurrentFile := ''; if (CurrentFile <> '') and FileExists(CurrentFile) then Memo.ReadFromFile(CurrentFile) else if FileExists(FDefaultFile) then begin Memo.ReadFromFile(FDefaultFile); Memo.Filename := ''; end; Timer.Enabled := itOptionsTimer.Checked;end;
Navigation
[0] Message Index
[#] Next page