Option Compare Database
Option Explicit

Public System As New cSystem

Private colFloatingPanes As New Collection


'//////////////////////////////////////////////////////////////////////
'// PURPOSE:    to load the home layout, this could be called at any
'//             time during the session
'//
'//////////////////////////////////////////////////////////////////////
Public Function loadHOME() As Boolean
    '// add panes, the first should the navigator pane
    'Call AddFloatingPane("paneMainNavigator", 520, 768)
    Call AddFloatingPane("paneMainNavigator", 550, 768)
    'Call AddFloatingPane("paneHOME", 520, 2700)
    Call AddFloatingPane("paneHOME", 550, 2700)
    Call AddFloatingPane("paneFooter", 520, 9300)
End Function




Public Function AddFloatingPane(paneForm As String, left As Variant, top As Variant)
Dim oForm As Form
    '// TODO: test if the form exists

    '// open the form
    DoCmd.OpenForm paneForm
    '// set pointer
    Set oForm = Forms(paneForm).Form
    
    System.Window.Translucent oForm.hWnd, 200
    
    '// TODO: test to see if the item is already in the collection
    
    '// add to collection
    colFloatingPanes.Add oForm, paneForm
    '// repostion if necessary
    oForm.SetFocus
    '// i started by using the .Move preperty of the form,
    '// the only problem is that this will move the form
    '// according to the access containter's size
    'oForm.Move left, top
    '// so i've decided to use DoCmd.MoveSize instead
    DoCmd.MoveSize left, top
    '// althought the sytem will clean up after you,
    '// might as well be polite and clean up our selves :)
    Set oForm = Nothing
End Function

Public Function RemoveFloatingPane(formName As String)
    
    '// TODO: test if the item exists, for now i'll ignore
    
    On Error Resume Next
    colFloatingPanes.Remove formName
    DoCmd.Close acForm, formName
End Function

Public Function RemoveAllFloatingPanes()
Dim I As Integer
Dim strPaneName As String
    'On Error Resume Next
    For I = 1 To colFloatingPanes.Count
        strPaneName = colFloatingPanes.Item(1).Name
        colFloatingPanes.Remove strPaneName
        DoCmd.Close acForm, strPaneName
    Next I
    Set colFloatingPanes = Nothing
End Function
