

Paul Dardeau
Members-
Content Count
25 -
Joined
-
Last visited
-
Days Won
1
Paul Dardeau last won the day on January 21
Paul Dardeau had the most liked content!
Community Reputation
4 NeutralRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
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?
-
Not currently.
-
Thank you! Much appreciated!
-
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?
-
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:
-
Vcl text box that user can move/resize at runtime?
Paul Dardeau replied to Paul Dardeau's topic in VCL
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. -
Vcl text box that user can move/resize at runtime?
Paul Dardeau replied to Paul Dardeau's topic in VCL
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. -
Vcl text box that user can move/resize at runtime?
Paul Dardeau replied to Paul Dardeau's topic in VCL
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). -
Vcl text box that user can move/resize at runtime?
Paul Dardeau replied to Paul Dardeau's topic in VCL
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. -
Vcl text box that user can move/resize at runtime?
Paul Dardeau replied to Paul Dardeau's topic in VCL
I did many searches and did not find any good answers, hence my post here. -
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!
-
Desktop App Development with Object Pascal
Paul Dardeau replied to PhilBoy's topic in Algorithms, Data Structures and Class Design
Is it common to have shared code between Delphi and Lazarus? If so, what are the equivalents to c preprocessor macros like "#ifdef Delphi"? -
Retrieve value of INSERT ... RETURNING ...?
Paul Dardeau replied to Paul Dardeau's topic in Databases
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. -
Retrieve value of INSERT ... RETURNING ...?
Paul Dardeau replied to Paul Dardeau's topic in Databases
Good idea! Thanks for the link! I created a bug report for it. -
Retrieve value of INSERT ... RETURNING ...?
Paul Dardeau replied to Paul Dardeau's topic in Databases
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.