PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Richard Kelly on April 05, 2010, 12:08:06 AM

Title: Custom Resizing on FF app startup
Post by: Richard Kelly on April 05, 2010, 12:08:06 AM
When I exit my FF app, I save the main form size. When the app starts I want to restore the main form to that size. I can get the form resized ok but the FF resizing rules are not applied. I tried sending a WM_SIZE message with the new width/height but that doesn't seem to do anything. Suggestons?
Title: Re: Custom Resizing on FF app startup
Post by: Richard Kelly on April 23, 2010, 08:23:59 AM
From the lack of responses, I conclude that setting form sizes in code and the auto resize capabilities of FF are mutually exclusive....
Title: Re: Custom Resizing on FF app startup
Post by: Brian Chirgwin on April 23, 2010, 09:20:06 AM

Use PostMessage in the Create.

PostMessage postpones the re-size of controls until after the create of the form completes. This allows FF to get the initial sizes of the controls before the form size is changed. The inital size of the controls is required to determine the resize of the controls.




%WM_CONFIGSIZE = %WM_USER + 1000

'--------------------------------------------------------------------------------
function FORM1_WM_CREATE ( _
                         hWndForm as dword, _      ' handle of Form
                         byval UserData as long _  ' optional user defined Long value
                         ) as long
   
   postmessage HWND_FORM1, %WM_CONFIGSIZE, 0, 0
   
   
end function



'--------------------------------------------------------------------------------
function FORM1_CUSTOM ( _
                      hWndForm      as dword, _  ' handle of Form
                      wMsg          as long,  _  ' type of message
                      wParam        as dword, _  ' first message parameter
                      lParam        as long   _  ' second message parameter
                      ) as long
   
   select case wMsg
   case %WM_CONFIGSIZE
     ' Resize form based on saved settings here.
     ' I randomly size the form for testing
      ff_control_setsize( HWND_FORM1, rnd(350,1280), rnd(300,768))
     
   end select     
end function


Title: Re: Custom Resizing on FF app startup
Post by: Richard Kelly on April 24, 2010, 04:06:36 AM
Wow, that was so hard to do... ;)

I just retrieved the size from my INI file (save with the values from FF_Control_GetSize) and in the custom function...


FF_Control_SetSize (hWndForm, wParam, lParam)


Pizza's on me boyz....