[Gambas-user] Resize event...

Stephen Bungay sbungay at ...981...
Mon Nov 10 00:00:50 CET 2008


   Thanks for the clarification, the resize method is new since I last 
did extensive work with GAMBAS, IMHO it is not required. On thye surface 
of it setting the Width and Height Properties perform the same function 
as the Resize method.

   The timer hack is a major kludge and is not acceptable.

   If one calls the resize method and the form "resizes" then a "resize 
event" has occurred and that event should fire.

.Parent form resize event occurs due to user interaction
.. Programmer's code adjusts tabstrip size.
.. Programmer calls embedded forms' resize method with new size params
....Embedded form resizes
....Embedded forms' resize event fires (it just resized after all!)
......Resize event can be used by programmer to adjust child controls.

   The resize event of an object should fire when that object is 
resized, full stop. Who or what caused the resize to occur is irrelevant.

   Benoit: how can one dynamically resize form objects that are embedded 
in a tabstrip?


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.
> 
> I tried several way to solve, and found none (well, something could be 
> done by using horrible hacks, which breaked form/tabstrip independency). 
> But a stupid trick could be this one:
> 
> Put a timer on the form, and declare two private variables like 
> "mywidth" and "myheight".
> Every second, or whatever, the timer event fires, and you do:
> 
>     sub timer1_timer()
>       if mywidth=me.width and myheight=me.height then return   ' nothing 
> happened
>       ' form has been resized
>       mywidth = me.width
>       myheight = me.height
>       ' additional code...
>     end
> 
> Funny uh?
> 
> Salutations,
> Doriano
> 
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 




More information about the User mailing list