[Gambas-user] window resize help

Bruce Steers bsteers4 at gmail.com
Tue Dec 20 18:00:10 CET 2022


Could you check this out Ben as it might be a gambas bug.

the basic code for the left edge movement is thus...

Dim hRect As New Rect(Me.ScreenX, Me.ScreenY, Me.W, Me.H)
hRect.Left = Mouse.ScreenX
Me.Move(hRect.X, hRect.Y, hRect.W, hRect.H)

Now apparently that should not move the right window edge but it does
somewhat randomly jiggle it about.
Is it a bug or is there something i need to account for?

Many thanks
BruceS



On Tue, 20 Dec 2022 at 16:35, Bruce Steers <bsteers4 at gmail.com> wrote:

> I'm begining to thing it's a bug in the OS.
> i've noticed that when resizing firefox window from top or left edge the
> opposite edge seems to visibly waver a bit but get's corrected.
>
> attached is a much cleaner version that uses Rect to adjust the window and
> doesn't bother with mouse.startx
> but the left and top edge still glitch when moving.
>
> The only think i can think is that mouse position data being received is
> not clean and thows out the occasional wierd number that has to be
> accounted for.
>
> I found using Me.X caused more glitches that Me.ScreenX so i added a
> checkbox to use X or ScreenX when moving.
>
> So to anyone trying to help here i have found a number of ways to do
> resize, that is not the problem.
> there is a positional glitch happening.
>
> When moving the left edge the code get's the Rect of the form and modifies
> Rect.Left then uses Window.Move() with the Rect properties.
> this, according to docs, does not affect the right edge position, but
> there's a glitch i guess because the right edge moves a bit when it should
> not.
> Thank you for looking into it though :)
> Respects
> BruceS
>
>
> On Tue, 20 Dec 2022 at 14:18, gian via User <user at lists.gambas-basic.org>
> wrote:
>
>> Il 20/12/22 14:40, gian via User ha scritto:
>> > Il 19/12/22 17:10, Bruce Steers ha scritto:
>> >> Hey all.
>> >>
>> >> I wrote a routine to resize a window without a titlebar/border
>> >>
>> >> it tracks the mouse and makes the mouse image change okay (needs a
>> >> better way to set it back to normal though)
>> >>
>> >> Something is not correct though with moving the Left or Top edge and I
>> >> can't get my head around it.
>> >>
>> >> it seems to be jumpy setting the width or height when moving the left
>> >> edge top, the opposite edge moves a bit and it shouldn't :(
>> >>
>> >> I tried a few methods but still the left/top edge is glitchy :(
>> >> i've attached 2 versions
>> >> 1.0.1 just uses Me.Move a lot
>> >> 1.0.2 better uses Rect and i've tried to use Mouse.ScreenX not mouse
>> >> StartX method.
>> >> both glitch about the same.
>> >>
>> >> Anyone got a better, more robust method for window resizing via
>> >> left/top edge?
>> >>
>> >> Cheers
>> >> BruceS
>> >>
>> >
>> >
>> > Hi,
>> >
>> > I don't know if this will help your problem, but when I tried to find
>> > the exact height of the window menus so that I could show a popup
>> window
>> > (instead of the menu) I had noticed that the top position of the window
>> > minus the border differed depending on the libraries.
>> >
>> > For example:
>> >
>> >    For Each h As Component In Components
>> >      If h.Name Like "gb.qt*" Then
>> >        $iMenuH = hFont.TextHeight(sMenu) + Style.BoxFrameHeight
>> >      Else If h.Name Like "gb.gtk*" Then
>> >        $iMenuH = hFont.TextHeight(sMenu) + (Style.BoxFrameHeight * 2)
>> >      Endif
>> >    Next
>> >
>> >
>> > So the popup for QT libraries had to start slightly lower than for GTK
>> >
>> > Something similar I had done for the left side again with the help of
>> > Style but I couldn't find the latest version of my test and the old
>> ones
>> > didn't work right, sorry :-(
>> >
>> > Maybe Benoit could clarify things :-)
>> >
>> > Greetings
>> >
>> > Gianluigi
>> >
>>
>> Sorry I got confused, it is exactly the opposite :-(
>>
>> With GTK > $iMenuH = hFont.TextHeight(sMenu) + Style.BoxFrameHeight
>>
>> With QT > $iMenuH = hFont.TextHeight(sMenu) + (Style.BoxFrameHeight * 2)
>>
>> Greetings
>>
>> Gianluigi
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221220/75815250/attachment.htm>


More information about the User mailing list