Recent

Author Topic: adjusting client area to make Non client taller using LCL ?  (Read 1099 times)

jamie

  • Hero Member
  • *****
  • Posts: 6091
adjusting client area to make Non client taller using LCL ?
« on: April 18, 2021, 08:00:28 pm »
In Delphi I can process the WM_NCCALCSIZE message and it receives it and I thus change the size so that I can maintain a different Non client area over the client area..

 I tried this with the LCL and its obvious one of those messages that are blocked from being processed so in order to keep with the tradition of cross roads here, how do you guys adjust the Client Rectangle so that we can have a larger non-Client area or make a non client area for a custom control ?


The only true wisdom is knowing you know nothing

Michl

  • Full Member
  • ***
  • Posts: 226
Re: adjusting client area to make Non client taller using LCL ?
« Reply #1 on: April 18, 2021, 08:46:29 pm »
To catch all messages, you can do something like this:
Code: Pascal  [Select][+][-]
  1. var
  2.   DefaultWndProc: WNDPROC;
  3.  
  4. function WndCallback(AHWND: HWND; uMsg: UINT; wParam: WParam; lParam: LParam):LRESULT; stdcall;
  5. var
  6.   LRect: TRect;
  7. begin
  8.   if uMsg = WM_NCCALCSIZE then
  9.     DoWhatEverYouWant
  10.   else
  11.     Result := CallWindowProc(DefaultWndProc, AHWND, uMsg, WParam, LParam);
  12. end;
  13.  
  14. procedure TForm1.FormCreate(Sender: TObject);
  15. begin
  16.   DefaultWndProc := Windows.WNDPROC(SetWindowLongPtr(Handle, GWL_WNDPROC, PtrInt(@WndCallback)));
  17. end;
But you are outside of LCL now.
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: adjusting client area to make Non client taller using LCL ?
« Reply #2 on: April 18, 2021, 08:48:18 pm »
yes, I understand that.. I know I can do that...

But, that won't work on other targets will it ?
The only true wisdom is knowing you know nothing

Michl

  • Full Member
  • ***
  • Posts: 226
Re: adjusting client area to make Non client taller using LCL ?
« Reply #3 on: April 18, 2021, 08:49:35 pm »
No, it's Windows only.
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

Michl

  • Full Member
  • ***
  • Posts: 226
Re: adjusting client area to make Non client taller using LCL ?
« Reply #4 on: April 18, 2021, 08:59:03 pm »
Just curious, why don't you spend your CustomControl a child control and use this?
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: adjusting client area to make Non client taller using LCL ?
« Reply #5 on: April 18, 2021, 10:34:36 pm »
I was trying to offset the orientation of the client so I could have Non Client controls for special operations.

I guess I can use a panel inside the form and use the WM_HITTEST to simulate non client actions. I'll do this in Delphi so that if I ever get brave enough to attempt a port over to Lazarus it won't be so painful.. I was really looking for an OS level control of it so it would automatically use its system colors etc

The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018