[Gambas-user] Resize event...
Benoit Minisini
gambas at ...1...
Mon Nov 10 00:07:36 CET 2008
On dimanche 9 novembre 2008, Doriano Blengino wrote:
> Stephen Bungay ha scritto:
> > A form, lets call it "FormX" contains a tabStrip which has another
> > form, call it "FormY" dynamically instantiated inside the TabStrip at
> > run-time. FormY has three controls on it, a calendar, a table, and a
> > VSplit to seperate them.
> > When FormX is resized the TabStrip is resized and I want to couple
> > this to FormY by firing it's resize event. I do this by explicitly
> > calling what I think is the FormY.Resize event, but FormY.Resize wants
> > Width and Height paramters passed to it. This I find kind of strange
> > because FormY_Resize has no Width and Height Parameters in the declared
> > in the event.
> > When the code is stepped through the FormY_Resize does not fire when
> > FormY.Resize(Width,Height) is called and the controls stubbornly remain
> > the size they were when initialized.
> > A couple of questions;
> >
> > 1. Why does FormY.Resize want Width and Height parameters when clearly
> > there are no such parameters in the FormY_Resize event?
> >
> > 2. Why is FormY_Resize not firing?
>
> Do not confuse the resize method with the resize event.
>
> You use the resize method when you want your form be resized, by program
> code. For example, the program loads a picture from disk, and then wants
> the form to adapt to the size of the picture. So the program issues a
> "me.resize(hPhoto.width, hPhoto.height)" (well, not exactly so, but you
> catch the idea).
>
> The resize event is fired from the external world, and the form "waits"
> for it to do something more than merely readjust its children controls.
> If you want to simply rearrange childrens, then a set of powerful
> features can be used (panels, h/vboxes, expand, ignore...), and chances
> are that you succed.
>
> So, in the first case, you command the form to resize, and you also have
> to tell it what sizes to assume. In the second case, the world tells you
> that the form dimensions are changed; you can read the new dimensions in
> the Width and Height properties, and take appropriate actions.
> This is why Form.resize() method takes parameters, and Form_Resize()
> takes none; because the latter case is only a signal, and you can be not
> interested in the real dimensions, only want to know that the user
> resized the form.
>
> Apart from this clarification, I had a hard debate with Benoit about
> embedding forms inside tabstrips. What I remember about the end, is that
> resize events will not raise. Full stop. I think this is an omission,
> because when the size of the form changes, a resize event should be
> fired no matter if the form is child of the desktop or child of a tabstrip.
>
No, if Resize event is not raised, then it was a bug. Are you sure that we
talked about that?
--
Benoit Minisini
More information about the User
mailing list