#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Location
    South Africa
    Posts
    59
    Rep Power
    11

    Alt Keys / Hotkeys


    Hi,

    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 :-)
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    156
    Rep Power
    3
    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?

IMN logo majestic logo threadwatch logo seochat tools logo