Page 1 of 1

Resize & Refresh - Some observations.

Posted: Friday 06th September 2019 3:52am
by Quincunxian
Resizing
I posted a project in Project Showcase that converts some media formats.
Cogier noticed that I did not put in a Resize function even though the form was set to be resizeable.
So I added the resize functions and needed to set a minimum width & height as less than that, the form was not really usable so at the top of the Form_Resize routine I added.
Public Sub Form_Resize
  If Me.Width < 760 Then Me.Width = 760
  If Me.Height < 660 Then Me.Height = 660
  '...{rest of code to resize controls}
End
It did not work and on testing, it allowed me to resize the form less than the limits I had set !
I knew that this 'should' work as I've used the same format in other projects successfully.

Checking against another project that does work, I found that using the gb.gui component ignores the setting of the minimums and changing it to gb.qt4 component made it work correctly.

Note# Your Resize event should always be declared Public as if you declare it Private, it does not trigger.

Refreshing
When you are updating visual displays with new data in a loop or other fast acting update structure, you sometimes need to call a control.refresh method followed by a Wait function without any delay parameters which processes all pending events and returns immediately according to the Gambas wiki.
This forces a Redraw of the control to ensure that the visual display is updated with any new data.

I noticed that this was not working in one specific area as a Label control was not updating with new text as required. I added a small delay (0.1 second ) to the Wait function, the data was refreshed.

Be interested in any other observations that fellow Gambas users have.