mercredi 14 février 2007

Can ShowFormModal open a form to the maximum possible size for the screen without user intervention?

Resolution
The best way to re-size a modal window is to trap the OnModalWindowOpen event, grab the width and height properties of the modal window, and modify them directly to your needs. For example:
'----------------------------------------------------------------------
' Name: OnModalWindowOpen' Purpose: This function resizes' the modal window to an appropriate size
.'----------------------------------------------------------------------
' Inputs: N/A' Returns: N/A
'----------------------------------------------------------------------
' Revision Date Author Description
' -------- -------------- -------- ----------------
'----------------------------------------------------------------------
Function OnModalWindowOpen()
Const strfrmCONTACT = "Contact"
Const strfrmFACILITY = "Facility"
Const strfrmASSOCIATIONS = "Associations"
Const strfrmCOMPANY_TEAM_MEMBER = "Company Team Member"
Const strfrmDEPARTMENT = "Department"
Const strfrmDEPT_CONTACT = "Dept Contact"
Const strfrmOPPORTUNITY = "Opportunity"
Const intWIN_HEIGHT_THRESHOLD = 200
On Error Resume Next
If CInt(Left(UIMaster.Window.dialogHeight, 3)) < intWIN_HEIGHT_THRESHOLD Then
Select Case UIMaster.RUICenter.Form.FormName
Case strfrmCONTACT, strfrmFACILITY, strfrmASSOCIATIONS, strfrmCOMPANY_TEAM_MEMBER, _strfrmDEPARTMENT, strfrmDEPT_CONTACT, strfrmOPPORTUNITY
UIMaster.Window.dialogHeight = UIMaster.Window.dialogWidth
' Set the default height to same as the width
End Select
Err.Clear
' Clear the error thrown if this is not an Active Form
End If
End Function

Aucun commentaire: