Disable hotkey on vcl controls - delphi

I do have a TPageControl that I do add and remove TTabsheet's from, and in the TTabsheets there are 2 TEdit's that the user can type firstname and lastname, when they do the Tab Caption does show what they have written.
But if the user add a '&' somewhere in the TEdit (and they are allowed to do) the tab do get the char after '&' as (underlined)hotkey..
So how do I disable a hotkey on a control.

You don't need to disable keyboard access key display on the control, you just need to double the ampersand character in the tab caption to let Windows know it should be displayed as a character instead of underlining the following character.

Related

Show selection of TEdit that does not have focus

I have a FireMonkey application and I need to change what is selected in Edit1 while the user is typing in Edit2. To be exact, Edit1 has some sample text and Edit2 has a regular expression that the user is editing. I want the user to be able to see if the regular expression is valid and what the matched text would be for the given sample text.
I'm using the OnChangeTracking event of Edit2 to set the SelStart and SelLength of Edit1.
The problem is, unlike VCL's TEdit, FireMonkey's TEdit does not have a HideSelection property, and always hides the selected text if the control does not have the input focus.
Is there a way to change this behavior and force the selection highlight to show no matter which control has input focus?

Delphi IDE shortcut for splitting a long string

I'm using Delphi XE2. I have a really long string (580 characters) pasted into the IDE. I want to split the string so that it stays within the right margins and has the proper closing tick mark and plus sign. Is there a keyboard shortcut that will do that?
The shift + Enter shortcut allows me to do if I am typing the string but it doesn't split a string that is already on the screen.
Delphi XE2 has the ability to record Macros and play them back in your source editor. The controls are in the bottom-left, play, record, and stop.
If not already, move your string down to the next line (as in my screenshot)
Start with your cursor at the beginning of the string, after the '
Press the Record Macro button (Red circle)
Press the Right keyboard arrow key up to 2 chars before desired width
Type ' to terminate the string
Type + to continue on the next line
Press Enter to insert a line break
Type ' to begin a new string
By now you should be 1 position directly underneath where you started
Press the Stop Recording Macro button (Green square)
Press the Playback Macro button (Green triangle)
Continue pressing play until all is complete
SHIFT+ENTER only works like you want when the cursor is at the end of a line with an unclosed string literal. There is no shortcut to split a literal (with quotes and spacing) when the cursor is at the beginning or middle of it. You will have to find a third-party editor add-on that formats long string literals the way you want.
You can press "CTRL+D".... and configure it in Tools->Options->Formatter

Delphi editor. Tabs instead Spaces

I use Delphi 5 and I have one interesting question...
If you press Enter key when cursor is at the string's end Delphi IDE automatically aligns cursor position at the new line to the first word at the previous line.
But space between begin of new line and cursor position will be filled with SPACE chars.
How to change this behaviour? I want some amount of TAB characters from begin of new line to the cursor position, as notepad++ do that.
Thanks
Under Environment Options → Editor:
There are some options you should check:
Use tab character. Inserts tab characters when you press TAB in the Code Editor. If not checked, pressing TAB inserts spaces. To view tab characters, select Show tab character.
Smart tab. Tabs to the first non-whitespace character in the preceding line.

TcxMaskEdit for password field

I have a EditText declarated as TcxMaskEdit for password field and when I write on it the characters show as ***** but I want that sometimes show the characters, but I don´t find the method for that.
Have you tried simply using a normal TEdit with its PasswordChar property set as desired? You can set it to '*' when you want to hide the password, and set it to 0 when you want to show the password.
Have you tried simply using a normal TEdit with its PasswordChar property set as desired? You can set it to '*' when you want to hide the password, and set it to 0 when you want to show the password.
This perfectly works.
Then I add, answering to your doubt (Jjreina) of showing and not
First, put a SpeedButton by the side of the Edit where the password will be typed
Then in the Events of the SpeedButton
OnMouseDown
(Here you're gonna show the password when you click)
Edit2->PasswordChar=0;
2-> the number of your edit.
0-> is the default value for showing the characters on the edit
OnMouseUp
(Here you're gonna hide it again when you release the button)
Edit2->PasswordChar='*';
Change the property again to show * instead of the characters
Finally in the property Glyph of the speed button you can put an image (of an eye for example) , this just for the icing on the cake 😎
Hope it works for you, and be useful the answer

Is it possible to control the size of a TAB character in a Flash/Flex TextField?

I figured out how to get a TextField to maintain focus when the tab key is pressed (using an event listener on FocusEvent.KEY_FOCUS_CHANGE), but what I'd like to do is control the size of the tab character in the TextField so that it is equal to five spaces. (I would just insert five spaces when the tab key is pressed, however due to requirements this is not an option.) Is this possible?
As you can see the TextFormat class have an indent property :
http://livedocs.adobe.com/flash/9.0_fr/ActionScriptLangRefV3/flash/text/TextFormat.html#indent
You can modify the value of the indent in your event handler.
Can you copy/paste the code you're using? Which version of AS do you use?

Resources