Jump to content
Ian Branch

Move a form a few pixels??

Recommended Posts

Hi Team,

I have a Dashboard application that the Customer leaves up on their TV Monitor all day.  I am not sure what type of TV Monitor it is.

They used to leave it on 24/7 but I put an 8 hour time limiter on it. ;-)

I'd like to mitigate any burn in by randomly moving/shifting the form.

Is this possible?  If so, how please?

 

Regards & TIA,

Ian

 

Share this post


Link to post

Just change Top and Left properties using a timer.

If you shift the form (ie: Top := Top + 1;) don't forget to test is the form goes out of the screen (Use the screen variable to get the with and height.

Share this post


Link to post

Hi Francois,

Tks.  I was hoping it would be something as simple as that.

 

Regards,

Ian

Share this post


Link to post

I would do something like this:

 

var
  ws: TWindowState;
  l: TRect;
begin
  ws:=WindowState;
  l:=BoundsRect;
  try
    if ws=wsMaximized then
      WindowState:=TWindowState.wsNormal;

    SetBounds(l.Left+1, l.Top+1, l.Width, l.Height);
    Repaint;
    Sleep(100);
  finally
    WindowState:=ws;
    if ws<>TWindowState.wsMaximized then
      SetBounds(l.Left, l.Top, l.Width, l.Height);
    repaint;
  end;
end;

 

Share this post


Link to post
1 minute ago, David Heffernan said:

Easier to replace the CRT monitor with an LCD

Do you get burn-in with LCD?
 
 
 
While LCDs are not susceptible to burn-in the same way CRT monitors are, LCDs suffer from what manufacturers call image persistence. Like the burn-in on CRTs, image persistence on LCD monitors is caused by the continuous display of static graphics on the screen for extended periods.

(I am not going to test this on my monitor)

Share this post


Link to post
Just now, David Heffernan said:

Easier to replace the CRT monitor with an LCD

It would be if I had any say in it..

 

Lajos,

I took your suggestion and made it into this..

procedure TMainForm.MoveWindowTimer(Sender: TObject);
var
  ws: TWindowState;
  l: TRect;
  iLeft, iTop: SmallInt;
begin
  ws := WindowState;
  l := BoundsRect;
  iLeft := RandomRange(-10, 10);
  iTop := RandomRange(-10, 10);
  //
  if ws = wsMaximized then WindowState := TWindowState.wsNormal;
  SetBounds(l.Left + iLeft, l.Top + iTop, l.Width, l.Height);
  Repaint;
end;

Works perfectly.

 

Regards & Tks to all.

Ian

 

Share this post


Link to post

No need to call Repaint.

No need to change position if window is minimized.

Pay attention to not go out of the monitor limits.

Share this post


Link to post

Hi Francois,

1 minute ago, FPiette said:

No need to call Repaint.

Noted.

1 minute ago, FPiette said:

No need to change position if window is minimized.

It can't be.

1 minute ago, FPiette said:

Pay attention to not go out of the monitor limits.

Not probable but not impossible.  They can always drag it back to the center of the screen if they like. ;-)

 

Regards,

Ian

Share this post


Link to post

You can easily make the window bounce on the edges of the monitor. Easy calculation.

Share this post


Link to post
On 8/24/2022 at 9:03 AM, Lajos Juhász said:
Do you get burn-in with LCD?
 
 
 
While LCDs are not susceptible to burn-in the same way CRT monitors are, LCDs suffer from what manufacturers call image persistence. Like the burn-in on CRTs, image persistence on LCD monitors is caused by the continuous display of static graphics on the screen for extended periods.

(I am not going to test this on my monitor)

Just so it wont be forgotten, OLEDs may suffer from the same issue. But modern TVs and maybe displays as well have nifty workarounds installed (spoiler alert: they do what Ian plans to implement themselves). Read here for more infos: https://www.displayninja.com/oled-screen-burn-in/

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×