How to disable the popup menu of TMemo? - delphi

I'm using Firemonkey TMemo component in my desktop application, I hope that when the user right-clicks or Long-Taps on the Memo , the default menu will not been pop up.

This is actually easy.
Just drop a new TPopupMenu on your form and give it a good name (pmRecipe, say). Make sure not to add any menu items to it! Then simply assign it to your memo's PopupMenu property.
However, as a user of your application, I expect a context menu, so I might get annoyed by the lack of such a menu. (I'd also be annoyed by the fact that the app is FMX and not VCL and that the control isn't the native Windows EDIT control, but maybe that's just me.)

Related

Unable to get my Application to detect the Delete button

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.

How can I disable clicking in a FMX Form?

For an Application I need the user to be disabled to click on a specific window, while he is still able to use a window, which is in front of the other window.
In Delphi, this works perfectly fine with
ExampleForm.Enabled:= False;
but in Firemonkey it seems as if the enabled property does'n exist anymore. As well, it would be really helpful if it could disable the keyboard inputs etc. as well. I would really appreciate a solution for that problem, thanks for your time!
PS: I use the Delphi 10.3 Version
In Firemonkey, you're typically expected to implement all of your controls inside of a TLayout or one of its descendants such as TGridLayout. As long as all of your controls are in there, you can disable its Enabled property. The form is really just a container and not the same type of control in FMX as it is in VCL.

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.

VCL style mac look style designer

Recently I've been doing some research in to VCL Styling (Embarcadero XE2 for Delphi).
I can load and set the styles so that works fine.
Currently I'm exploring the VCL Style Designer and what I try to figure out is how can I move the minimize, maximize, resize, close and help button to the left instead of the current default right while the application text (caption of the form) is on the right.
I am at my whits end and hope some one can give me some pointers.
So basically what I try to 'emulate' is the Mac look on a Windows form.
Any help is welcome.
What do you want accomplish is not related to the VCL Style Designer, instead you must create a custom form style hook.
Follow these steps.
Create (and register) a new form style hook descending from the TFormStyleHook class.
Override the PaintNC method to draw the title buttons in the new positions.
Handle the WM_NCMOUSEMOVE, WM_NCLBUTTONDOWN and WM_WM_NCLBUTTONUP messages to detect the status of the title buttons (hot, pressed) and fire the actions (close, restore, maximize, minimize).

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