Good evening Boki,
Would you consider making the function GetButtonRect public for tnxHeaderPanel (like in tnxExpnadPanel)) this allows some neat use of a tnxheaderPanel. I am using it as a container for a whole form, thus having a nice caption and using the collapse button as a close button; this work well unless the window is modal, in which case, I need to be able to drag using the mousedown on the header and still use the collapse button like this:
procedure TTaskHistory.NxHeaderPanel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
var
h: tnxHeaderPanel;
begin
inherited;
h := Sender as tNxHeaderPanel;
// if I am indeed in the header
if PtInRect(Rect(0, 0, h.ClientWidth, h.HeaderSize), Point(X, Y)) then
begin
// and not on the collapse button
if not PtInRect(h.GetButtonRect, Point(X, Y)) then
begin
ReleaseCapture;
SendMessage(Self.Handle, WM_SYSCOMMAND, SC_MOVE + 2, 0) // WM_SYSCOMMAND, 61458, 0) ;
end;
end;
end;
and in the oncollapse event:
procedure TTaskHistory.NxHeaderPanel1Collapse(Sender: TObject; var Accept: Boolean);
begin
inherited;
if (fsModal in self.FormState) then
begin
self.ModalResult := mrOk;
Self.CloseModal;
end
else
self.Close;
end;
I made GetButtonRect public in my version and could not see any side effects
tnxheaderpanel
Started by didiergm, Mar 19 2011 09:09 PM
1 reply to this topic
#1
Posted 19 March 2011 - 09:09 PM
#2
Posted 20 March 2011 - 02:52 AM
Hello Didier,
I have move GetButtonRect into public. It will be there in next release.
Best regards
I have move GetButtonRect into public. It will be there in next release.
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.
--
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.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users