* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
LCL / Re: Output from TProcess breaks lines over 80 characters
« Last post by marcov on Today at 12:19:27 pm »
Tprocess is binary, but doesn't return "whole" lines. So it might read in 80 bytes increments, but that is windows.

Probably the adding to a memo adds the linefeeds.

So you need to buffer what you read in the tprocess loop till you have a line  with a (cr)lf, and only then pass to memo.
2
LCL / Re: Output from TProcess breaks lines over 80 characters
« Last post by gnu_trisquel on Today at 12:06:22 pm »
A little less than enough information, like who makes it exceed 80 characters?

It's the command-line tool that output lines over 80 characters. It seems like the TProcess assumes the maximum length per line is 80 and automatically add a #13 + #10 (CR) to break the lines. I tried to filter this out, but this will also filter out the CRs that's supposed to be there and multiple lines will now be on one line.

I can't guarantee other command-line tools. but I guess a solution would be to change my own comand-line tool so it splits the messages into multiple lines.


I'm not sure, but can't you simply enable scrollbars for your memo ? Then it won't break lines.

It's not related to the memo component, I can type longer lines manually.
3
LCL / Re: Output from TProcess breaks lines over 80 characters
« Last post by marcov on Today at 11:40:31 am »
I'm not sure, but can't you simply enable scrollbars for your memo ? Then it won't break lines.
4
General / Re: How to scroll up?
« Last post by Ñuño_Martínez on Today at 11:30:47 am »
I guess, mean that you cannot use e.g. the Up and Down arrow keys to scroll through the  input line history (...)
I never had such behavior, no matter the input method or operating system I use. %)
At least under WinXP, Windows8, Windows 7 (32 and 64-bit) it is available for all FPC versions (not surprising, because as I said it is a feature of the OS). But with Raspi/Debian it does not work (at least not with Up/Down arrow, which are echoed as ^[[A and ^[[B without further action).
WindowsXP?  May be it is because I use MSYS (MingW32 POSIX-like shell) that I never realized that.
5
LCL / Re: Output from TProcess breaks lines over 80 characters
« Last post by Leledumbo on Today at 11:20:44 am »
A little less than enough information, like who makes it exceed 80 characters? It can be both the executing and executed program. Personally I would do:
Code: Pascal  [Select]
  1. UseForm.MemoTerminal.Lines.Text := UseForm.MemoTerminal.Lines.Text + ReadBuffer;
  2. ReadBuffer := '';
  3. UseForm.MemoTerminal.Update;
  4.  
instead in UpdateTerminal.

There's a little dangerous point in the output reading code:
Code: Pascal  [Select]
  1. SetLength(ReadBuffer, RunProcess.Output.NumBytesAvailable); // (1)
  2.  
  3.         RunProcess.Output.Read(ReadBuffer[1],
  4.          RunProcess.Output.NumBytesAvailable); // (2)
  5.  
(2) may be larger than (1) and that can cause buffer overflow. Save it to a local variable before SetLength and use the same variable for Read, that's the safe way.
6
Excellent, thaats great to know. I am currently thinking that the best way may well be to form some kind of team on here. Ill update the post shortly with further information.
7
Beginners / Re: Find repeated elements in an array.
« Last post by Bart on Today at 11:12:48 am »
So you want to know if a given character is in the string to be guessed, and if so in which positions?
Can the "characters" also be diacritics (like ä, ë €)?
If so, then you need to know wether your string is encoded as single byte (old Windows/DOS codepages) or possibly as UTF8.

Suppose it is single byte encoded for now.
Untested code!!

Code: Pascal  [Select]
  1. function Contains(Ch: Char; const S: String; out Arr: TDynIntArray): Boolean;
  2. var
  3.   i: Integer;
  4. begin
  5.   Arr := nil;
  6.   Result := False;
  7.   for i := 1 to length(S) do
  8.   begin
  9.     if Ch = S[i] then
  10.     begin
  11.       Result := True;
  12.       SetLength(Arr, Length(Arr)+1);
  13.       Arr[High(Arr)] := i;
  14.     end;
  15.   end;
  16. end;

The function retruns True if Ch can be found in S.
If the result = True then Arr contaisn the positions at which Ch can be found in S.

@Everybody else: this can of course be optimized for speed, but since user interaction will be orders of magnitude slower then this code, I did not bother.

Bart
8
Documentations on Delphi are good guides for Lazarus beginners.
9
General / Re: Please make your language more freedom
« Last post by Handoko on Today at 10:56:35 am »
Have you tried these:

Gambas
Although not fully compatible but you can think it is as a VB/VB.net for Linux.
https://en.wikipedia.org/wiki/Gambas

FreeBASIC
It is a multi platform BASIC compiler, it provides syntax compatibility with programs originally written in Microsoft QuickBASIC.
https://en.wikipedia.org/wiki/FreeBASIC

QB64
A self hosting BASIC compiler. It can be used to write simple Android app.
https://en.wikipedia.org/wiki/QB64

They all are free and look interesting.
10
General / Re: How to open .dbf (Convert from Delphi)
« Last post by af0815 on Today at 10:41:41 am »
If you have Pix.DB and/or any Pix.MB, Pix.PX, Pix.XG0, Pix.YG0 etc... files then you probably have paradox table files
Quote from: Jayndel
wrote: dbPix.TableType   := ttDBase 
In BDE you must select the drivers and this says IMHO DBase (not ttParadox)

see: http://docwiki.embarcadero.com/RADStudio/Tokyo/de/Tabellentyp_f%C3%BCr_lokale_Tabellen_angeben
Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus