September 19th, 2012, 07:49 AM
Alt Keys / Hotkeys
normal buttons don't seem to have an AutoHotKey option in Delphi 7. So I have a custom form class which would be able to adjust the captions of the buttons by inserting the & at the appropriate place (hence auto generating my own hotkeys based on available letters on the form).
My Question: Any suggestions for a efficient algorithm?
My initials thoughts:
1. Start with shortest captions and insert & starting with first available letters. (ie. Button1 and Button2 becomes &Button1 and B&utton2
2. Then, after running through all buttons, we will possibly have some that havent been assigned any & due to none-available letters. Suggest I then run through already assigned captions (starting with longest words) and see if I can find appropriate letter for usage within these already assigned words and (as a result) amend both to find a letter for my current button.
Perhaps this is a subclass of a familiar problem that I dont seem to figure :-)
September 25th, 2012, 01:34 AM
Very interesting. IMHO I don't think automatic hotkey generation is good for user interface consistency. Because there is a chance hotkey difference between builds (of the same major/minor version). But I can see that this a time saving.
In order to minimize the possibility of unnecessary hotkey generation and assignment, we have add step 0. In step 0 we list all the buttons, and using this list we should not change buttons that already have hotkeys.
What do you think?