Re: [Lazarus] StringGrid1.SaveToCSVFile - UTF-8 with BOM
Thank you Mattias and Michael for your help! procedure TForm1.ButtonSaveClick(Sender: TObject); const UTF8BOM = #$EF#$BB#$BF; var s: String; fs: TFileStream; begin s := ChangeFileExt(Application.ExeName, '.csv'); try fs := TFileStream.Create(s, fmCreate); fs.Write(UTF8BOM, SizeOf(UTF8BOM)); StringGrid1.SaveToCSVStream(fs, ';', True, False); finally fs.free; end; end; On 10 March 2018 at 17:25, Michael Van Canneyt via Lazarus < lazarus@lists.lazarus-ide.org> wrote: > > > On Sat, 10 Mar 2018, Mattias Gaertner via Lazarus wrote: > > On Sat, 10 Mar 2018 16:57:08 +0100 >> Sandro Cumerlato via Lazarus <lazarus@lists.lazarus-ide.org> wrote: >> >> Hello, >>> how can I save StringGrid content to a CSV file encoded to "UTF-8 with >>> BOM" >>> format? (as default it is saved to "UTF-8 without BOM" format) >>> >> >> var >> s: string; >> ms: TMemoryStream >> >> ms:=TMemoryStream.Create; >> try >> s:=UTF8BOM; >> ms.Write(s[1],length(s)); >> Grid.SaveToCSVStream(ms) >> ms.Position:=0; >> ms.SaveToFile('foo.csv'); >> finally >> ms.Free; >> end; >> > > You can also just use a filestream ? > > Michael. > > -- > ___ > 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
[Lazarus] StringGrid1.SaveToCSVFile - UTF-8 with BOM
Hello, how can I save StringGrid content to a CSV file encoded to "UTF-8 with BOM" format? (as default it is saved to "UTF-8 without BOM" format) Thank you in advance for your help! Sandro Cumerlato -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] ComparePoints func
IMHO you should consider 5 cases: P1 = P2 and the four quadrants https://en.m.wikipedia.org/wiki/Quadrant_(plane_geometry) - Quadrant I should correspond to > - Quadrant III should correspond to < - What about quadrants II and IV? You could compare your point to Y = -X line to reduce your study to 3 cases. Best regards Sandro Cumerlato On Jul 26, 2017 6:27 PM, "Alexey via Lazarus"wrote: On 26.07.2017 18:11, Graeme Geldenhuys via Lazarus wrote: > ComparePoints() returning a Integer is not a very friendly return type > either, > Hm, in my app Int makes sense: i need to compare Points in binary search, and see: >, <, =. -- Regards, Alexey -- ___ 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] ComparePoints func
What do you think about: function ComparePoints(P1, P2: TPoint): TPoint; begin Result.X := (P1.X - P2.X); Result.Y := (P1.Y - P2.Y); end; Best regards. Sandro Cumerlato On Jul 26, 2017 3:56 PM, "Alexey via Lazarus"wrote: I think LCL has many Compare funcs, but misses func for TPoint. Here it's comparing x/y screen coordinates function ComparePoints(P1, P2: TPoint): integer; begin if (P1.X=P2.X) and (P1.Y=P2.Y) then exit(0); if (P1.Y>P2.Y) then exit(1); if (P1.Y P2.X) then exit(1) else exit(-1); end; -- Regards, Alexey -- ___ 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] Questionnaire GUI component
Thank you Mattias, unique names solved the issue, I was wrongly naming frames: MyFrames[i].Name := Format('Frame%d', [i]); Last question: I am creating Frames within a ScrollBox, but it look like there is a limit of the ScrollBox height to 32768 pixels. I'd like to display up to 500 questions (Frames), how can I solve this issue? [image: Inline images 1] On 30 June 2017 at 22:59, Mattias Gaertner via Lazarus < lazarus@lists.lazarus-ide.org> wrote: > On Fri, 30 Jun 2017 22:46:17 +0200 > Sandro Cumerlato via Lazarus <lazarus@lists.lazarus-ide.org> wrote: > > > Thank you Adrian for your reply, > > I can create a good layout with Frames, but it looks like I cannot create > > multiple frames on the same form... Duplicate name: A component named > > "Frame1" already exists. > > > > I tried to create an array of Frames at runtime: > > > > Question 1? (Option A) (Option B) > > Question 2? (Option A) (Option B) > > Question 3? (Option A) (Option B) > > Question 4? (Option A) (Option B) > > ... > > Question 200? (Option A) (Option B) > > > > > > var > > MyFrames: array[1..200] of TFrame1; > > > > > > Where am I wrong? > > Give your frames unique names. > > DisableAutoSizing; > try > for i:=1 to 200 do begin > MyFrames[i]:=TFrame1.Create(Self); > with MyFrames[i] do begin > Name:='MyFrame'+IntToStr(i); > Top:=i*Height; > Parent:=Self; > end; > end; > finally > EnableAutoSizing; > end; > > > Mattias > -- > ___ > Lazarus mailing list > Lazarus@lists.lazarus-ide.org > http://lists.lazarus-ide.org/listinfo/lazarus > -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] Questionnaire GUI component
Hello, I need a GUI component to implement a Questionnaire (label + combo boxes right aligned), all in a line like this: Question 1? (Option A) (Option B) Is it already available or can you please suggest me a way to implement it quickly? (TComboBox is not what I am looking for) Thank You in advance. Sandro Cumerlato -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Configure IDE dlg tab-set
With Michael explanation it looks like the best solution. Sorry for my misunderstanding. Sandro On 23 Apr 2017 10:30, "Graeme Geldenhuys via Lazarus" < lazarus@lists.lazarus-ide.org> wrote: > On 2017-04-23 07:21, Alexey via Lazarus wrote: > > This dialog has one tabset -from PageControl, and another - from left > > Listbox/Listview. Confusing. Better leave one Listbox. > > I kind-of see what you mean - duplicated information. The idea was > probably to have the "error state" available for all settings involved. > Obviously that can be resolved too. Simply remove the listbox and then > place error state icons in the tabs where applicable. So you will still > get an overview of what settings are wrong. > > Regards, > Graeme > > -- > fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal > http://fpgui.sourceforge.net/ > > My public PGP key: http://tinyurl.com/graeme-pgp > -- > ___ > Lazarus mailing list > Lazarus@lists.lazarus-ide.org > http://lists.lazarus-ide.org/listinfo/lazarus > -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Configure IDE dlg tab-set
Good idea! +1000 Sandro On 23 Apr 2017 10:49, "Michael Van Canneyt via Lazarus" < lazarus@lists.lazarus-ide.org> wrote: You can achieve the same with a status icon on the tabs. *If* something needs to be removed, I would remove the listbox. It only takes up a lot of space, and it's mostly empty. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Configure IDE dlg tab-set
If I have understand correctly, it is better to have only one list. I prefer the left Listbox. Sandro On 23 Apr 2017 10:17, "Michael Van Canneyt via Lazarus" < lazarus@lists.lazarus-ide.org> wrote: > > > On Sun, 23 Apr 2017, Alexey via Lazarus wrote: > > This dialog has one tabset -from PageControl, and another - from left >> Listbox/Listview. Confusing. Better leave one Listbox. >> >> Picture. >> > > Can you explain in more detail what is wrong with the dialog ? > > I look at this picture, and I see absolutely nothing wrong or confusing > about it ? > > Michael. > -- > ___ > Lazarus mailing list > Lazarus@lists.lazarus-ide.org > http://lists.lazarus-ide.org/listinfo/lazarus > -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Configure IDE dlg tab-set
On 23 Apr 2017 10:30, "Graeme Geldenhuys > Simply remove the listbox and then > place error state icons in the tabs > where applicable. So you will still get > an overview of what settings are > wrong. -1 IMHO left ListBox is better because error states are visible even if tab is not selected. I would convert right tabs to frames or something similar. Sandro -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Configure IDE dlg tab-set
+1 Better leave left Listbox. Sandro On 23 Apr 2017 08:21, "Alexey via Lazarus"wrote: > This dialog has one tabset -from PageControl, and another - from left > Listbox/Listview. Confusing. Better leave one Listbox. > > Picture. > > -- > Regards, > Alexey > > > -- > ___ > Lazarus mailing list > Lazarus@lists.lazarus-ide.org > http://lists.lazarus-ide.org/listinfo/lazarus > > -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] ScrollBox and Touchscreen interaction
Current SVN trunk. Under Windows 10. Sorry for the missing info. Sandro Cumerlato 2017-04-07 23:16 GMT+02:00 Ondrej Pokorny via Lazarus: > Lazarus version? > > Ondrej > -- > ___ > Lazarus mailing list > Lazarus@lists.lazarus-ide.org > http://lists.lazarus-ide.org/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] SVG Editor or Viewer
Hello Lars, I think you are talking about LazPaint: https://github.com/bgrabitmap Pure Lazarus/FPC code FPVectorial (under development) can read/write SVG files. If you only need a viewer and can rely on external libraries then take a look at Cairo+LibRsvg: https://github.com/DJMaster/cairo-fpc https://github.com/DJMaster/librsvg-fpc Best regards, Sandro Cumerlato On 30 Jan 2017 05:39, "Lars via Lazarus"wrote: > Does anyone know of any Lazarus projects or code that views SVG files... > > I remember there was some graphics editing program written in lazarus > (multiple images not just svg format) and I think it was closed source. > > Or any delphi svg editors (that could potentially be converted to lazarus)? > > Or mseide (unlikely, and that would be off topic) > > Thanks > -- > ___ > Lazarus mailing list > Lazarus@lists.lazarus-ide.org > http://lists.lazarus-ide.org/listinfo/lazarus > -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] LazarusIDE - Component Palette - OnMouseWheel
Hello, I've noticed that the Component Palette is not rendered properly after an OnMouseWheel event over it. Look at the attached image to see what I mean. I've also noticed a frequent flickering of the LazarusIDE main menu. OS: Windows 10 Lazarus: svn trunk Best regards. Sandro Cumerlato -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus