Sometimes Adding More Capabilities to a GUI Eliminates Other Features
Chapter Ten “More To-Do List App (Resizing and Positioning the GUI)” of the AutoHotkey Applications book discusses “Direct Editing in the First Column Field of ListView.” This convenient feature mirrors the one-click editing you get when working with Windows File Explorer—the same effect as selecting Rename from the right-click context menu or hitting the F2 key. The feature makes it easy to change the name of a file or folder. I find this technique much simpler than editing text in a separate edit field then clicking an Update button, however, you can accidentally disable one-click editing in a GUI ListView when attempting to add other useful features by including the AltSubmit option.
For example, in my latest discussion of the ToDoListReg.ahk script, I wanted real-time updating of the saved data table whenever a user checked or unchecked a to-do list item. This required me to add AltSubmit as an option to the Gui, Add, ListView command. However, the problem of too many secondary firings of the gLabel reared its ugly head. With the AltSubmit option in effect, whenever I clicked to enter the ListView editing mode, the gLabel fired and immediately deselected the editing mode. I searched for an answer—trying a number of tricks to get around the problem—but nothing worked. I found that I needed to choose between one-click editing and the opportunities added by including the AltSubmit option.
Someone may know of a technique for including the AltSubmit option without losing the one-click editing option (-readonly), but, for now, I developed another batch approach to recording checkmarks in the data file (when exiting the app) without including the AltSubmit option. I consider ease of editing more important than the immediate cataloging of whether or not I checked a to-do list item.
At one point, I considered dropping the ListView checkboxes completely. But, then, I would lose the satisfaction of checking a box whenever I completed a task. No programming language includes solutions for all situations. You need to make occasional compromises.
Click the Follow button at the top of the sidebar on the right of this page for e-mail notification of new blogs. (If you’re reading this on a tablet or your phone, then you must scroll all the way to the end of the blog—pass any comments—to find the Follow button.)
This post was proofread by Grammarly
(Any other mistakes are all mine.)
(Full disclosure: If you sign up for a free Grammarly account, I get 20¢. I use the spelling/grammar checking service all the time, but, then again, I write a lot more than most people. I recommend Grammarly because it works and it’s free.)