Jump to content


Photo

NxGridPicker - OnMouseWheel for nested grid.


  • Please log in to reply
3 replies to this topic

#1 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 04 June 2014 - 12:13 AM

I'd like to be able to scroll the grid within the drop down using the MouseWheelUp/Down events. I noticed that these events are not inherited in NxGridPicker or any of its ancestor controls.
I imagine the NxGrid needs to have the scroll events forwarded from NxGridPicker in order to scroll, since a control requires focus for the mouse wheel events to fire and the grid is not focused -- which is why it's not working currently despite being setup to allow mouse wheel interaction.

Thanks.

#2 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 04 June 2014 - 11:57 PM

I ended up implementing the MouseWheelEvents

TNxGridPicker = class(TNxPopupEdit)
private
	FGrid: TNextGrid;
	procedure SetGrid(const Value: TNextGrid);
protected
	procedure BeforeDrop(var APoint: TPoint); override;
	function GetPopupControlClass: TNxPopupControlClass; override;
	function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
	function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
public
	constructor Create(AOwner: TComponent); override;
published
	property Grid: TNextGrid read FGrid write SetGrid;
	property onmousewheelDown;
	property onmousewheelUp;
end;
...
function TNxGridPicker.DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean;
begin
if Assigned(FGrid) then
	Result := FGrid.DoMouseWheelDown(Shift, MousePos)
else
	Result := inherited DoMouseWheelDown(Shift, MousePos);
end;

function TNxGridPicker.DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean;
begin
if Assigned(FGrid) then
	Result := FGrid.DoMouseWheelUp(Shift, MousePos)
else
	Result := inherited DoMouseWheelUp(Shift, MousePos);
end;


#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 07 June 2014 - 07:20 PM

Hello,

I will try to implement your code into official one.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#4 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 09 June 2014 - 09:44 PM

Great.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users