1

Shortcut-handling module of my application contains some sort of 'global' hotkeys, that are linked to their own actions in action list in TDataModule. I did so, because it is part of shortcut persistence and editing system I have. So, any TAction I add into some form/frame/datamodule of my application will be processed and viewed in shortcut editing interface and then properly saved.

So, all works, except that TActions, that placed in TDataModule, do not renpond to hot keys :/

Maxim Popravko
  • 4,100
  • 3
  • 29
  • 43
  • Sorry, silly question. Answer is: 'It can't handle shortcuts by design'. So, I implemented shortcut-handling behaviour in it, because I think that changing TDataModule to some TCustomForm descendant and deal with sorta invisible form is lame. – Maxim Popravko Oct 19 '10 at 13:42
  • Make your answer a proper answer - others will face this. Then it will be properly documented. – mj2008 Oct 19 '10 at 14:03
  • @mj2008 Yes, I will. But one can post his own answer only when 24 hours last. – Maxim Popravko Oct 19 '10 at 14:36
  • I believe that changing a TDataModule into an invisible TForm is, indeed, very valuable. I always do it. I found the it helps in testing (it makes a very good bed for data related unit tests) debugging (it makes data visible and is also a good placemark for data-related ad-hoc tracing), and in problem determination (I let some undocumented way to bring the Form visible at runtime) – PA. Oct 19 '10 at 15:22
  • 1
    @PA Yes, it is valuable approach you use. But there is one problem: TDataModule is designed to contain non-visual components, TForm not. DM is intended to eliminate the hack with invisible forms. I realise, that TForm is good for tracing, testing and so one, but TForm should not be used as invisible container for components. So, subclassing TDataModule is more reasonable, although more difficult to implement. – Maxim Popravko Oct 21 '10 at 09:09

1 Answers1

1

It can't handle shortcuts by design. So, I implemented shortcut-handling behaviour in it, because I think that changing TDataModule to some TCustomForm descendant and deal with sorta invisible form is lame.

Maxim Popravko
  • 4,100
  • 3
  • 29
  • 43