Smile! Click! Copy! Smile Again!

The Perpetual Newbie - Log Entry #9.1

This article first appeared on http://www.undu.com



It's the nice touches that leave a client happy he chose you rather than the other company when it came time to providing the client's programming solution. A nice touch, such as a one-click button for copying the contents of a memo can be down-right impressive, especially given how little programming is required.



In a recent program, I had a memo field that I kept emptying and re-filling with the results of a set of various actions initiated by buttons. One button showed who was on the network, another the database's structure and a third a quick function to create the database in code. Nothing fancy. But it became a bit of a bother when I had to highlight all of the text, copy it to the clipboard and then move it over to a Notepad file to printout.



As I don't ALWAYS want to end the journey at Notepad, I decided to automate the first two steps into a button click that became VERY useful VERY quickly, even though it really only eliminated one drag and one control-key combo. The only trick was in DESELECTING the text upon conclusion of the codelet. While not obvious to most newbies of my class, the solution was simply setting the length of the selected text in the memo to zero.





Here's the code:



Memo1.selectAll;

Memo1.CopyToClipboard;

Memo1.selLength := 0; // deselects the text



Hope this gets you thinking about the nice little touches you can add to a program for a client (or for a tool you are going to use for yourself!).



Gary Mugford

Idea Mechanic

Bramalea ON Canada

 

Share this article!

Follow us!

Find more helpful articles: