Ignore:
Timestamp:
Jul 21, 2008, 1:26:05 AM (16 years ago)
Author:
イグトランス (egtra)
Message:

UI_Sampleの追加。イベントのコメントアウト解除。Form.abからテスト部分を除去。Application.DoEventsを実装。MakeControlEventHandlerを静的メンバのイベント対応へ。WindowsExceptionの追加。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/MakeControlEventHandler.ab

    r551 r559  
    1717End Function
    1818
    19 Sub OutputEventHandlerCode(out As TextWriter, eventName As String, argBase As String, comment As String)
     19Sub OutputEventHandlerCode(out As TextWriter, eventName As String, argBase As String, comment As String, isStatic As Boolean)
    2020    Dim eventMember = EventNameToMemberVariableName(eventName)
    2121    Dim handlerType = argBase & "Handler"
    2222    Dim argsType = argBase & "Args"
     23    Dim staticKeyword = Nothing As String
     24    If isStatic Then staticKeyword = "Static "
    2325    out.WriteLine("Public")
    2426'   out.WriteLine(Ex"\t/*!")
    2527'   out.WriteLine(Ex"\t@brief " & eventName & "イベントハンドラを追加する")
    2628'   out.WriteLine(Ex"\t*/")
    27     out.WriteLine(Ex"\tSub Add" & eventName & "(h As " & handlerType & ")")
     29    out.WriteLine(Ex"\t" & staticKeyword & "Sub Add" & eventName & "(h As " & handlerType & ")")
    2830    out.WriteLine(Ex"\t\tIf IsNothing(" & eventMember & ") Then")
    2931    out.WriteLine(Ex"\t\t\t" & eventMember & " = h")
     
    3537'   out.WriteLine(Ex"\t@brief " & eventName & "イベントハンドラを削除する")
    3638'   out.WriteLine(Ex"\t*/")
    37     out.WriteLine(Ex"\tSub Remove" & eventName & "(h As " & handlerType & ")")
     39    out.WriteLine(Ex"\t" & staticKeyword & "Sub Remove" & eventName & "(h As " & handlerType & ")")
    3840    out.WriteLine(Ex"\t\tIf Not IsNothing(" & eventMember & ") Then")
    3941    out.WriteLine(Ex"\t\t\t" & eventMember & " -= h")
     
    4446'   out.WriteLine(Ex"\t@brief " & comment)
    4547'   out.WriteLine(Ex"\t*/")
    46     out.WriteLine(Ex"\tSub On" & eventName & "(e As " & argsType & ")")
     48    out.WriteLine(Ex"\t" & staticKeyword & "Sub On" & eventName & "(e As " & argsType & ")")
    4749    out.WriteLine(Ex"\t\tIf Not IsNothing(" & eventMember & ") Then")
    4850    out.WriteLine(Ex"\t\t\t" & eventMember & "(This, e)")
     
    5052    out.WriteLine(Ex"\tEnd Sub")
    5153    out.WriteLine("Private")
    52     out.WriteLine(Ex"\t" & eventMember & " As " & handlerType)
     54    out.WriteLine(Ex"\t" & staticKeyword & eventMember & " As " & handlerType)
    5355    out.WriteLine()
    5456End Sub
     
    5759'   "ウィンドウの描画が必要なときに呼び出されます。")
    5860
    59 Sub MakeControlEvent(t As String)
     61Sub MakeControlEvent(t As String, isStatic = False As Boolean)
    6062    Dim event As String, handler As String, comment As String
    6163    Dim n As DWord, i As DWord
     
    7072                Dim a = ActiveBasic.Strings.Detail.Split(s, 9) 'Tab
    7173                If a.Count >= 3 Then
    72                     OutputEventHandlerCode(out, a[0], a[1], a[2])
     74                    OutputEventHandlerCode(out, a[0], a[1], a[2], isStatic)
    7375                End If
    7476            Loop
     
    7981MakeControlEvent("Control")
    8082MakeControlEvent("Form")
    81 MakeControlEvent("Application")
     83MakeControlEvent("Application", True)
    8284End
Note: See TracChangeset for help on using the changeset viewer.