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 >
Extensible Markup Language  |  2002-02-19  |  5KB  |  154 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
  3. <script:module xmlns:script="http://openoffice.org/2000/script" script:name="DlgControl" script:language="StarBasic">Option Explicit
  4.  
  5. Dim CalBitmap As Object
  6. Public bSelectByMouseMove as Boolean
  7. Public fHeightCorrFactor as Double
  8. Public fWidthCorrFactor as Double
  9.  
  10.  
  11. ' Todo: Adjustmentlistener an der Scrollbar anmelden
  12.  
  13. Sub Main()
  14.     Call CalAutopilotTable()
  15. End Sub
  16.  
  17.  
  18. Sub CalcmdDeleteSelect()
  19. Dim MsgBoxResult as Integer
  20.     If Ubound(DlgCalModel.lstOwnData.SelectedItems()) > -1 Then
  21.         MsgBoxResult = MsgBox(cCalSubcmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubcmdDeleteSelect_DeleteSelEntryTitle$)
  22.         If MsgBoxResult = 6 Then
  23.             DlgCalModel.lstOwnData.StringItemList() = RemoveSelected(DlgCalModel.lstOwnData)
  24.             ' Flag zum Speichern der neuen Daten.
  25.             bCalOwnDataChanged = True
  26.             DlgCalModel.cmdDelete.Enabled = Ubound(DlgCalModel.lstOwnData.StringItemList()) > -1
  27.             Call CalClearInputMask()
  28.         End If
  29.     End If
  30. End Sub
  31.  
  32.  
  33. Sub CalSaveOwnEventControls()
  34.     With DlgCalModel
  35.         .txtOwnEventDay.Tag = .txtOwnEventDay.Value
  36.         .txtOwnEventMonth.Tag = .txtOwnEventMonth.Text
  37.         .DlgCalModel.txtOwnEventYear.Tag = DlgCalModel.txtOwnEventYear.Value
  38.     End With
  39. End Sub
  40.  
  41.  
  42. Sub ToggleYearBox()
  43. ' Falls der RadioButton f├╝r einen Jahreskalender angeklickt
  44. ' worden ist, m├╝ssen die Controls f├╝r den Monat Disabled
  45. ' werden, da ihre Werte in einer Jahrestabelle aufgehen.
  46.     With DlgCalModel
  47.         .txtOwnEventYear.Enabled  = .chkEventOnce.State = 1
  48.         .lblEventYear.Enabled  = .chkEventOnce.State = 1
  49.         If .txtOwnEventYear.Value = 0 And .lblEventYear.Enabled Then
  50.             .txtOwnEventYear.Value = Year(Now)
  51.         End If
  52.     End With
  53. End Sub
  54.  
  55.  
  56. Sub CalMouseMoved(aEvent as object)
  57. Dim ListIndex as Integer
  58.     Select Case sCurLangLocale
  59.         Case  cLANGUAGE_GERMAN
  60.             If bSelectByMouseMove Then
  61. '                oStatusLine.SetText("Position: " & aEvent.X & " ; " & aEvent.Y)
  62.                 ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor), Land$)
  63.                 DlgCalendar.GetControl("lstHolidays").SelectItemPos(ListIndex, True)
  64.             End If
  65.     End Select    
  66. End Sub
  67.  
  68.  
  69. Sub SelectState(aEvent as Object)
  70. Dim ListIndex as Integer
  71.     If aEvent.ClickCount >= 1 Then
  72.         ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor), Land$)
  73.         DlgCalendar.GetControl("lstHolidays").SelectItemPos(ListIndex, True)
  74.         bSelectByMouseMove = False
  75.     End If
  76. End Sub
  77.  
  78.  
  79. Sub MouseLeavesImage
  80.     bSelectbyMouseMove = True
  81. End Sub
  82.  
  83.  
  84. Sub CalClearInputMask()
  85. Dim NullList() as String
  86. '  L├╢scht die Werte der Eingabe Controls f├╝r ein neues Ereignis.
  87.     With DlgCalModel
  88.         .chkEventOnce.State = 0
  89.         .lblEventYear.Enabled = False
  90.         .txtOwnEventYear.Enabled = False
  91.         .txtOwnEventYear.SetPropertyToDefault("Value")
  92.         .txtEvent.Text = ""
  93.         .txtOwnEventDay.SetPropertyToDefault("Value")
  94.         .cmdInsert.Enabled = False
  95.     End With
  96.     DlgCalendar.GetControl("lstOwnEventMonth").SelectItemPos(0,True)
  97.     CurOwnMonth = 1
  98. End Sub
  99.  
  100.  
  101. Sub CalmdSwitchOwnDataOrGeneral()
  102.     '├ändert den Titel der Dialogbox beim Seitenwechsel und die 
  103.     'Beschriftungen der Kn├╢pfe
  104.     If DlgCalModel.Step = 1 Then
  105.         DlgCalModel.Step = 2
  106.         DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_Back$
  107.         DlgCalModel.cmdInsert.Enabled = DlgCalModel.txtEvent.Text <> ""
  108.         ToggleYearBox()
  109.     Else
  110.         DlgCalModel.Step = 1
  111.         DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
  112.     End If
  113. End Sub
  114.  
  115.  
  116. Sub ToggleInsertButton()
  117.     DlgCalModel.cmdInsert.Enabled = LTrim(DlgCalModel.txtEvent.Text) <> ""    
  118. End Sub
  119.  
  120.  
  121. Sub CalUpdateNewEventFrame()
  122. Dim bDoEnable as Boolean
  123. Dim sSelectedItem
  124. Dim ListIndex as Integer
  125. Dim MaxSelIndex as Integer
  126. Dim iMonth as Integer
  127.     bDoEnable = False
  128.     With DlgCalModel
  129.         MaxSelIndex = Ubound(DlgCalModel.lstOwnData.SelectedItems())
  130.         If MaxSelIndex > -1 Then
  131.             ListIndex = .lstOwnData.SelectedItems(MaxSelIndex)
  132.             .txtEvent.Text = CalGetNameofEvent(ListIndex)
  133.             .txtOwnEventDay.Value = CalGetDayOfEvent(ListIndex)
  134.             iMonth = CalGetMonthOfEvent(ListIndex)
  135.             DlgCalendar.GetControl("lstOwnEventMonth").SelectItemPos(iMonth-1, True)
  136.             CurOwnMonth = DlgCalModel.lstOwnEventMonth.SelectedItems(0) + 1
  137.             If CalGetYearofEvent(ListIndex) <> 0 Then
  138.                 .txtOwnEventYear.Value = CalGetYearofEvent(ListIndex)
  139.                 bDoEnable = True
  140.             Else
  141.                 bDoEnable = False
  142.                 DlgCalModel.txtOwnEventYear.SetPropertyToDefault("Value")
  143.             End If
  144.             .chkEventOnce.State = Abs(bDoEnable)
  145.             .lblEventYear.Enabled = bDoEnable
  146.             .txtOwnEventYear.Enabled = bDoEnable
  147.             .cmdDelete.Enabled = True
  148.             .cmdInsert.Enabled = True
  149.         Else
  150.             Call CalClearInputMask()
  151.             .cmdDelete.Enabled = False
  152.         End If
  153.     End With
  154. End Sub</script:module>