Child Forms support ...

Started by Franck Stegli, January 10, 2012, 11:44:16 AM

Previous topic - Next topic

Franck Stegli


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

Paul Squires

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.
Paul Squires
PlanetSquires Software

Franck Stegli


Hi Paul,

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

Franck

Franck Stegli


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



Paul Squires

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


Paul Squires
PlanetSquires Software

Franck Stegli


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