Unable to get my Application to detect the Delete button - delphi

I apologize in advance for this vague question but can anyone give me a pointer to this problem?
The Delete key does not work as normal in my application. e.g. The Delete key has no effect in an editbox (i.e. it will not delete highlighted text) but Shift Delete does work. This seems to be the case thoughout the application. I have disabled all keypreviews and OnKey events in case they were causing it but the problem persists.
Can anyone suggest where I might look for the problem?
Running Windows 10 Delphi 10.3.3

If this happens only in this particular application, it is likely that you have a TActionList or TActionManager with an action using Delete as its shortcut, or a simple menu item with such a shortcut.
For instance, you might have an Edit menu with a Clear item using Delete as its shortcut:
Then that action or menu item will respond to Delete, not allowing the focused control to do its own thing.
This kind of mistake is surprisingly common. For instance, in the Delphi IDE, you have an edit field above the editor, showing you the current class:
If you select this text and press Ctrl+C, you expect it to end up in the clipboard. But no! Instead, the selected text in the code editor (if any) is copied, even though the code editor didn't have keyboard focus.

Related

Why does TSynEdit not detect Tab key pressed?

This is my first question, I hope it will be a well constructed one.
I'm currently using Delphi 10.4 Community Edition and I installed SynEdit through the GetIt Package Manager.
The problem I'm facing is the following: I created a VCL form, dropped a TSynEdit in it and launched the application. The problem is that if I press the TAB or SHIFT+TAB, nothing happens. I tried to put breakpoints in the following methods of TSynEdit:
CommandProcessor
ExecuteCommand
DoTabKey
and the debugger never enters them while pressing those keys.
I then looked at the Keystrokes property of my TSynEdit control and, although the keystroke for TAB is defined, I think that the shortcut is "fake". What I mean is that if I try to modify what is associated to the ecTab command and manually choose the shortcut value, nor Tab or Shift+Tab are present in the listbox.
Did anyone ever experienced a problem like this? If so, how did you manage to solve it?
PS: Indentation works with other shortcuts, such as CTRL+SHIFT+I/U.
As indicated by Keith Miller, it was as simple as setting to True the property WantTabs for the TSynEdit control.
Still, if anyone knows why the TAB and SHIFT+TAB shortucts don't appear in the listbox of selectable shortcuts, please let us know.

Deleting style elements from a style in Delphi Firemonkey

For the life of me, i can't seem to figure out how to delete primitive or control elements from a style with in the style designer of Delphi. What am I missing? I have tried right clicking everything i could find and no option surfaces. I tried looking for a panel that isn't enabled. Can't seem to find one. As of now, I have to edit the actual text and reload it, in order to delete a style element.
Delphi XE6
Delphi 10.1 Berlin
EDIT UPDATE:
How do I get this window to appear in either IDE?
EDIT UPDATE:
Looks like there is a very small button on top left of structure pane that does the trick. I will leave question open for someone to answer with any other way. If no one can, Ill post the answer and accept it.
To delete a style element (tested on Delphi 10.1 Berlin)
Right-Click the element in the Structure view to get a popup menu.
Select Edit - Delete
Or use the button (doc with red X) immediately above the structure tree.
Thanks to John, I can confirm that in XE4 .. XE7 the popup menu doesn't have the Edit menu, so the only means left is the delete button, mentioned above.
The third image (in your edit) is not familiar. Where did you get the image? Perhaps a third party style editor. Possibly not intended to be incorporated in the IDE.

Firemonkey and Mobile Navigation

I have an interesting observation and question, but first a comment. I have been using Delphi for 14 years and have taken a job developing an iOS mobile application using XE5. This is my first time using FMX and frankly I feel like I am stepping back in time many moons ago. In other words, if this is the future, then it feels like I have crippled. No problem though. Roll with the punches. Developing in this brave new world is not just a job. It is an adventure.
Now my question. Start a FMX mobile project using the "Header/Footer with Navigation" as your base. Then add an edit control (Edit1) to the first tab item. Then set the tab control align to none and move it to the right until you can clearly see the form itself. Then add an edit control (Edit2) to the form.
Now set the form's active control to Edit1 and run the app - no focus on Edit1. Now set the form's active control to Edit2 and run the app - focus is placed on Edit2. Interesting. Tab is a foreign word to tablets, right? Why have active control or even setfocus available? Is this an oversight by Embarcadero? Any thoughts?
Long story short I think they both have potential uses.
I use the SetFocus call to manually show the keyboard. Lets say the user navigates to a page where they're 100% sure to be putting in their username (or any text), I'll use ctrl.SetFocus to show the keyboard just to save them having to click (or is it press now?) on the edit.
I don't see ActiveControl being as useful, but it could definitely still be used. You could possibly use it to set up some sort of tabbing like structure for when the user presses Next on the keyboard (when the edit's ReturnKeyType is rkNext).

Adding "Paste" to the Shell Context Menu

I am using this routine to pop up the Shell Context Menu for a file name which is working well, except for one thing.
How to pop-up the Windows context menu for a given file using Delphi?
When I click "Copy" the menu closes as expected. If I move to another Folder or stay in the same one, when I right-click again for the Context Menu, it has no "Paste" option. Not even a grayed out one. I checked on the Poster's blog as mentioned in his Edit at the bottom, but that new routine crashes with Incorrect Parameter.
Can someone please assist with adding "Paste" to the original routine in the above link
Thanks
Look for TClipboard (library/uses ClipBrd). Using this you can manage a cliboard on Delphi.
More information: Basic CLipboard Operations
Obs.: You can use "Actions" too, depending your needs. See ActionManager component, and Action properties of your popupmenu.

Problems with leaving ComboBox on Delphi 7

I have just noticed a strange behavior of ComboBox component. I am using it in DropDownList style. If I click on it, it drops down the list of items, as usual. But then if I click on some other component on the form, the combobox will not let me leave it, unless I select one of the items. I thought of adding onmouseleave event, but in that case it would close even if I move mouse out of combobox area a little, which is undesirable. What I would like to see is combobox losing focus whenever i click somewhere outside of its area. Is that possible?
Actually, I just did what you did: started a new application and threw ComboBox and TEdit. Ran the program. It drops down the list just as you said when you clicked on it. Also, when I clicked on the TEdit, the combobox closed automatically as expected. So, I don't know what is the problem with your program.

Resources