This a continuation of my experiences building this form
First, I need to correct something I said in Part 1: "With the old system, Superbase, I could just add a where clause to the detail block definition to filter the data, but in the new system, SIMPOL, I did not yet have that ability. I therefore wrote a filter routine to check the records before adding them to the subset file, which linked to the form." I have since learned there is indeed a way to add a where clause to a detail block. If the detail block is not linked to the master record, you can set the parameters of the detail block to include a SQL92 compliant where clause. I tried it initially, but did not have the syntax quite right, so I did not get the desired result. Anyway, I have already developed a filter routine that works, so I'm not going back to retry the unlinked query approach, but it is there if I need it.
I was still working on this form but I could not get the event handler for the option buttons to work. They allow me to filter the records displayed in the form's detail block. In fact, the development environment would crash when I tried to debug the source code. It took a couple of days, but SIMPOL support were able to identify and resolve the problem. It turned out to be an issue specific to my operating system (Windows 7 64-bit) that could not be reproduced on SIMPOL support's machines because they were using Windows Vista. I let the technical director (sorry Neil, I'm not sure your real title) debug the problem on my machine. It involved connecting using remote control software called TeamViewer and installing MS Visual Studio. Neil was able to find and fix the issue. I was sympathetic to Neil's plight. I have been it the same position myself, not being able to reproduce the problem locally and needing to use remote control software to debug remotely.
Next, I decided to make my form resizeable. Why? I have clients with different monitor resolutions, ranging from 800x600 to 1920x1080. The standard form is designed to work in the minimum screen size, but that is too small for some of the users, with the highest resolution monitors. The form needs to be readable regardless of the monitor, and on the large resolution displays, the text can get tiny.
I decided to allow three resolutions to start: original - 100%, 125%, and 150%. I added a Form Size menu and added these options to on it. Further, I decided an Auto option was required. The Auto option would be the default and the program could determine the display size and decide what was the optimum form size to fit.
I was going to hook everything up to a new menu, "Form Size", but I decided to first write the code and test it that did the real work. This involves iterating through all the form objects and changing their position (top and left corner) and size (width and height) by the specified amount. I discovered there are actually several collections of objects that I had to work on, the form controls, the pages collection, the graphics collection, and the detailblocks collection.
Actually, the each page has it's own controls collection, so I did not need to deal directly with the forms controls collection. Actually collections is a Superbase or Windows term. SIMPOL uses the term "dring". A dring is a list of objects linked together and you can go from one to the next in the list and when you reach the end, the next retrieved is the first object again. (That is the simple definition.)
Even though I was dealing with a single page form, I wrote code to assume a multi-page form, so I could reuse the function later with multi-page forms. I cycled through the pages collection first and changed the size of each page, then cycled through the page's controls dring and changes all the controls. When all pages were processed, I cycled through all the form's graphics elements doing the same thing. Finally, I cycled through the form's detailblocks, changing the offset between rows.
Once I had the form resizing working (at application start-up), with a specified re-size percent, I added the menu and menu items and tried to get it to work on demand. Adding a menu and menu items was straight forward, but things did not go smoothly. I needed to work out the logic for restarting the form on the fly. Up to this point, the program re-sized the form before it was shown to the user. Now I was letting the user decide to change it and reload the form. So I muddled around with that until I had the restart working smoothly.
The final piece of was saving the users selected resizing option in a configuration file, so that the application could use the same setting the next time it was launched. There is a library supplied with the development environment (conflib.sml) that handles reading and writing to private configuration files. I added the library to my project, looked up how to use the getprivateprofilestring and writeprivateprofilestring functions, and got them working rather quickly.
This single form project is now relatively compete, but there are a few things missing. I still need to add logic to filter the detail block records by date, but I may leave that until later, as I don't consider it very hard. I am also waiting for a revised volatable library that will allow me to delete all records in the (volatile) 'notesubset' table.
Any time you click one of the option buttons on the form, the app deletes all records in the notesubset table and reloads the table, filtering the records that can be loaded according to the user selection. My current approach is to delete records one-by-one until the table is empty, but if there are more than 51 records, the delete record statement is hanging. The problem appears to be beyond the reach of my debugger, so I have asked my SIMPOL vendor to take a look. The problem has only been detected because I am using volatile files in a different way than they were originally designed. Using physical files, I did not have a problem. I'm using a volatile file because a memory-based file should be faster at deleting records. (I like my apps zippy.)
Once those items are addressed, I think I will progress to the next stage, hooking up the main form and making the app a multi-window application. I have researched how to add an additional window to the app. It seems easy enough and I am itching to get started.
-djinks Apps and Services: www.jinksinc.com