Resize & Refresh - Some observations.
Posted
#1
(In Topic #311)
Expert

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.
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.
Cheers - Quin.
I code therefore I am
I code therefore I am
Posted
Regular

BTW, when a menubar is present, it seems to take up about 21 or 22 pixels(?) of space, and the other controls then measure X=0 from the bottom of the menubar. Note that the form Height still reflects the full amount, including the menubar.
Posted
Guru

Resize the attached, no code required.
Posted
Regular

Steve
UPDATE: I did create a project of type 'Graphical application' which is using gb.gui and it behaves as he says. The height/width are ignored, even if I do a Wait.
Code (gambas)
- ' If Me.Width < 800 Then
- ' Me.Width = 800 '$objToolBarActionsDock.FormDesignerWidth
- ' Wait
- ' Endif
- ' If Me.Height < 600 Then
- ' Me.Height = 600 '$objToolBarActionsDock.FormDesignerHeight
- ' Wait
- ' Endif
- $objToolBarActionsDock.Apply
- $objStatusBarDock.Apply
- $objPanelTestAnchor.Apply
- $objHBoxFormButtonsAnchor.Apply
Interestingly, the other projects I am playing with using the Gtk3 and Qt5 components seem to be enforcing the minimum without code. I must play around and see if it is one of the form properties doing that…
UPDATE2: if, instead, I try to resize another way, it still does not work. However, I noticed that my other code seems to be seeing those form properties being set, and acting accordingly, even though the viewport or window frame is smaller.
Code (gambas)
- ' If Me.Width < 800 Then
- ' Me.Width = 800 'TODO:$objToolBarActionsDock.FormDesignerWidth
- ' Wait
- ' Endif
- ' If Me.Height < 600 Then
- ' Me.Height = 600 'TODO:$objToolBarActionsDock.FormDesignerHeight
- ' Wait
- ' Endif
- $objToolBarActionsDock.Apply
- $objStatusBarDock.Apply
- $objPanelTestAnchor.Apply
- $objHBoxFormButtonsAnchor.Apply
Dock.Apply.72: f:w=800,h=600
Dock.Apply.72: f:w=800,h=600
Dock.Apply.72: f:w=800,h=600
Dock.Apply.72: f:w=800,h=600
Gambas 3.14
1 guest and 0 members have just viewed this.

