Hi friends
I try to change the splash size which has to depend on the size of a line of the message
procedure TFrmMain.LMMyMsg(var Msg: TLMessage);
var
AText: String;
ARect: TRect;
h: Integer; //height of the drawn text
AFlag: UINT;
SplashCenterPnt: TPoint;
DiffHeight: Integer;//difference between a splash height and textcontainer height
begin
ARect:= Rect(-500,0, FrmSplash.sttTextCont.Width - 500,0);
AText:= String(NativeInt(Msg.lParam));
with Self.Canvas do
begin
//uses LCLType
AFlag:=
DT_NOCLIP
or DT_WORDBREAK
or DT_LEFT
;
//uses LCLIntf
h:= DrawText(Handle,PChar(AText),-1, ARect, AFlag);
{ TODO : it's not work for linux GTK2. Why? }
with FrmSplash do
begin
sttTextCont.Caption:= '';
SplashCenterPnt.y:= Top + Height div 2;//a middle splash height
DiffHeight:= Height - sttTextCont.Height;
Height:= h + 15 + DiffHeight;
Top:= SplashCenterPnt.y - Height div 2;
Repaint;
InMsgStr:= AText;
end;
end;
end;
It perfectly works for windows
https://imgur.com/a/8C3kmand for Ubuntu
https://imgur.com/a/dtDJ6But it incorrectly works for Debian GTK2
https://imgur.com/a/N9vPrWhy? I will be grateful for any council