[Gambas-user] Resize event...

Stephen Bungay sbungay at ...981...
Tue Nov 11 22:03:51 CET 2008


   Well, after much consultation with Benoit I finally understand what 
is going on and how to get around the problem.

   For the benefit of anyone else who has been reading this thread, 
Doraino and I were talking about instantiating a form inside a container 
on another form and resizing that embedded form when the parent is resized.

   In a nutshell the solution is to reference the instantiated form by 
it's handle reference, created at the time of it being instantiated, and 
NOT by its' name.

For example, consider an application that has three form classes, 
FormMain, FormX, and FormY. Form Main will contain a tabstrip and inside 
that tabstrip we want to instantiate FormX on tabstrip index 0 and FormY 
on tabstrip index 1. When we resize FormMain we want the embedded forms 
in their tabs to resize appropriately. Our FormMain Class logic might 
look like this;

' Gambas class file
Private mFormInitialized as Boolean
Private mhFormX As FormX
Private mhFormY AS FormY

Public Sub Form_Open()
   InitializeControls
End


Private Sub InitializeControls()
   TabStrip1.Index = 0
   mhFormX = New FormX(TabStrip1)

   TabStrip1.Index = 1
   mhFormY = New FormY(TabStrip1)

   TabStrip1.Index = 0

   mFormInitialized = True
End


Public Sub Form_Resize()
   With TabStrip1
        .Width = .Parent.width - 10
        .Height = .Parent.height - 20
        mhFormX.Resize(TabStrip1.Width - 10, Tabstrip1.Height - 10)
        mhFormY.Resize(TabStrip1.Width - 10, Tabstrip1.Height - 10)
   End With
End

   The resize events in the forms referenced by mhFormX and mhFormY will 
now fire as expected, the embedded forms resize events will now fire as 
expected.

Steve.

Doriano Blengino wrote:
> Benoit Minisini ha scritto:
>>> 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? 
>>   
> This happened some time ago - could be I am wrong, but the proof is 
> simple to produce.
> Right now I have no time but, in the course of today, may be I will find 
> the time to build a simple project. Anyway, Stephen Bungay complains for 
> the same reason as me, so I should be right...
> 
> You can wait for me to send a little project, or Stephen, or you can try 
> by yourself.
> 
> Regards,
> 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