I have a generic VCL ActiveX Form with a TScrollBox on it. The TScrollBox does not get the OnMouseWheel message when I insert the control into a container. When I create the same control hierarchy in a normal VCL application, the TScrollBox does get the OnMouseWheel as expected.
Is there something special I have to do to receive mouse wheel messages in an ActiveX Form (C++ or Delphi) or does this just not work?
Related
I have a container control (TLayout or TPanel or TScrollbox, etc.) which can have several other nested controls inside. Is there a way in Firemonkey to know when the container becomes "active"? I mean for example:
when any of its children get focus or
user clicks any of its non-focus controls
I am asking for a kind of event-bubble. OnClick would be enough so when user clicks any nested control, the parent container is notified. Control's HitTest property would be a solution but if I set that property to False (to let the parent manages the onlick) on a TEdit, it becomes useless obviously (I can't type on it)
Edit:
A simple layout example:
Drop a TScrollBox in a form
Drop a TPanel in form and put it as child of the TScrollBox
Drop a TEdit in form an put it as child of TPanel
Ok, I can simply do a sort of Parent.Parent.Click after receive the OnClick on TEdit but imagine now several TScrollBoxes, with different level of nesting using TPanels with a bunch of different controls inside. It doesn't make sense neither adding the onclick code for each control in the tree, nor change the hierarchy of Parent.Parent.Click every time I redesign the layout adding an intermediate parent control.
Is there any way to do this in Firemonkey (either for Windows or MacOS)?
PS: I'm using Delphi 10.2.3 (Tokyo)
Delphi 10.2 behavior is very strange. When I move the cursor over any input control (TCheckBox, TEdit,...) the OnPaint message called on the form. I have a TPanel on the form witch is a canvas for custom drawing (TControlCanvas is used).
How could I disable the unwanted OnPaint messages because the custom draw could take a while (thousands of elements may draw themselves on it).
I just want it to repaint on form resize or on after invalidate.
I have a TFrame with some components on it, and among all it I have a TPanel and a TPaintBox such that the PaintBox size is the same as the Panel.
I would like that user will see the Panel and not only the PaintBox.
The problem is that when I right click on the Panel and choose Control->Send to Back, it doesn't work.
Any assumption, or suggestion for solution?
*I am working with Borland C++Builder 6.
TPaintBox is a TGraphicControl descendant. It has no HWND of its own, it simply draws on its Parent when the Parent is painted. As such, a TPanel (which has an HWND of its own) can never appear behind a TPaintBox unless the TPaintBox is a child of the TPanel.
This is a very particular issue. I've got a C# ActiveX control embedded in a Delphi7 form. The Tab key is being swallowed so tabbing from control to control doesn't work at the bottom most layer.
The Delphi7 layers are (from top to bottom):
Delphi form
DevExpress tabbed page control (TcxPageControl)
Embedded ActiveX
The ActiveX's layers are (from top to bottom):
A control that inherits DevExpress's control (XtraUserControl). This control is the COM visible object that is embedded in the Delphi form.
DevExpress panel (PanelControl)
DevExpress tab control (XtraTabControl)
DevExpress tab page (XtraTabPage)
DevExpress Textbox (TextEdit)
Tabbing from textbox to textbox doesn't work. PreviewKeyDown events don't fire from ActiveX's tab page and down. KeyDown event fires on ActiveX's tab control when I TAB, but this event doesn't exist at lower levels.
Tabbing works just fine if I put embed the ActiveX control in a C# form with all the same layers instead of Dephi7.
Delphi7's form has this code in it, which allows tabbing to work in other ActiveX controls I have embedded:
keybd_event(VK_TAB, 0, 0, 0);
Application.ProcessMessages;
I embed the control in code the same way I have done numerous other times with other ActiveX controls (which all work).
My thought is that there are too many layers and somehow the Tab key is being swallowed by a middle layer. How would I make tabbing work at the bottom layer?
I use Delphi7. I use custom memo control, TSyntaxMemo component.
I see that many apps (Notepad, Notepad++, uTorrent, ...) use standard popup menu for scrollbars:
scroll here
up
down
page up
page down
scroll up
scroll down
(this is list for a vertical bar).
How can I use such menus for scrollbars in "my" memo? W/o doing these menus by hands.
You don't have to do anything at all to make that menu show in a Windows EDIT control. That's a standard system menu implemented by the control. It appears on a TMemo added to a vanilla VCL forms app, since TMemo is simple a wrapper of the multi-line variant of the EDIT control.
Here's all I needed in my .dfm file:
object Form1: TForm1
object Memo1: TMemo
Align = alClient
ScrollBars = ssVertical
end
end
This is functionality provided by the system. If your control is not behaving that way then I can think of the following reasons why that happens:
Your control is not a Windows EDIT control.
Your control is an EDIT control but it is not using the default message handler that results in this menu.
If item 1 is the reason, then there's nothing you can do to get the system display the menu. If your control is not an EDIT control you can hardly expect it to magically behave like one. In the case of item 2, you need to work out how the control is stopping the message that leads to the menu being handled by the control's default message handler.