Jump to content


Photo

NxFlipPanel - OnExpand / OnCollapse


  • Please log in to reply
4 replies to this topic

#1 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 09 July 2014 - 09:41 PM

I'm left wondering why these aren't there. They seem obvious to me.

#2 FourWhey

FourWhey
  • Members
  • 165 posts

Posted 10 July 2014 - 04:56 PM

I added the necessary changes to implement the published properties for the events. However, the events are not visible in the IDE object inspector. Do I need to reinstall the control for it to register in the IDE?

TNxFlipPanel = class(TNxCollectionControl)
private
FOnCollapse: TCollapseEvent;
FOnExpand: TCollapseEvent;
procedure DoCollapse(var Accept: Boolean); dynamic;
procedure DoExpand(var Accept: Boolean); dynamic;
...
published
property OnCollapse: TCollapseEvent read FOnCollapse write FOnCollapse;
property OnExpand: TCollapseEvent read FOnExpand write FOnExpand;
...
procedure TNxFlipPanel.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
var
AcceptChange: Boolean;
begin
inherited;
FMouseDown := False;
if Button = mbLeft then
case FFlipKind of
	 fkButton:
	 if (PtInRect(GetButtonRect, Point(X, Y)) and ShowButtons) then
	 begin
		 Expanded := not Expanded;
	 end;
	 fkHeaderAndButton:
	 if (PtInRect(GetHeaderRect, Point(X, Y))) then
	 begin
		 Expanded := not Expanded;
	 end;
end;

if Expanded then
begin
AcceptChange := True;
DoCollapse(AcceptChange);
if AcceptChange then Expanded := False;
end else
begin
AcceptChange := True;
DoExpand(AcceptChange);
if AcceptChange then Expanded := True;
	 SetFocus;
end;
end;

procedure TNxFlipPanel.DoCollapse(var Accept: Boolean);
begin
if Assigned(FOnCollapse) then FOnCollapse(Self, Accept);
end;

procedure TNxFlipPanel.DoExpand(var Accept: Boolean);
begin
if Assigned(FOnExpand) then FOnExpand(Self, Accept);
end;


#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 13 July 2014 - 07:12 AM

Hi,

There is a onchange event. Maybe you want to use it instead?

But, if you want to continue with your code, you only need to recompile NxCollectionRun_dx package.

Btw. I think that it is better to put this events inside SetExpanded procedure.
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 14 July 2014 - 03:24 PM

Hi,

There is a onchange event. Maybe you want to use it instead?

But, if you want to continue with your code, you only need to recompile NxCollectionRun_dx package.

Btw. I think that it is better to put this events inside SetExpanded procedure.


Yeah I may not keep it. Thanks for your input, I'll see if onchange will do what I want.

#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 16 July 2014 - 08:02 PM

But maybe I can add them anyway. Maybe somebody find them useful beside onchange.
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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users