PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: dacarle on December 09, 2006, 07:11:11 PM

Title: MDI forms
Post by: dacarle on December 09, 2006, 07:11:11 PM
Is it possible:

1) to put a timer on or other non-visible object on an MDI form?

2) is it possible to have a fixed window inside an MDI form such that you could have fixed displays on the left or right sides on the window.  I am guessing that the MDI form would probably be the child of a larger form.  Are than any examples of this?

-David
Title: MDI forms
Post by: TechSupport on December 10, 2006, 11:20:22 AM
You can not place objects on a MDI child form (this is currently a FireFly restriction). You can easily create and destroy timers manually.

%IDC_MYTIMER = 100

Global gTimer As Long


'------------------------------------------------------------------------------------------------------------------------
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
   
  ' Create timer that fires every 1/2 second    
  gTimer = SetTimer( hWndForm, %IDC_MYTIMER, 500, %Null )
   
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_TIMER
        Beep
  End Select
     
End Function


'------------------------------------------------------------------------------------------------------------------------
Function FORM1_WM_DESTROY ( _
                         hWndForm      As Dword _  ' handle of Form
                         ) As Long
                         
  ' Kill the timer if it exists
  If gTimer Then KillTimer hWndForm, gTimer                      
                         

End Function
Title: Re: MDI forms
Post by: TechSupport on December 10, 2006, 11:31:35 AM
Quote from: dacarle
2) is it possible to have a fixed window inside an MDI form such that you could have fixed displays on the left or right sides on the window.  I am guessing that the MDI form would probably be the child of a larger form.  Are than any examples of this?
If I understand correctly, you want to resize the MDIClient area so that part of the screen can display some fixed information and the rest of the screen will display the MDI Child windows. By default, FireFly will resize the MDI Client area to size to the full area of the MDI Frame. You can easily resize the MDI Client yourself by dealing with the WM_SIZE message of the MDIForm (not the MDIClient).

Function MDIFORM_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

  ' Size the MDI Client window. Take into account the toolbar
  ' and StatusBars if they are visible.
 
  Local rc           As Rect
  Local hWndRebar    As Dword
  Local RebarHeight  As Long      
  Local StatusHeight As Long
  Local frmTabHeight As Long
 
  hWndRebar = GetDlgItem( hWndForm, IDC_MDIFORM_REBAR )
  If IsWindowVisible( hWndRebar ) Then
     GetWindowRect hWndRebar, rc
     RebarHeight = rc.nBottom - rc.nTop
  End If                                        
 
  If IsWindowVisible( HWND_MDIFORM_STATUSBAR ) Then
     GetWindowRect HWND_MDIFORM_STATUSBAR, rc
     StatusHeight = rc.nBottom - rc.nTop
  End If                                        

  If IsWindowVisible( HWND_FRMTAB ) Then
     GetWindowRect HWND_FRMTAB, rc
     frmTabHeight = rc.nBottom - rc.nTop
  End If                                        

  ' Position the frmTab form.
  SetWindowPos HWND_FRMTAB, 0, 0, _
               RebarHeight , _
               nWidth, frmTabHeight, _
               %SWP_NOZORDER
 
 
  ' Size the MDI Client window
  SetWindowPos HWND_MDIFORM_MDICLIENT, 0, 0, RebarHeight + frmTabHeight, _
               nWidth, nHeight - RebarHeight - StatusHeight - frmTabHeight, _
               %SWP_NOZORDER
     
  Function = %TRUE        
 
End Function
Title: MDI forms
Post by: TechSupport on December 10, 2006, 11:57:19 AM
Oh, I'm not a big fan of MDI style applications anymore. Most applications you see these days are no longer MDI, but rather some hybrid version.
Title: MDI forms
Post by: dacarle on December 10, 2006, 02:02:46 PM
Thanks.  There is a certain neatness to MDI, but in general I agree with you.

Thanks.

-David