[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More than one program no longer keeps window dimensions.


On Wed, 16 Apr 2025 at 15:10, Bruce Steers <bsteers4@xxxxxxxxx> wrote:

> More than one of my programs are not saving/restoring window positions
> properly any more.
> (seems to be GTK+ only)
>
> in the attached program i have tracked it down to the Form_Hide event
> triggering at least 3 times when i load the program in Tray mode. (argument
> -t)
>
> The form should Show, Then quickly Hide to tray. it did this okay but has
> broken very recently due to a change. (as have other programs)
>
> Even when starting normally if i hide the window the Form_Hide event runs
> twice but the values remain the same.
>
> when i use the -t arg to make it hide to tray on program start the
> Form_Hide event of FMain triggers 3 times and on the third time the Height
> and Width are only 1
>
> i have Settings.Save(Me) in Form_Hide() ,
> the third event that fires and has .H and .W as 1 then gets saved
> (corrupted)
>
> I have a few programs suffering similar bugs now.
>
> Respects
> BruceS
>

So i adjusted the instructions in Main() in my Startup.class that hides the
FMain window just after showing it.

Public Sub Main()
' snip irrelevant code.

  FMain.Show

  If bStartTray Or If Settings["StartMinimized", False] Then
    If Not bStartOpen Then
    FMain.Hide
    Object.Lock(FMain)
    Wait
    Object.UnLock(FMain)
    Endif
  Endif

End

Locking FMain and using Wait to let the event loop cycle has stopped it
firing the Hide event again.

Without doing that the hide event triggered with the FMain.Hide instruction
and then again after Sub Main() had completed. ??

Respects
BruceS

References:
More than one program no longer keeps window dimensions.Bruce Steers <bsteers4@xxxxxxxxx>