Jump to content

Paul Dardeau

Members
  • Content Count

    25
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Paul Dardeau

  1. Embarcadero hosted a youtube livestream the other day with MVPs. It was a debate on use of FreeAndNil. Being new to Delphi, I don't have any historical baggage (well, I do; but not on this particular topic) or preconceived notions of how it should be done. I was disappointed that the video didn't at least include a "if you're brand new to delphi, here's our recommendations on the use of FreeAndNil". Having said all that, can you suggest some best practices for someone who's new to Delphi on good use of FreeAndNil?
  2. Paul Dardeau

    VCL resizeable and moveable label

    Hi, I needed a mechanism for moveable and resizeable VCL labels and couldn't find exactly what I wanted so I wrote it. Link to github public repository: https://github.com/pauldardeau/delphi-sizeable-label I'm not new to programming, but I am new to Delphi and Windows customized UI controls. You will likely find strange or odd styles in my code as a result. I welcome any and all suggestions for improvement. Screen capture showing it in action:
  3. Paul Dardeau

    VCL resizeable and moveable label

    Not currently.
  4. Paul Dardeau

    VCL resizeable and moveable label

    Thank you! Much appreciated!
  5. Paul Dardeau

    VCL resizeable and moveable label

    Thanks Anders! I appreciate the detailed suggestions. I will make all the stylistic and quick/easy changes you suggested. No, that thought never occurred to me! What type of control would you suggest for the handles?
  6. Hi, I'd like to find a way to allow the user to select a VCL edit box at runtime and move and/or resize it (similar to how Delphi does form builder at design time). I just need this capability for text boxes. This is for charts where I'd like the user to be able to edit title, add annotations, and move/resize the annotations. Does such a thing exist? Any suggestions? Thank you in advance!
  7. Paul Dardeau

    Vcl text box that user can move/resize at runtime?

    Here is the link to my code in a public github repository: https://github.com/pauldardeau/delphi-sizeable-label I am not new to programming, but I am new to Delphi and Windows UI customizations. Don't be surprised to see anything in the code that doesn't follow best practices. I welcome any and all suggestions for improvement. Attached you can see it in action.
  8. Paul Dardeau

    Vcl text box that user can move/resize at runtime?

    Thank you to everyone who provided suggestions! I have a working prototype that provides the desired functionality. I created a custom control (TSizeableLabel derived from TCustomControl) that "wraps" a TLabel. The TLabel is passed as an argument to TSizeableLabel's constructor and TSizeableLabel makes itself the parent of the label. It also makes it's size just a little bit bigger than the size of the label. The extra size is to accommodate the 8 size handles that are drawn to enable resizing. I'm planning to put my prototype in a public github repo soon.
  9. Paul Dardeau

    Vcl text box that user can move/resize at runtime?

    Giving up? Au contraire! I'm just getting started! 😀 I suspect that my initial post may have agitated you since you thought I was giving up without trying. Sorry for that (if that's the case). I did try playing with various snippets of code I had found and had the 'move' functionality done in a matter of minutes. As you say, the resizing is more involved. I started with the question because I'd like to leverage best practices and not waste time going down a rabbit hole unnecessarily. I'm not opposed to doing that when required (and I do like the learning aspects of doing that).
  10. Paul Dardeau

    Vcl text box that user can move/resize at runtime?

    The first link that I examined is this: https://www.thoughtco.com/how-to-move-and-resize-controls-at-run-time-4092542 It uses a non-standard way for the user to resize the control. The user must hold shift key to resize. The article concludes by saying that you might want to add 8 sizing handles. It gives no code or tips on how to do that. I then looked at these: https://tips.delphidabbler.com/tips/92 https://tips.delphidabbler.com/tips/93 There are no images to show what it looks like and very little explanation. I'm not new to programming, but I am new to Delphi and specialized Windows UI custom code. I looked at this thread: https://stackoverflow.com/questions/813693/how-to-draw-on-a-tpanel I saw someone mention about using Raize Components (TRzPanel in particular). Great! I google search "Raize Components" and it appears they (Raize) no longer offer those components for sale. In same thread, someone mentions to use TMS TAdvPanel (part of their VCL Components). I search for documentation about TAdvPanel and I can only see basic documentation. This thread and some of the others do have code, but few comments or discussion about the code. Part of the reason I was drawn to Delphi is the 'Rapid' part of application development. If I have to spent a lot of time figuring out old code to do something that seems relatively common, that goes against the grain of rapid development (in my opinion). One of the things I was hoping to hear from others in this forum post are things like "I've used 3rd party component X and it worked great" or "I built my own by subclassing Y and adding functionality Z". I find comments like "Let me teach you a trick: <google search links>" to be condescending. I introduced myself by saying that I'm new to Delphi.
  11. Paul Dardeau

    Vcl text box that user can move/resize at runtime?

    I did many searches and did not find any good answers, hence my post here.
  12. Is it common to have shared code between Delphi and Lazarus? If so, what are the equivalents to c preprocessor macros like "#ifdef Delphi"?
  13. Hi, I'm using SQLite with Delphi 12.1. I have this table in my SQLite database. CREATE TABLE databases ( database_id INTEGER PRIMARY KEY, database_name TEXT UNIQUE NOT NULL, db_file_name TEXT NOT NULL, db_file_path TEXT NOT NULL, db_description TEXT NOT NULL, created_at TEXT NOT NULL, last_update TEXT NULL ) STRICT; When I try to run the following code, the INSERT statement runs fine, but I don't know how to extract the database_id value. Suggestions? Sql := 'INSERT INTO databases ' + '(database_name,' + 'db_file_name,' + 'db_file_path,' + 'db_description,' + 'created_at) ' + 'VALUES (:database_name,' + ':db_file_name,' + ':db_file_path,' + ':db_description,' + ':created_at) ' + 'RETURNING database_id'; SqlQuery.SQL.Text := Sql; SqlQuery.ParamByName('database_name').AsString := ADatabase.Name; SqlQuery.ParamByName('db_file_name').AsString := ADatabase.FileName; SqlQuery.ParamByName('db_file_path').AsString := ADatabase.FilePath; SqlQuery.ParamByName('db_description').AsString := ADatabase.Description; SqlQuery.ParamByName('created_at').AsString := GetCurrentTimeStamp; ExecuteQuery(SqlQuery, false); // my own wrapper function that does logging and executes "SqlQuery.ExecSQL" in this case DatabaseId := SqlQuery.Fields[5].AsInteger; // <-- this fails. how do i get the RETURNING value?
  14. Paul Dardeau

    Retrieve value of INSERT ... RETURNING ...?

    I recently read that AUTOINCREMENT does not do what it implies. From SQLite's own website: https://www.sqlite.org/autoinc.html "The AUTOINCREMENT keyword imposes extra CPU, memory, disk space, and disk I/O overhead and should be avoided if not strictly needed. It is usually not needed." "On an INSERT, if the ROWID or INTEGER PRIMARY KEY column is not explicitly given a value, then it will be filled automatically with an unused integer, usually one more than the largest ROWID currently in use. This is true regardless of whether or not the AUTOINCREMENT keyword is used." The reason I experienced UNIQUE constraint violation had nothing to do with the absence of AUTOINCREMENT. Rather, it was because the SQLite driver inserted duplicate rows.
  15. Paul Dardeau

    Retrieve value of INSERT ... RETURNING ...?

    Good idea! Thanks for the link! I created a bug report for it.
  16. Paul Dardeau

    Retrieve value of INSERT ... RETURNING ...?

    Remy's post contained the missing pieces that I needed, but I ran into an unrelated problem. My insert starting failing saying that the UNIQUE constraint was failing. I saw that 2 rows were being inserted. I set breakpoints in my code thinking that I was somehow calling my insert twice. Nope! I was just calling it once, yet 2 records were being inserted. I downloaded the dbExpress driver for SQLite from Devart website and once I started using it (without changing anything except my TSQLConnection parameters), only 1 record is now inserted (as expected). This certainly doesn't inspire a lot of confidence in the code that Embarcadero is publishing to the public. FWIW, I'm using Delphi CE 12.1.
  17. Paul Dardeau

    Retrieve value of INSERT ... RETURNING ...?

    Great! Thank you very much! I really appreciate it.
  18. Hi, I'd like to add very basic support for AWS S3 to my delphi application. I'm looking at exactly 3 operations: PUT file/object, GET file/object, LIST objects within a bucket. Suggestions on quickest, easiest way to add this?
  19. Paul Dardeau

    Adding basic AWS S3 operations to Delphi app

    Thanks to everyone who has replied. I'm using Delphi CE and some of the options presented don't seem to be available for CE.
  20. Hi everyone, I'm a long-time software developer (30 years), but new to Delphi. I resigned from the big corporate world in spring of 2024. I'm now working on developing some software as an indie developer. Having a lot of fun with Delphi! My first product is being written in Delphi (CE 12.1) with VCL. Once it's published, I plan to make a macOS version of the same application in Xcode/ObjC. You may wonder -- why don't you use FMX and just have 1 version that targets both platforms? I'm aware of FMX, but it feels like too big of a hurdle for me to tackle at this time. I have Xcode/Cocoa/ObjC experience, so it's not a big problem to develop. The application (commercial; closed source) will be targeted at exploratory data analysis of SQLite databases. While a great deal of the Delphi VCL is already implemented, there's still a lot to do. I don't have a name for my product yet, no website, etc. A sampling of things I'm currently working on (welcome to any suggestions!): - What to use for generating and managing license keys? - What to use for online sales? - What to use for producing PDF content? - What to use for internal product database? (leaning to either SQLite, Firebird, or IBLite) - How to route connecting lines for entity-relationship diagram? (currently drawing my lines with my own code, but it's not good enough) - What to use to product help files (all embedded within executable, some in exe/some on website, all on website)? - Font oddities with VCL TCanvas - Thinking about when/if to consider adding Skia and where to start with it -paul
  21. Paul Dardeau

    New to Delphi and to the forum - with questions

    Thanks David! Sounds like you've got a nice setup. I'll keep this option in mind. I appreciate your comments and suggestions.
  22. Paul Dardeau

    New to Delphi and to the forum - with questions

    Thank you Patrick. Much appreciated! I will have a look at both.
  23. Paul Dardeau

    New to Delphi and to the forum - with questions

    Thanks Patrick. Much appreciated! I will have a look at all of the options you suggested.
  24. Paul Dardeau

    New to Delphi and to the forum - with questions

    Thanks Keesver. Much appreciated! I will have a look at Graphviz. I didn't realize it was something you can use like an engine.
  25. Paul Dardeau

    New to Delphi and to the forum - with questions

    Thanks Dave. Much appreciated! I will have a look at all of the options you suggested.
×