[Gambas-user] Settings.Write(MyForm) could it only update pos/size if not maximized?

Bruce Steers bsteers4 at gmail.com
Sat Jan 21 15:32:17 CET 2023


On Sat, 21 Jan 2023 at 13:46, Bruce Steers <bsteers4 at gmail.com> wrote:

>
>
> On Fri, 20 Jan 2023 at 13:22, Benoit Minisini <
> benoit.minisini at gambas-basic.org> wrote:
>
>> Le 20/01/2023 à 12:16, Bruce Steers a écrit :
>> >
>> >
>> > On Fri, 20 Jan 2023, 02:57 Benoit Minisini,
>> > <benoit.minisini at gambas-basic.org
>> > <mailto:benoit.minisini at gambas-basic.org>> wrote:
>> >
>> >     Le 20/01/2023 à 01:28, Bruce Steers a écrit :
>> >      > Hey Ben.
>> >      > I've noticed something if we save a window position on program
>> >     exit with
>> >      > Settings.Write(Me) (my programs and the gambas ide)
>> >      >
>> >      > if the window is maximized the geometry saves as the full window
>> >     size,
>> >      > the screen and adds a var to the .Settings variant[] to specify
>> >     if it's
>> >      > maximized.
>> >      >
>> >      > On Reloading a previously maximized form and a Settings.Read(Me)
>> >     call it
>> >      > restores the windows full screen size then sets Maximized = True.
>> >      >
>> >      > Then if you un-maximize the window is still full screen just not
>> >     maximized.
>> >      >
>> >      > Wouldn't it be better or could we have an option to save the last
>> >     known
>> >      > window dimensions if maximized?
>> >      >
>> >      > Does that make sense? and would it even work?
>> >      > So if window was maximized on closing then on the next load it
>> would
>> >      > restore the non-maximized size, then maximize the window, then
>> upon
>> >      > un-maximizing the window should shrink to the last saved
>> >     un-maximized size.
>> >      >
>> >      > It seems pointless (and i think my idea is a better method) to
>> >     save the
>> >      > windows size if maximized considering the Settings.class will set
>> >      > Form.Maximized = True anyway.
>> >      >
>> >      > I feel that previous window position/size was data i wish i
>> >     hadn't lost :(
>> >      >
>> >      > ;)
>> >      >
>> >      > Respects
>> >      > BruceS
>> >      >
>> >
>> >     Good point.
>> >
>> >     --
>> >     Benoît Minisini.
>> >
>> >
>> > It's very good in action.
>> >
>> > I made the change last night and already appreciated doing it. (Hence
>> > the excited "ooh this is awesome" post)
>> >
>> > I accidentally submitted a merge thinking I was merging to my
>> > bruces-patched branch!
>> >   sorry, I cancelled it. (Hope that wasn't wrong of me)
>> > I doubt my implementation is how you would do it.
>> >
>> > Respects
>> > BruceS
>> >
>>
>> As you said, the GUI component must remember the old window coordinates
>> when the window is maximized (or made fullscreen, or any other state
>> logically).
>>
>> It seems possible to do that.
>>
>> Regards,
>>
>> --
>> Benoît Minisini.
>>
>
> I tried using the new property.
> Changed the line 420 in Settings.class WriteWindow method..
>
>   If hWindow.Maximized Or If hWindow.FullScreen Then
>     aVal = [hWindow.Geometry.X, hWindow.Geometry.Y, hWindow.Geometry.W,
> hWindow.Geometry.H, S, 1]
>   Else
>     aVal = [X, Y, W, H, S, 0]
>   Endif
>
> But i found if maximized...
> hWindow.Geometry.X is always 0
> hWindow.Geometry.Y is always 32
> hWindow.Geometry.W is 3px larger than normal W
> hWindow.Geometry.H is 1px larger
>
> Respects
> BruceS
>

Did some more testing.  putting this in my program...

Public Sub Form_State()

  Debug Me.Geometry.X, Me.Geometry.Y, Me.Geometry.W, Me.Geometry.H

End

seems to keep correct size when minimizing.
The above problems were with GTK3 only.
the X=0 , Y=32 are my Screen.AvailableX/Y properties.

QT5 gives this..
FMain.Form_State.57: 108        102     1008    471 , Normal size
FMain.Form_State.57: 109        102     1006    471 ' Form.Geometry on
maximizing. (So close)

Respects
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230121/f55914eb/attachment-0001.htm>


More information about the User mailing list