Posts

Showing posts from January, 2020

Set Enter Key to work like Tab Key in Delphi Application

In Delphi Applications, we use Tab Key to move focus from one control to another control. But some user prefer to press Enter key to move focus from one control to another control for speed data entry work. As Delphi does not provide such in-build facility or any in build property to set Enter Key as Tab. So here I will explain how to set Enter key to behave like Tab, and Shift+Enter like Shift+Tab.  But before, I assume that there is no default button on the form. When a form contains a button and whose Default property is set to True then pressing Enter at run-time executes any code contained in the button's OnClick event handler.  So here we will check with different examples for setting Enter key as tab in Edit controls, grid controls and globally on a form.  For all Form controls that ability to focus We can set this functionality for controls like EditBox, Memo, Combo, Listbox,  RadioButton, Checkbox etc and also other controls that have ability to focus. pr

What is #13#10 and #$D#$A in Delphi?

Image
#13#10 and #$D#$A are called as control strings in Delphi which are used to set layout of a string. Both #13#10 and #$D#$A same ASCII codes and used to add new line to a string where the difference is in their representation that #13 is decimal but #$D is hexadecimal . For example, if we want to show a message having 2 lines then we can write following codes. Showmessage('First line' + #13#10 + 'Second line'); Here in above code #13#10 part represents a carriage return + line feed combination. So the message will show as following. Some other control strings that Delphi provide #13 - Carriage return (ASCII) #10 - Line feed (ASCII) #$D - Carriage return (Hexadecimal) #$A - Line feed (Hexadecimal) #0 - NULL #9 - Tab #32 - Space #9 tab display issue is message dialogs In latest Delphi versions #9 tabs does not work properly with message dialogs because Windows ignores tabs on buttons and dialogs. So set UseLa