0

I have a requirement to allow users to tab around a Delphi application screen in a certain order. This is fine for almost everything, except that I can't seem to find a way to tab OUT of a memo component. I realise that Tab, itself, is a legitimate key in a memo for formatting purposes.

Does anyone know if it is possible at all to tab to the next control from a Tmemo? I don't need the Tab format in the Memo, so I'm quite happy to sacrifice that.

I'm using Delphi 5 Enterprise.

Thanks in advance.

Capfka
  • 353
  • 2
  • 6
  • 15
  • If you set the TMemo's WantTabs property to False, pressing Tab in the memo should move to the next control. – MartynA Feb 14 '17 at 15:03
  • Yes, I set WantTabs to False. Sorry, should have mentioned that. It makes no difference. Press the Tab key and the focus remains on the Memo control. I decided I must be misinterpreting it and set it to True, just to be sure. Nope! – Capfka Feb 14 '17 at 15:28
  • 1
    I would suggest. Create a simple new Project. Only `TMemo` and a `TEdit` component. If you can not leave the `TMemo` then something is wrong with D5 or OS.(`Memo1.WantTabs := False;`) – moskito-x Feb 14 '17 at 15:38
  • Now you're worrying me, but thanks, I will try that. – Capfka Feb 14 '17 at 15:46
  • worse case, you might need to subclass the Memo to handle the `WM_GETDLGCODE` message, first passing it to the default handler and then removing the `DLGC_WANTTAB` flag from the result. Or, in the Memo's `OnKeyPress` event, you can send a `WM_NEXTDLGCTRL` or `CM_DIALOGKEY(VK_TAB)` message to the Form when the `Key` parameter is `#9`. – Remy Lebeau Feb 14 '17 at 16:28
  • I found myself almost always being able to SHIFT+TAB out of multiline controls. Yes, it's the other direction, but it's a way. – AmigoJack Feb 14 '17 at 17:08
  • Thanks for all the guidance, people. Very much appreciated. I'll "have a play" with your suggestions when I get a chance later in the week and let you know. Regards! – Capfka Feb 14 '17 at 18:20
  • Thank you to moskito-x for pointing out the obvious approach. I did as you suggested and there was no problem with tabbing out of the memo. Had a poke around in my project and realised that I had created a VK_TAB action in the OnKeyUp event for the memo component which overrode the component default action. Ace! – Capfka Feb 19 '17 at 11:59
  • Can someone tell me how to accept moskito-x's comment as an answer so I can credit him/her with it, please? – Capfka Feb 19 '17 at 12:25
  • @Capfka : Glad you found the reason. I think upvote my comment is enough. – moskito-x Feb 19 '17 at 19:27

0 Answers0