Jump to content

havrlisan

Members
  • Content Count

    65
  • Joined

  • Last visited

  • Days Won

    1

havrlisan last won the day on September 20

havrlisan had the most liked content!

Community Reputation

25 Excellent

Technical Information

  • Delphi-Version
    Delphi 12 Athens

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. havrlisan

    Some new projects...

    I'll never understand people like you. Every project except CScript has a Requirements section where he mentions that Delphi 12.2+ is supported, or at least that it is made and tested with Delphi 12.2. You really should RTFM more often.
  2. Version: Beta 15.1.12.2636 Is it just me, or is the source indexer no longer rebuilding automatically after the IDE opens? This is my configuration: According to the hint: I have the source indexer window stored in the bottom panel along with messages, which is hidden until invoked. Am I missing something? This worked in a previous version. As always, thanks for your hard work!
  3. It is not possible to define TCustomContainer<T: TCustomItem> if TCustomItem is its internal public type. This only compiles (up to your error) because there is another TCustomItem defined outside that class. Doing this with classes only is impossible. You cannot have both a T that is a TCustomItem within TCustomContainer<T> and a FContainer that is a TCustomContainer<T> within TCustomItem. The relation cannot be bi-directional in this scenario. A closer implementation to what you're trying to achieve is possible with interfaces, but that comes with its own set of issues. This post has an example of what you're trying to achieve with interfaces: Also, IMO it is not a good idea to couple your classes like you're trying to do here. A TCustomItem should not directly call the TCustomContainer's HandleItemNotification; you should handle that either via an observer pattern or with events.
  4. havrlisan

    Problems with Delphi 12.2 patch 1?

    I installed the version as soon as it came out and had no issues like these you speak of. I see you wrote "patch", did you maybe install it only from GetIt, or did you do a complete reinstall of the RAD studio? For reference, here's the explanation from Embarcadero on how to install it: https://blogs.embarcadero.com/rad-studio-12-2-athens-inline-patch-1-available/
  5. Instead of hardcoding it like this and making it optional (which makes little sense), it would be better to fill the Tab Options (Options > Editor > Tab) with way more options, such as choosing colors for each scenario (locked units, system units, etc.), or disabling them altogether.
  6. havrlisan

    Delphi 12.2 TMEMO - indexoutofbounds

    It does. You can read the change log here: https://blogs.embarcadero.com/rad-studio-12-2-athens-inline-patch-1-available/
  7. havrlisan

    creating a frame at runtime

    Or to an empty string. It's the safest and easiest way, in my opinion.
  8. If you're unable to go fullscreen (try various ways, such as Windows shortcut keys), check if some other program on your PC might be restricting the window from resizing. If there is no such program, try uninstalling IDE plugins. Finally, if nothing helped, reinstall RAD Studio.
  9. I agree with the duplicate functionality, I don't like that approach either but thought it might make sense due to MMX parsing the code. I didn't realize that option was available. That did the trick, thanks!
  10. I wondered if there is an equivalent option to the Complete Class at Cursor, whose default shortcut is Ctrl+Shift+C. I'm asking because if you use that shortcut, the MMX gets out of sync and seems to parse the entire unit again, which takes around a second. During that period, you cannot use MMX's other tools, or you'll get this message: The closest option I found was invoking Edit Entity... (Ctrl+E), clicking OK, and the method implementation gets created; the MMX doesn't get out of sync that way. I get that it's a pretty specific scenario, but I find myself getting the above message quite often as I invoke the shortcuts during coding. Thanks for your time!
  11. havrlisan

    When LSP fails

    In this post, I'll share all the workarounds I use when LSP fails, which have greatly helped me during coding. Hopefully, you'll find them useful before Embarcadero completely fixes the LSP Server, which I'm sure will be soon. I'll also mention GExperts throughout this post, as it includes some useful features that can speed up using the tools listed below. Delphi Uses Helper Link: https://delphisorcery.blogspot.com/2021/03/introducing-delphi-uses-helper.html Feature: proper replacement for the Find Unit... refactor (Ctrl+Shift+A) feature. Description This has been by far the most helpful plugin. It's as simple as typing the name of a type and pressing Ctrl+Shift+A to find the unit where it's declared. When the window pops up, you can press Enter to add the unit to the uses section (use the left/right arrows to switch between interface and implementation sections), or press Shift+Enter to open the unit and jump to the line where the type is declared. GExperts bonus: The IDE already has a similar feature under the Refactor menu with the same shortcut, Ctrl+Shift+A, but it doesn’t work well and is certainly not as fast as Delphi Uses Helper. However, sometimes the default feature will trigger instead of the plugin (e.g., when pressing the shortcut without any text at the caret position). To remove the default shortcut, use GExperts' IDE Menu Shortcuts: find the shortcut under Refactor > Find Unit... (it should be the last one), and assign it to another key. MMX - Show Related Classes Link: https://www.mmx-delphi.de/ Feature: shows ancestor class, implemented interfaces, and sibling classes for a given class. Description Want to quickly navigate to a class’s ancestor or interface, or find out which siblings it has? This feature gives you exactly that, neatly and efficiently. To use it, right-click and go to MMX Commands > Navigate and Move > Show Related Classes. Or even better, map a shortcut by going to MMX > Properties > Key Bindings and finding Show Related Classes. I’ve personally mapped it to Shift+Alt+3. MMX - Open Unit... Link: https://www.mmx-delphi.de/ Feature: displays searchable units based on set configuration. Description Quickly displays all units based on your configuration. The configuration allows for adding units from the currently opened project or project group, and the following paths: Project Search path, IDE Library path, and IDE Browsing path. Find Original Symbol Feature: additional help navigating to a unit, type, or method. Description Using Find Declaration (Ctrl+Click) is known to fail occasionally, especially on bigger projects. What I've found helpful at times is to try using the Find Original Symbol that's located under the Search > Find Symbols menu item. I've personally mapped the Find Declaration to Ctrl+< and the Find Original Symbol to Ctrl+Shift+< through the GExperts IDE Menu Shortcuts, and I spam them when needed. It does help sometimes. Add a shortcut to the Reload LSP Server menu item Link: https://github.com/havrlisan/zx-idetools/blob/main/Source/Zx.IT.KeyBinding.ReloadLSPServer.pas Description In Delphi 12.1, a menu item Reload LSP Server was added under the Tools menu. Before that, you could add a custom tool to manually kill the LSP, and the IDE would restart it automatically. Unfortunately, they didn't add a shortcut for the menu item, so your options are limited to mouse clicks or to clicking Alt > T > accelerated key. Note that the accelerated key will be automatically assigned, and it depends on your menu items under the Tools menu, which sucks because that's the most changeable menu (because of custom tools, or third-party plugins). Usually, I'd use GExperts IDE Menu Shortcuts to manually add the shortcut, but the Reload LSP Server menu item doesn't show up there. After some debugging, I realized that the menu item in question isn't registered on IDE startup, but is loaded sometime after all other packages are loaded. My best guess is that the GExperts remembers the menu items when loaded, and doesn't re-fetch them afterward (I'm too lazy to search through the source code, sorry). So I decided to implement an IDE notifier that listens to a "ProjectGroupOpen" notification and then tries to find the Reload LSP Server menu item and assigns the shortcut to it. I've set the default shortcut to Alt+Shift+W, but the code is quite simple and is easily portable to a package of your own. That's all I've got so far. If you have some other features or tips, feel free to share them in this post!
  12. havrlisan

    Delphi 12.2 TMEMO - indexoutofbounds

    Reported on QP: https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-1840
  13. havrlisan

    Delphi 12.2 TMEMO - indexoutofbounds

    Upon closer inspection, it has nothing to do with the Return key, but with the caret position. The bug can be reproduced just by tapping on another line, the only condition is that the current line must have at least one character. Stack trace: System._DbgExcNotify(int, void*, System.SmallString<(unsigned char)255>*, void*, void*) System.NotifyReRaise(System.TObject*, void*)($b40000deac336980,$0000006ef3035c10) System._InternalRaiseAtExcept(System.TObject*, void*, bool)($b40000deac336980,$0000006ef3035c10,false) System._RaiseExcept(System.TObject*)($b40000deac336980) System.Internal.Excutils.DoRaiseJNIExceptionCallBack(System.UnicodeString, System.UnicodeString)(??,??) Androidapi.Jni.HandleJNIException(JNINativeInterface**)($b40000701924bbf0) Androidapi.Jnimarshal.ExecJNI(void*, void*, void*, Androidapi.Jnimarshal.JNIMethodInvokeData*, Androidapi.Jnimarshal.m128*)($0000007fe4a32218,$0000007fe4a321f8,$0000007fe4a322f0,$0000007fe4a32200,$0000007fe4a32210) _DispatchToImport Fmx.Platform.Ui.Android.TTextServiceAndroid.InternalUpdateSelection()($b4000070c92faf10) Fmx.Platform.Ui.Android.TTextServiceAndroid.SetText(System.UnicodeString)($b4000070c92faf10,??) Fmx.Text.Texteditor.TTextEditor.UpdateTextInTextService()($b4000070192bc510) Fmx.Text.Texteditor.TTextEditor.SetCaretPosition(Fmx.Text.TCaretPosition const&)($b4000070192bc510,{Line = 1, Pos = 0}) Fmx.Memo.Style.New.TStyledMemo.MMSetCaretPosition(Fmx.Presentation.Messages.TDispatchMessageWithValue__1<Fmx.Text.TCaretPosition>&)($b4000070e92689d0,{MsgID = 5917, Value = {Line = 1, Pos = 0}}) System.TObject.Dispatch(void*)($b40000dfdc2671e0,$0000007fe4a326d8) void Fmx.Presentation.Messages.TMessageSender.SendMessage<Fmx.Text.TCaretPosition>(unsigned short, Fmx.Text.TCaretPosition)($b4000070192bf450,5917,{Line = 1, Pos = 0}) Fmx.Memo.TCustomMemoModel.SetCaretPosition(Fmx.Text.TCaretPosition const&)($b4000070192bf450,{Line = 1, Pos = 0}) Fmx.Memo.TCustomMemoModel.InsertAfter(Fmx.Text.TCaretPosition const&, System.UnicodeString, System.Set<Fmx.Text.TInsertOption, (Fmx.Text.TInsertOption)0, (Fmx.Text.TInsertOption)4>)(??,{Line = 0, Pos = 1},??,{__data = "\\U00000006", __basetype = ??}) Fmx.Memo.Style.New.TStyledMemo.KeyDown(unsigned short&, char16_t&, System.Set<System.Classes.TShiftStateItem, (System.Classes.TShiftStateItem)0, (System.Classes.TShiftStateItem)10>)(??,$0000007fe4a32fa2,U+2fa4 U+e4a3 U+007f U+0000 u'\\xe2\\xbe\\xa4',{__data = "", __basetype = ??}) Fmx.Presentation.Style.TStyledPresentation.PMKeyDown(Fmx.Presentation.Messages.TDispatchMessageWithValue__1<Fmx.Controls.Presentation.TKeyInfo>&)($b4000070e92689d0,{MsgID = 1056, Value = {Key = 13, KeyChar = U+0000 u'\\\\0', Shift = {__data = "", __basetype = ??}}}) System.TObject.Dispatch(void*)($b40000dfdc2671e0,$0000007fe4a32fa0) void Fmx.Presentation.Messages.TMessageSender.SendMessageWithResult<Fmx.Controls.Presentation.TKeyInfo>(unsigned short, Fmx.Controls.Presentation.TKeyInfo&)($b400006fb92f9d80,1056,{Key = 13, KeyChar = U+0000 u'\\\\0', Shift = {__data = "", __basetype = ??}}) Fmx.Controls.Presentation.TPresentedControl.KeyDown(unsigned short&, char16_t&, System.Set<System.Classes.TShiftStateItem, (System.Classes.TShiftStateItem)0, (System.Classes.TShiftStateItem)10>)($b400006f99280520,$0000007fe4a3330a,U+3302 U+e4a3 U+007f U+0000 u'\\xe3\\x8c\\x82',{__data = "", __basetype = ??}) Fmx.Forms.TCommonCustomForm.KeyDown(unsigned short&, char16_t&, System.Set<System.Classes.TShiftStateItem, (System.Classes.TShiftStateItem)0, (System.Classes.TShiftStateItem)10>)($b400006f9927be50,$0000007fe4a3330a,U+3302 U+e4a3 U+007f U+0000 u'\\xe3\\x8c\\x82',{__data = "", __basetype = ??}) Fmx.Platform.Ui.Android.TAndroidTextInputManager.KeyDown(unsigned short&, char16_t&, System.Set<System.Classes.TShiftStateItem, (System.Classes.TShiftStateItem)0, (System.Classes.TShiftStateItem)10>)($b400007009347710,$0000007fe4a3330a,U+3302 U+e4a3 U+007f U+0000 u'\\xe3\\x8c\\x82',{__data = "", __basetype = ??}) Fmx.Platform.Ui.Android.TAndroidTextInputManager.HandleAndroidKeyEvent(AInputEvent*)($b400007009347710,$b40000700939d2a0) Fmx.Platform.Android.TPlatformAndroid.HandleAndroidInputEvent(Androidapi.Appglue.TAndroidApplicationGlue*, AInputEvent*)($b4000070192be490,$b40000700939d2a0) Androidapi.Appglue.TAndroidApplicationGlue.InputEventHandler(int, int, void*) :0000007234A78B74 android::Looper::pollInner(int) :0000007234A7862C android::Looper::pollOnce(int, int*, int*, void**) :00000072278C689C ___lldb_unnamed_symbol9344 :000000009D7B6340 ?? The TTextEditor.FCaretPosition was updated while TTextService.FCaretPosition wasn't, and the TTextEditor.UpdateTextInTextService gets called before the TTextService receives the position update. The UpdateTextInTextService passes the string of the newly selected line to the TTextService.SetText, which, among other code, does this: FTextView.setText(StrToJCharSequence(FText), TJTextView_BufferType.JavaClass.EDITABLE); // In some cases, EditText can reset selection/caret position to 0. So if user removes text via vkBackspace, // the backspace button in Soft Keyboard can be unpressed automatically. InternalUpdateSelection; Judging from the comment, that second line seems like a new addition. Tracing into it, lo and behold: procedure TTextServiceAndroid.InternalUpdateSelection; var SelStart, SelEnd: Integer; begin if FTextView = nil then Exit; CalculateSelectionBounds(SelStart, SelEnd); if SelEnd - SelStart > 0 then FTextView.setSelection(SelStart, SelEnd) else FTextView.setSelection(CaretPosition.X); // this one gets executed end; It uses its non-updated caret position to update the selection.
  14. havrlisan

    Delphi 12.2 TMEMO - indexoutofbounds

    Exception occurs on my A52s as well. To reproduce, write a character and press the Return key. Pressing the Return key on an empty line doesn't trigger the exception.
  15. havrlisan

    Getit Package Manager working?

    Works fine for me. The getit server also had no incident reports, you can check it here: https://stats.uptimerobot.com/zJjvZI8vEZ
×