With the first post of this series I told you about my plan to create a tool, that helps you to open IP Office backup files as comfortable as possible.
In my first version of that tool I created an array, that contains three directories. The tool searches those three directories for files ending with CFG.
By it’s very nature a user doesn’t want to run a program from start to end, but wants to jump between different program parts if needed. That’s why it became clear, that I had to create a main menu to offer several options. Besides the main goal to search for backups and to open them, you will for sure want to be able to adjust some settings and even to just quit the tool.
The main menu
Creating a menu is not too difficult. Within an endless loop all menu options are shown and it will be waited for the user input. Using a switch statement the method chosen by the user will be called. The endless loop ensures, that after running each method the main menu is called again.
If you chose option ‘q’, the switch statement returns ‘false’. Because that is not the condition anymore to run the menu again, the menu is left. Calling ‘q’ from main menu quits the whole program, in any submenu you will jump back to main menu.
Existing submenus are called as a method from main menu and are created the same way.
You will probably have noticed, that the ‘case’ label calls a method in my program. This way I can call any desired action. One of those is to call a submenu, another is to search for the backup files. A third one is to step into a settings dialog.
Save the settings
That’s what we all have a look at in the next post. I will save the settings in Windows Registry. First of all I have to create registry keys to store the settings. More details next time.
Some people don’t like, that a tiny little tool stores it’s settings in Windows Registry. So I had the idea to ask you during first startup, whether you want to store the settings using an ini-file instead. If you agree to that, I would create the file in the program directory.
The program should check during first startup, if settings are stored in the file or in Registry.
What is your opinion about that? Storing settings in a file makes sense, if you like the software to be portable. That would mean the program is stored on a USB drive, in a shared folder or in some kind of cloud storage, that is used on multiple computers.
Next time we will check out how I create a structure in the Registry and store values there. In the meantime just have a look over my blog. I’m sure you will find some posts, that are interesting for you.
To stay in touch if I publish any update, just subscribe to my newsletter.
If you need further help with IP Office you can contact me through my main website: https://www.fwilke.com/home