[Gambas-user] Rule to set form Height

Benoît Minisini g4mba5 at gmail.com
Sat May 1 14:25:06 CEST 2021


Le 01/05/2021 à 07:57, Safiur Rahman a écrit :
> Hi Bruce
> 
> Both of your method don't work. Still resize process continues for
> infinite times.
> This behavior is only with qt4/qt5. This problem is not with gtk3.
> Please check it using project I have attached.
> 
> 
> On 4/30/21, Safiur Rahman <isafiur at gmail.com> wrote:
>> Hi
>>
>> In a module (Module1):
>>
>> Private $DeskHeight As Integer = 1150 ''1200 ''1386 ''1100
>>
>> Public Sub SetFromSize(frm As Form)
>>
>>    Print CStr(Now()) & " : " & $DeskHeight
>>    frm.Height = $DeskHeight
>>    frm.Width = Screen.AvailableWidth
>>    frm.Left = 0
>>    frm.Top = 0
>>
>> End
>>
>> In a form:
>>
>> Public Sub Form_Resize()
>>
>>    Module1.SetFromSize(Me)
>>
>> End
>>
>> If form Height =1150 or 1200 then the procedure runs several times
>> If form Height = 1100 or 1386 then the process runs one or two times.
>>
>> Is there any rule to set form height? I am using QT5.
>>
>>
>> --
>> Regards
>> Safiur Rahman
>>
> 

The window manager is the one who decides which size your window will have.

So if that size differs from the one you request, and if your request is 
done inside the Resize event, you may have an infinite emission of 
Resize event coming from the window manager, depending on how external 
(coming from the window manager) and internal (eventually coming from 
your own size requests) resize events cross.

Usually, if you are modifying properties inside the handler of the event 
raised when these properties are modified, you are wrong!

In Qt component, I tried to not emitting internal resize events 
(assuming that they will lead sooner or later to external resize 
events). Then you won't have the recursion anymore, but your size 
requests are not necessarily taking into account by the window manager.

So you are still wrong.

Regards,

-- 
Benoît Minisini


More information about the User mailing list