home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Kompuutteri Kaikille K-CD 2002 #3
/
K-CD_2002-03.iso
/
OpenOffice
/
f_0031
/
DlgControl.xba
< prev
next >
Wrap
Extensible Markup Language
|
2001-10-12
|
6KB
|
203 lines
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DlgControl" script:language="StarBasic">Option Explicit
Dim CalBitmap As Object
Public bSelectByMouseMove as Boolean
' Todo: Adjustmentlistener an der Scrollbar anmelden
Sub Main()
Call CalAutopilotTable()
End Sub
Sub CalcmdDeleteSelect()
Dim MsgBoxResult as Integer
If Ubound(DlgCalModel.lstOwnData.SelectedItems()) > -1 Then
MsgBoxResult = MsgBox(cCalSubcmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubcmdDeleteSelect_DeleteSelEntryTitle$)
If MsgBoxResult = 6 Then
DlgCalModel.lstOwnData.StringItemList() = RemoveSelected(DlgCalModel.lstOwnData)
' Flag zum Speichern der neuen Daten.
bCalOwnDataChanged = True
DlgCalModel.cmdDelete.Enabled = Ubound(DlgCalModel.lstOwnData.StringItemList()) > -1
Call CalClearInputMask()
End If
End If
End Sub
Sub CalSaveOwnEventControls()
With DlgCalModel
.txtOwnEventDay.Tag = .txtOwnEventDay.Value
.txtOwnEventMonth.Tag = .txtOwnEventMonth.Text
.DlgCalModel.txtOwnEventYear.Tag = DlgCalModel.txtOwnEventYear.Value
End With
End Sub
'Sub ModIntTextBox (txtYear As Object, ByVal nMax%, ByVal nMin%, ByVal sDefault$, IncFactor as Integer)
' Dim nActVal&
' nActVal& = Val(txtYear.Text)
' If ((0 = nActVal&) Or (nMax% < nActVal&) Or (nMin% > nActVal&)) Then
' Beep
' txtYear.Text = sDefault$
' Exit Sub
' End If
' If IncFactor = 1 Then
' If nMax% > nActVal& Then
' txtYear.Text = Trim(Str(nActVal& + 1))
' Else
' Beep
' txtYear.Text = nMax%
' End if
' ElseIf IncFactor = -1 Then
' If nMin% < nActVal& Then
' txtYear.Text = Trim(Str(nActVal& - 1))
' Else
' Beep
' txtYear.Text = nMin%
' End if
' End If
'End Sub
Sub ToggleYearBox()
' Falls der RadioButton f├╝r einen Jahreskalender angeklickt
' worden ist, m├╝ssen die Controls f├╝r den Monat Disabled
' werden, da ihre Werte in einer Jahrestabelle aufgehen.
With DlgCalModel
.txtOwnEventYear.Enabled = .chkEventOnce.State = 1
.lblEventYear.Enabled = .chkEventOnce.State = 1
If .txtOwnEventYear.Value = 0 And .lblEventYear.Enabled Then
.txtOwnEventYear.Value = Year(Now)
End If
End With
End Sub
Sub CalMouseMoved(aEvent as object)
Dim ListIndex as Integer
Select Case sCurLangLocale
Case cLANGUAGE_GERMAN
If bSelectByMouseMove Then
ListIndex = CalGetGermanLandAtMousePos(aEvent.X, aEvent.Y, Land$)
DlgCalendar.GetControl("lstHolidays").SelectItemPos(ListIndex, True)
End If
End Select
End Sub
Sub SelectState(aEvent as Object)
Dim ListIndex as Integer
If aEvent.ClickCount >= 1 Then
ListIndex = CalGetGermanLandAtMousePos(aEvent.X, aEvent.Y, Land$)
DlgCalendar.GetControl("lstHolidays").SelectItemPos(ListIndex, True)
bSelectByMouseMove = False
End If
End Sub
Sub MouseLeavesImage
bSelectbyMouseMove = True
End Sub
'Sub CalChangeGeneralMonth()
'
' Dim MonthToCheck$
' Dim ValMonthToCheck%
'
' MonthToCheck$ = DlgCalModel.txtMonth.Text
' ValMonthToCheck% = Val(MonthToCheck$)
'
' If (ValMonthToCheck% >= 1) And (ValMonthToCheck% <=12) Then
' DlgCalModel.txtMonth.Text = cCalShortMonthNames$(ValMonthToCheck%)
' Exit Sub
' End If
'
' If CalGetIntOfShortMonthName%(Trim(Left(MonthToCheck$, 3))) = 0 Then
' Beep
' DlgCalModel.txtMonth.Text = DlgCalModel.txtMonth.Tag
' Else
' DlgCalModel.txtMonth.Text = Trim(Left(MonthToCheck, 3))
' End If
'
'End Sub
Sub CalClearInputMask()
Dim NullList() as String
' L├╢scht die Werte der Eingabe Controls f├╝r ein neues Ereignis.
With DlgCalModel
.chkEventOnce.State = 0
.lblEventYear.Enabled = False
.txtOwnEventYear.Enabled = False
.txtOwnEventYear.SetPropertyToDefault("Value")
.txtEvent.Text = ""
.txtOwnEventDay.SetPropertyToDefault("Value")
.cmdInsert.Enabled = False
' Todo: Wie kriegt man den Focus auf dieses verdammte Control?
' .txtEvent.DefaultButton = True
End With
DlgCalendar.GetControl("lstOwnEventMonth").SelectItemPos(0,True)
CurOwnMonth = 1
End Sub
Sub CalmdSwitchOwnDataOrGeneral()
'Ändert den Titel der Dialogbox beim Seitenwechsel und die
'Beschriftungen der Kn├╢pfe
If DlgCalModel.Step = 1 Then
DlgCalModel.Step = 2
DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_Back$
DlgCalModel.cmdInsert.Enabled = DlgCalModel.txtEvent.Text <> ""
ToggleYearBox()
Else
DlgCalModel.Step = 1
DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
End If
End Sub
Sub ToggleInsertButton()
DlgCalModel.cmdInsert.Enabled = LTrim(DlgCalModel.txtEvent.Text) <> ""
End Sub
Sub CalUpdateNewEventFrame()
Dim bDoEnable as Boolean
Dim sSelectedItem
Dim ListIndex as Integer
Dim MaxSelIndex as Integer
Dim iMonth as Integer
bDoEnable = False
With DlgCalModel
MaxSelIndex = Ubound(DlgCalModel.lstOwnData.SelectedItems())
If MaxSelIndex > -1 Then
ListIndex = .lstOwnData.SelectedItems(MaxSelIndex)
.txtEvent.Text = CalGetNameofEvent(ListIndex)
.txtOwnEventDay.Value = CalGetDayOfEvent(ListIndex)
iMonth = CalGetMonthOfEvent(ListIndex)
DlgCalendar.GetControl("lstOwnEventMonth").SelectItemPos(iMonth-1, True)
CurOwnMonth = DlgCalModel.lstOwnEventMonth.SelectedItems(0) + 1
If CalGetYearofEvent(ListIndex) <> 0 Then
.txtOwnEventYear.Value = CalGetYearofEvent(ListIndex)
bDoEnable = True
Else
bDoEnable = False
DlgCalModel.txtOwnEventYear.SetPropertyToDefault("Value")
End If
.chkEventOnce.State = Abs(bDoEnable)
.lblEventYear.Enabled = bDoEnable
.txtOwnEventYear.Enabled = bDoEnable
.cmdDelete.Enabled = True
.cmdInsert.Enabled = True
Else
Call CalClearInputMask()
.cmdDelete.Enabled = False
End If
End With
End Sub</script:module>