laatzen/Pruef2000/source/StdDialog.bas
2021-10-01 11:11:04 +02:00

110 lines
3.3 KiB
QBasic

Attribute VB_Name = "modStdDialog"
'==============================================================================
'
' File : modStdDialog.bas
' Date : 23.03.1999
' Version: 1.00
' Author : Reinhard Henning, Andreas Schmidt, lindner&partner
'
'==============================================================================
'
' Behandlung der Standarddialoge der Prüfstation
'
'==============================================================================
'
' History:
'
' Date : 23.03.1999
' Version: 1.00
' Author : Reinhard Henning, Andreas Schmidt, lindner&partner
'
' Erste dokumentierte Version.
'
'==============================================================================
Option Explicit
Global Const stdButtonWidth% = 1935
Global Const stdButtonHeight% = 615
' Zentrierung des frMain Frames in der Form und Anpassen der Größe
'
Public Sub setupStdDlg(frm As Form)
Dim nLeft As Integer
Dim nTop As Integer
' TODO: Taskbar in Höhenkalkulation einbeziehen
frm.Width = Screen.Width
frm.Height = Screen.Height
Call centerFormInScreen(frm)
' Titel-Label ausrichten
' ----------------------
If hasControl(frm, "lblTitle") Then
frm.lblTitle.FontSize = 14
frm.lblTitle.FontBold = True
frm.lblTitle.Font = "MS Sans Serif"
frm.lblTitle.Left = 0
frm.lblTitle.Top = 120
frm.lblTitle.Width = frm.Width
frm.lblTitle.Alignment = 2 ' center
End If
If hasControl(frm, "cmdSPSInfo") Then
frm.cmdSPSInfo.Top = TwipsPerPixelY(5)
frm.cmdSPSInfo.Left = TwipsPerPixelX(5)
frm.cmdSPSInfo.Height = TwipsPerPixelY(35)
frm.cmdSPSInfo.Width = TwipsPerPixelX(86)
End If
' Datenanzeigebereich zentrieren
' ------------------------------
nLeft = (frm.ScaleWidth - frm.frMain.Width) \ 2
nTop = (frm.ScaleHeight - frm.frMain.Height) \ 2 - TwipsPerPixelY(40)
'frm.frMain.BorderStyle = 0
frm.frMain.Left = nLeft
frm.frMain.Top = nTop
' Button "Weiter" ausrichten
' --------------------------
If hasControl(frm, "cmdOK") Then
frm.cmdOK.FontSize = 10
frm.cmdOK.FontBold = True
frm.cmdOK.Font = "MS Sans Serif"
frm.cmdOK.Width = stdButtonWidth
frm.cmdOK.Height = stdButtonHeight
frm.cmdOK.Left = frm.Width - frm.cmdOK.Width - TwipsPerPixelX(10)
frm.cmdOK.Top = frm.Height - frm.cmdOK.Height - TwipsPerPixelY(40)
End If
' Button "Zurück" ausrichten
' --------------------------
If hasControl(frm, "cmdCancel") Then
frm.cmdCancel.FontSize = 10
frm.cmdCancel.FontBold = True
frm.cmdCancel.Font = "MS Sans Serif"
frm.cmdCancel.Width = stdButtonWidth
frm.cmdCancel.Height = stdButtonHeight
frm.cmdCancel.Left = frm.Width - 2 * (frm.cmdCancel.Width + TwipsPerPixelX(10))
frm.cmdCancel.Top = frm.Height - frm.cmdCancel.Height - TwipsPerPixelY(40)
End If
End Sub
' @return true = das uebergebene Form besitzt ein Control mit dem
' angegebenen Namen
'
Private Function hasControl(frm As Form, sControlName As String) As Boolean
Dim ctrl As Control
For Each ctrl In frm.Controls
If UCase$(ctrl.Name) = UCase$(sControlName) Then
hasControl = True
Exit For
End If
Next
End Function