Recent

Author Topic: PopupNotifier Size?  (Read 3107 times)

atheros

  • Newbie
  • Posts: 3
PopupNotifier Size?
« on: August 02, 2015, 05:37:28 pm »
Hello everyone. I'm a new member of Lazarus forum. I hope to be helped to improve myself.

Anyone can tell me how to change the size of PopupNotifier. And how about the color text?
THANKS ALL!

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: PopupNotifier Size?
« Reply #1 on: August 02, 2015, 06:57:14 pm »
TPopupNotifier was not designed to be particularly customisable.

The Text content is painted via a private TLabel, which is not accessible except through heavy hacks, so the font colour is to all intents and purposes fixed as clBlack.

The size of the window is hard-coded as 325 x 110. However, the THintWindow used for display is a public property, so if you really want to you can do limited size adjustments of this sort:

Code: [Select]
procedure TForm1.ButtonShowPopupClick(Sender: TObject);
const
  aText ='This is a longish string to test how well TPopupNotifierEx performs when given'+
         ' a fairly long string to work with. Note this is just a test.';
var
  r: TRect;
begin
  PopupNotifier1.Title:='Resize test';
  PopupNotifier1.Text:=aText;
  r:=PopupNotifier1.vNotifierForm.CalcHintRect(110, aText, nil);
  PopupNotifier1.vNotifierForm.HintRect:=r;
  PopupNotifier1.vNotifierForm.Width:=r.Right-r.Left + 50;
  PopupNotifier1.vNotifierForm.Height:=r.Bottom-r.Top + 10;
  PopupNotifier1.Visible:=True;
end;

atheros

  • Newbie
  • Posts: 3
Re: PopupNotifier Size?
« Reply #2 on: August 03, 2015, 05:01:41 am »
Thank you, howardpc. I'll try it.

 

TinyPortal © 2005-2018