When writing applications that potentially require the user to save modifications, it is possible for the user to make changes and then attempt to close the application without saving those modifications. Sometimes, this is what they want; however, more often than not they have simply forgotten to save. The nice thing for us to do is to detect that changes have not been saved, then when the user clicks Exit, ask them if they wist to save the changes or not.
Customarily, when displaying the message enabling the user to save or not on exit, a Cancel button is provided. This is for those times that the mouse jumps and you click Exit instead of Print in the menu. If the user clicks Cancel, the changes are not saved and the application does not close.
The question before us then, is how do we gracefully handle this in our code? There are a number of options, but the one presented here today is somewhat unique and presents possibilities for uses in other situations as well.
TException Delphi does an excellent job of implementing exception handling. It is possible, not only for your application to handle application and system errors, but it can generate it's own errors (exceptions) and handle them as well. Today, we are going to use a custom exception to handle our Save on Exit message. To start we have to define an Exception to use, to do this, move to the Interface section of your form and under Type, add the following line of code:
EEditorError = class(Exception)
When I was done, Mike filled the rest of the time by discussing secrets of the Delphi IDE (primarily timesaving keyboard shortcuts). In a future issue I will be listing the keyboard shortcuts for all four versions of Delphi. It should, hopefully, serve as a handy quick reference to some of those more obscure, yet extremely useful keyboard tricks.
Delphi Apprentice Delphi 3 included the ability to display JPEG images as well as BMPs by simply including the JPEG unit in your uses clause, the only problem is you have to load them at run-time. Delphi doesn't store them in the form like BMPs.
It is possible, however, to include the JPEG file in your executable, so as not to require external image files for your application. The nice thing is it only requires five steps to include and use JPEGs.
First Step The first step is to create a resource script file (*.rc). You can create this with any text editor (an excellent editor to use it YTSEditor, which was written by our very own Ken Hale. YTSEditor is available at the DC al Coda Web-Site.)
For each image you want to include in your executable, add a line like the following to your file:
1 RCDATA "image1.jpg"
The "1" is simply an index for the resource. The number can be any number you want as long as it is unique in the file.
The "RCDATA" tells the Resource Compiler that this is a user-defined resource.
The "image1.jpg" is the filename of the image to include. Replace this with the name of the file to include.
Save this file. You can name the file anything you want, as long as it has the extension ".rc" and the filename without the extension is not the same as any unit or project filename. This is important, because Delphi will create some resource files of its own.
Second Step The next step is to compile the resource script file. Delphi comes with a command line resource compiler located in the \Delphi 3\Bin directory and is called BRCC32.EXE.
To compile the resource file, change to the \Bin directory and issue the following command:
Hello ! I am Alex - professionally writing texts and essays! I have been doing this for many years, I have a huge experience! You can contact: essay writer uk
n turn, I want to share my story- once when I was still at university I got a little sick and of course I had a whole bunch of tasks that were not completed in the list of which of course there was work on writing an essay and of course I was very upset because I realized that the deadlines expire very quickly and the work had to be written immediately. and here they helped me a lot by advising this wonderful site for writing essays and cheers, I was saved. I hasten to share this wonderful essay writing site with you https://aussieessaywriter.com.au/
This is the first time that I visit here. I found so many exciting matters in this particular blog, One thing I would like to request you that pls keep posting such type of informative blog. Star Wars Jacket
The post is very informative many people want to read this type of post I am a fashion designer and also designed the Michael Jackson Jacket and after the job, my first choice is reading this type of post.
Australian assignment help experts at MAHO are here to provide you the best thesis writing service at cheap rates. The best part about our thesis writing help service here you can ask from experts to write my thesis round the clock and all of our specialists are well-versed in drafting the thesis writing an academic paper for you.
Thank you for this great contribution, I find it very interesting and well thought out and put together. I hope to read your work in the future. Arrow Oliver Queen Jacket