PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Franck Stegli on January 10, 2012, 11:44:16 AM

Title: Child Forms support ...
Post by: Franck Stegli on January 10, 2012, 11:44:16 AM

With PB9 and previous version of FF I was able to show a child window on an existing regular form. This was a simple way to have ready made containers to display and resize.

Now with PB10 and FF 3.51 I'm not able to make the same strategy, also old application are not working if I recompile !

Does anyone see this difference already ?

Franck
Title: Re: Child Forms support ...
Post by: Paul Squires on January 10, 2012, 05:57:14 PM
Hi Franck,

Could you please post a sample project showing the problem? I just created a simple 2 form project. I was able to display the child form after clicking the Command button:


'--------------------------------------------------------------------------------
Function FORM1_WM_CREATE ( _
                         hWndForm As Dword, _      ' handle of Form
                         ByVal UserData As Long _  ' optional user defined Long value
                         ) As Long

   HWND_FRMCHILD = frmChild_Show( hWndForm, %FALSE )
   
End Function


'--------------------------------------------------------------------------------
Function FORM1_COMMAND1_BN_CLICKED ( _
                                   ControlIndex     As Long,  _  ' index in Control Array
                                   hWndForm         As Dword, _  ' handle of Form
                                   hWndControl      As Dword, _  ' handle of Control
                                   idButtonControl  As Long   _  ' identifier of button
                                   ) As Long

   SetWindowPos HWND_FRMCHILD, 0, 0, 0, 100, 100, %SWP_SHOWWINDOW
   
End Function


I have many applications that use the child form/container approach. I can't remember having trouble.
Title: Re: Child Forms support ...
Post by: Franck Stegli on January 11, 2012, 05:18:09 AM

Hi Paul,

I sent you a zip file via the support@... cause of an attachment returned here while posting.

Franck
Title: Re: Child Forms support ...
Post by: Franck Stegli on January 11, 2012, 06:16:00 AM

Paul,

I observed that the problem resides in the SIZE procedure of the main container. In previous versions it was working with this code

Function PATHEDITOR_WM_SIZE ( _
                            hWndForm      As Dword, _  ' handle of Form
                            fwSizeType    As Long,  _  ' type of resizing request
                            nWidth        As Long,  _  ' new width of client area
                            nHeight       As Long   _  ' new height of client area
                            ) As Long
   Beep
   Local x&,y&,xx&,yy&
   Local rmarge&
   rmarge = 18
   FF_Control_GetSize (HWND_PATHEDITOR, x&, y&)                              'taille de la fenêtre   
   FF_Control_GetSize (HWND_GRAPHPANEL, xx&, yy&)                              'taille du panel droit   
   FF_Control_SetLoc (HWND_GRAPHPANEL, x-xx&-rmarge,10)                           'position du panel
   FF_Control_SetSize (ByVal HWND_GRAPHPANEL, xx&, ByVal nHeight - 20 )            'resize du panel
   FF_Control_SetSize (ByVal HWND_GRAPH, ByVal nWidth - 10 - xx&-rmarge, ByVal nHeight - 20 )   'resize du graph
   FF_Control_Redraw (HWND_GRAPH)
   
End Function


Now I have to trace why this sequence of functions are not more giving the rigth result .

Franck


Title: Re: Child Forms support ...
Post by: Paul Squires on January 11, 2012, 09:16:06 AM
Hi Franck,

I just downloaded and tried your program (pretty cool by the way). The problem is that FF35 is not setting the WS_VISIBLE window style when it creates the child form. All child forms are initially set to be hidden. i can't remember why I needed to do that but I did for some reason when I switched over to the new code in FF35.

To fix the problem, all you need to do is issue the following two commands. Probably put them in your WM_SIZE handler:

   FF_Control_ShowState HWND_GRAPH, %SW_SHOW
   FF_Control_ShowState HWND_GRAPHPANEL, %SW_SHOW


Title: Re: Child Forms support ...
Post by: Franck Stegli on January 11, 2012, 11:59:17 AM

Yes Paul this is the problem. I also added " Or %SWP_SHOWWINDOW " in the FF_Control_SetLoc to solve it. I don't know if this solution is suitable or not ?

Franck