Jump to content

dormky

Members
  • Content Count

    150
  • Joined

  • Last visited

Everything posted by dormky

  1. dormky

    Program freezes when not linked to debugger

    Application.ProcessMessages() does not apply as a solution here. As I said, the freezing occurs after a few seconds ; before then the UI updates perfectly fine. So the application does process the messages, it's just that for some reason it stops after a while. Generally after 5-8sec.
  2. I have calculations that need to be executed when a window is opened, but those calculations take a bunch of time. I'd like to run them after FormShow, so that the window is shown during the calculations. However, looking at the callsite of TCustomForm.DoShow, I don't see any event getting triggered after the show. So how can I do this ? The problem with FormActivate is that it's called a bunch of times, and having a flag for this seems like a hacky way to do something the framework should have a feature for. Thanks 🙂
  3. dormky

    How do I execute code after FormShow ?

    I consider it a "hacky way" of doing things because it pulls up state into a more global context, despite said state being single-use. That's a red flag to me, unless you are implementing this at framework level. And I consider being able to say "execute this after you're done drawing" to be a very basic framework feature.
  4. dormky

    How do I execute code after FormShow ?

    All of these answers are exactly the kind of hack I'd hoped to avoid... Oh well.
  5. I'd like to have my code formatted like this. I've seen it in multiple places on the internet but can't figure out how to get the right parameters. if condition then begin code; end else begin more code; end; if condition then begin code; end else if otherCondition then begin more code; end; I've tried using GE and the default RAD Studio formatter.
  6. dormky

    How can I get this code formatting ?

    @Lajos Juhász I am on Delphi Rio. The error is "Expected end but received var".
  7. dormky

    How can I get this code formatting ?

    @haentschmanThe style guide mentions : // correct begin for var I: Integer := 1 to 10 do But I can't declare a var like this. What's the compiler setting to allow that ?
  8. dormky

    How can I get this code formatting ?

    I agree with the fact that it's not 100% consistent. That's because having end else begin Is not that useful. 3 keywords each on one line is really wasteful.
  9. I have a StringGrid where results get added every second. However, doing StringGrid.RowCount := StringGrid.RowCount + 1; Sets the scroll position back to the top. How do I prevent this ? It leads to horrendous jank in the UI because I need to set the scroll back to the bottom afterwards, leading to the scrollbar (and grid) jumping up and down every second. I'm on Delphi 10.3. Thanks !
  10. dormky

    Augmenting RowCount resets scroll position

    @Stano Yes, but that would just hide the underlying problem 😕. Still, always a good idea to use BeginUpdate & EndUpdate to make UI changes 🙂 @Pat Foley I've never seen an AddRow or equivalent function for StringGrid in Vcl. Plus, "doing it for me" wouldn't actually stop the problem from occuring.
  11. dormky

    Augmenting RowCount resets scroll position

    So this code yields the best result, but requires that the last row keeps getting selected. The problem is that SetRowCount calls ChangeSize, which for some godforsaken makes sure that the anchor (ie, the top left) position is the same as the currently selected row. This means that on the next draw, your grid will "snap" to that currently selected row. This is obviously a completely idiotic implementation, but alas these are the joys of proprietary software. For the code I'm talking about, see Vcl.Grids's TCustomGrid.ChangeSize. Changing the size of something should never change its internal state(especially in such a massive way), but I guess programming standards were somewhat different in the days when this was written. Nice to see we're evolving at least 🙂 StringGrid.RowCount := StringGrid.RowCount + 1; StringGrid.TopRow := StringGrid.RowCount - StringGrid.VisibleRowCount; StringGrid.Row := StringGrid.RowCount - 1; Embarcadero issue number : RSP-42421
  12. I have checkboxes that get initialized in FormCreate. This means that the OnClick callback gets called (SetChecked does that). How can I prevent this ? Either by detecting whether the callbakc is triggered by an actual click or by setting the value without triggering the callback. I'm using checkboxes in this instance but this is of course a general question for other controls too. Thanks !
  13. I'm trying to use TValue.Make with a pointer. Unfortunately, "myPointer as PByte" is apparently not valid Delphi code (E2015 Operator not applicable to this operand type). "myPointer as Integer" and "myPointer" alone aren't valid either. How can I tell Delphi to treat my pointer as just a number ? Basically, I need to do pointer arithmetic so as to give the correct address to TValue.Make.
  14. "myPointer" is of type Pointer.
  15. NativeUInt(Pointer) doesn't work. "NativeUInt(myPointer)" doesn't give the same number as "PByte(myRecord)", despite "myPointer" being the same value as "@myRecord". Strangely, "PNativeUInt(myRecord)" isn't valid but "PByte(myRecord)" is, wtf ?
  16. dormky

    How do I know if the click is an actual user click ?

    Sorry for the delay. Here's how it ended up, using @Uwe Raabe's proposition of setting ClicksDisabled to True : uses Vcl.StdCtrls; type THelperCheckBox = class helper for TCheckBox procedure SetValue(const value: Boolean); end; implementation procedure THelperCheckBox.SetValue(const value: Boolean); begin ClicksDisabled := True; try Checked := value; finally ClicksDisabled := False; end; end; For now I've set it for checkboxes only, but will probably copy/extend it to other components or just TButtonControl. Maybe with runtime checks of the actual class of the instance the method is called on. Thanks everyone.
  17. I have an old 2007 project that needs to be brought up to 10.3. However, I cannot compile the project with 10.3 as it seems it cannot recognize any installed libraries (include VCL itself). What do I need to do to migrate the project ?
  18. Ah, by copying files into a new project I noticed that the search path had some absolute paths pointing to 2007 Delphi, preventing it from being used anywhere other then the original computer... Old projects I swear lol. Weird that Delphi didn't give any warnings and just said Vcl was not found. Thanks for the pointers to other things I hadn't considered though, that will be useful.
  19. dormky

    Backup of files + mysql

    So we have this big client that insists on us providing a backup solution for our own program and database. I told management this is not an issue we should be taking care of (imagine if every software had its own complete backup management system ?) and that the client's IT should just add the relevant paths to their backups. Alas, it is what it is and the compromise seems to be us "advising" a backup solution... So what's a backup solution that would handle backuping the path to our software installation as well as a mysql database ? I have absolutely no knowledge of the market for this, I'm not a sysadmin. Thanks !
  20. dormky

    Backup of files + mysql

    It totally is an incompetent IT service. I've told management that they should just backup the server itself, but apparently that's not sufficient. Mind-boggling stuff.
  21. dormky

    Backup of files + mysql

    Well, there's the client's own IT service (do not ask me why the IT service can't perform this simply backup, it's beyond me) that can access everything. Apparently we need to tell them what to install and how to use it. I'm honestly going to leave this request unanswered and hope people forget about it.
  22. dormky

    Backup of files + mysql

    Yes, the DB is a on a server and used from multiple clients. I'd like to tell them to just use mysqlbackup, but there's an insistence on having everything in one tool... And if we use a tool where we can add a script to run the mysqlbackup ourselves, then we start taking responsibility for things which management doesn't want either --'
  23. Hello, Could someone share a .delphilsp.json (for the DelphiLSP extension) file ? I can't generate one since I have 10.3 installed (superior versions won't start if another one is installed) and I can't migrate to 11 yet. I just need to look at the file structure so I can reproduce it for our own projects and finally stop using RAD Studio for most of the development. Thanks !
  24. dormky

    Generate .delphilsp.json file

    Thank you very much @Stano!
  25. dormky

    IDE Syntax Highlighter using Tree-sitter

    Hey @laes , did you had up publishing this work ? I'd love to have it, working without syntax highlighting is hell.
×