Leaderboard
Popular Content
Showing content with the highest reputation on 02/09/22 in Posts
-
best way to structure an application
aehimself replied to al17nichols's topic in RTL and Delphi Object Pascal
No need for a launcher, a single .EXE can do it - at least on Windows. Windows allows to rename the executable even if your application is running. So the steps are... - Download the updated .exe, and save it e.g. .exe.new - Rename the current application (Application.ExeName) to .exe.old - Rename the updated file .exe.new -> .exe - Launch the .exe and immediately quit - It's a good practice to wait for the previous process to actually die before doing any actual work, like reading settings up, etc. - Upon startup check and delete any .exe.old files I'm using this method and it works like a charm. -
Please see these earlier posts on SynEdit history: SynEdit preferred version? - Delphi Third-Party - Delphi-PRAXiS [en] (delphipraxis.net) Turbo SynEdit & Font Ligatures - VCL - Delphi-PRAXiS [en] (delphipraxis.net) DirectWrite and Unicode support One of the major flaws of SynEdit was the poor handling of Unicode. A major update has been committed to the TurboPack fork, that employs DirectWrite for text painting and fixes Unicode support. SynEdit should now be on a par with, if not better than, the best editors around with respect to Unicode handling. For example: Chinese is properly spaced and surrogate pairs and color emojis are fully supported: Bidirectional text editing is fully supported as well: WordWrap has been re-written and is now based on DirectWrite as well. This last update also includes other enhancements as for example an option to alpha blend the selection, another option for selection to cover just selected text instead of full lines, as in VS code and other editors, and horizontal mouse wheel scrolling: Other recent improvements: The undo/redo system was buggy and a mess, getting in the way of implementing new features. I has been reimplemented from scratch. The gutter has been reimplemented from scratch and is now flexible and extensible. A track changes bar like in Visual Studio has been added and unlike Delphi's it saves and restores line state correctly on undo/redo. The code base has been refactored cleaned-up, and partially documented, yet, and despite of the new features, it is thousands of lines shorter than the original. But a lot more can be done in this area. See here for the full list of enhancements in the the TurboPack fork. Backward compatibility Turbopack Synedit remains compatible with earlier versions of Synedit, but you do need to reinstall Synedit, load forms that use SynEdit ignoring error messages and save them again for the new properties to take effect. The use of DirectWrite though means that Windows XP is no longer supported. The TurboPack SynEdit fork supports Delphi versions Berlin or later. Future plans The next big planned feature is multi-selection and multi-cursor editing. Support the project Most of the bugs remaining in the issue tracker are C++Builder related. Also, the C++ packages have not been updated yet. We are actively seeking contributions on the C++Builder side of things (package updates, bug fixes). Of course you can also support the project by submitting bug reports and pull requests. Or, by implementing new features (e.g. minimap, Sync Edit like in Delphi, Delphi or VS-code like templates etc.) Note: Many thanks to @MarkShark for his great contributions to the SynEdit project.
-
Pascal syntax highlighter treats backslash as escape character
Stefan Glienke replied to Remy Lebeau's topic in Community Management
Took me less than 5 minutes to find this and another 5 minutes to try it out with chrome dev tools. -
There were many options mentioned in this thread, but there was no mention of the most obvious one at least on Windows: the built-in Windows spellchecker available since Windows 8. There many advantages compared to the options discussed here. It is free. Very easy to use. Minimal code to add to your project. No need to distribute dictionaries. If the user wants a given language dictionary they can get it through Windows language settings. It persists words added, ignored and autocorrected. It detects duplicate words. I got the idea from Ian Boyed's answer in this Stackoverflow question, but I could not find a Delphi translation of the Windows Spellcheck API. So I created my own. It is included in the attached zip file, along with a demo program. SpellCheck.zip
-
Pascal syntax highlighter treats backslash as escape character
Remy Lebeau posted a topic in Community Management
Something that has been annoying me for awhile. When posting a code snippet and choosing the Pascal syntax highlighter, backslashes are treated as C/C++ escape sequences, which throws off the coloring. The actual Pascal language doesn't treat backslash as an escape character. Can this be fixed? -
sftp means usually ssh builtin file transsefer server. Ftp over TLS/SSL is ftps. I actually had not heard about simple ftp.
-
looks like it's a UTF8 encoded string, í (0xED) is for example 0xC3 (Ã) 0xAD probably 2 times encoded that you can see the code points or because of the cast?
-
Frequent and/or annoying typos you make while coding
David Champion replied to Tommi Prami's topic in General Help
"search" --> "serach" quite often -
That is because you are not writing to the Memo while the reading loop is running. You are writing to the Memo only after the loop is finished. Change the code to write the current Buffer to the Memo after each successful read. And don't use the Memo.Text property to do that update, either. That will be very inefficient. A better way to append text to the end of a Memo is to use its SelText property instead, eg: procedure GetDosOutput(Output: TMemo; CommandLine: string; Work: string); var ... begin ... repeat WasOK := ReadFile(StdOutPipeRead, Buffer, 255, BytesRead, nil); if WasOK and (BytesRead > 0) then begin Buffer[BytesRead] := #0; Output.SelStart := Output.GetTextLen; Output.SelLength := 0; Output.SelText := Buffer; end; until (not WasOK) or (BytesRead = 0); ... end; procedure TForm7.Button1Click(Sender: TObject); begin GetDosOutput(Memo1, 'python mtk payload', ExtractFilePath(application.ExeName) + 'bin\'); end; If you don't want to pass in the TMemo directly, you could pass in a TStream instead, and then write a custom TStream descendant that overwrites the virtual Write() method to append to the Memo, eg: procedure GetDosOutput(Output: TStream; CommandLine: string; Work: string); var ... begin ... repeat WasOK := ReadFile(StdOutPipeRead, Buffer, 255, BytesRead, nil); if WasOK and (BytesRead > 0) then Output.WriteBuffer(Buffer, BytesRead); until (not WasOK) or (BytesRead = 0); ... end; type TMemoAppendStream = class(TStream) private FMemo: TMemo; public constructor Create(AMemo: TMemo); function Write(const Buffer; Count: Longint): Longint; override; end; constructor TMemoAppendStream.Create(AMemo: TMemo); begin inherited Create; FMemo := AMemo; end; function TMemoAppendStream.Write(const Buffer; Count: Longint): Longint; var BufferStr: AnsiString; begin Result := Count; SetString(BufferStr, PAnsiChar(@Buffer), Count); FMemo.SelStart := FMemo.GetTextLen; FMemo.SelLength := 0; FMemo.SelText := BufferStr; end; procedure TForm7.Button1Click(Sender: TObject); var Strm: TMemoAppendStream; begin Strm := TMemoAppendStream.Create(Memo1); try GetDosOutput(Strm, 'python mtk payload', ExtractFilePath(application.ExeName) + 'bin\'); finally Strm.Free; end; end;
-
There is SyncThing, an open source alternative to e.g. Dropbox, that works peer to peer. It can be run as a service on Windows or simply as a regular program. There are implementations for multiple OSes. Setting it up isn't as difficult as it looks at first, but it takes a bit of reading the docs.
-
Parnassus Bookmarks for Delphi 11 Alexandria?
Brandon Staggs replied to PeterPanettone's topic in Delphi IDE and APIs
I loved Parnassus plug-ins, but the delayed updates, combined with odd DLL issues I was having when trying to manage multiple versions of Delphi while using the plug-ins and having to use Get-It forced me to un-learn my reliance on them. Usable navigation, a minimap, and improved bookmarks should all be native in the IDE at this point, IMO. As someone else mentioned, I am glad that their high-dpi updates broke these plug-ins, finally someone at Emba actually has to USE the mess that is Delphi high-DPI support. That's the only way it will ever be truly fixed.