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