home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2003 March
/
PCWorld_2003-03_cd.bin
/
Software
/
Vyzkuste
/
openoffice
/
f_0032
/
DlgControl.xba
< prev
next >
Wrap
Extensible Markup Language
|
2002-02-19
|
5KB
|
154 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
Public fHeightCorrFactor as Double
Public fWidthCorrFactor as Double
' 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 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
' oStatusLine.SetText("Position: " & aEvent.X & " ; " & aEvent.Y)
ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor), 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(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor), Land$)
DlgCalendar.GetControl("lstHolidays").SelectItemPos(ListIndex, True)
bSelectByMouseMove = False
End If
End Sub
Sub MouseLeavesImage
bSelectbyMouseMove = True
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
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>