- Timestamp:
- Jul 21, 2008, 1:26:05 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/MakeControlEventHandler.ab
r551 r559 17 17 End Function 18 18 19 Sub OutputEventHandlerCode(out As TextWriter, eventName As String, argBase As String, comment As String )19 Sub OutputEventHandlerCode(out As TextWriter, eventName As String, argBase As String, comment As String, isStatic As Boolean) 20 20 Dim eventMember = EventNameToMemberVariableName(eventName) 21 21 Dim handlerType = argBase & "Handler" 22 22 Dim argsType = argBase & "Args" 23 Dim staticKeyword = Nothing As String 24 If isStatic Then staticKeyword = "Static " 23 25 out.WriteLine("Public") 24 26 ' out.WriteLine(Ex"\t/*!") 25 27 ' out.WriteLine(Ex"\t@brief " & eventName & "イベントハンドラを追加する") 26 28 ' out.WriteLine(Ex"\t*/") 27 out.WriteLine(Ex"\t Sub Add" & eventName & "(h As " & handlerType & ")")29 out.WriteLine(Ex"\t" & staticKeyword & "Sub Add" & eventName & "(h As " & handlerType & ")") 28 30 out.WriteLine(Ex"\t\tIf IsNothing(" & eventMember & ") Then") 29 31 out.WriteLine(Ex"\t\t\t" & eventMember & " = h") … … 35 37 ' out.WriteLine(Ex"\t@brief " & eventName & "イベントハンドラを削除する") 36 38 ' out.WriteLine(Ex"\t*/") 37 out.WriteLine(Ex"\t Sub Remove" & eventName & "(h As " & handlerType & ")")39 out.WriteLine(Ex"\t" & staticKeyword & "Sub Remove" & eventName & "(h As " & handlerType & ")") 38 40 out.WriteLine(Ex"\t\tIf Not IsNothing(" & eventMember & ") Then") 39 41 out.WriteLine(Ex"\t\t\t" & eventMember & " -= h") … … 44 46 ' out.WriteLine(Ex"\t@brief " & comment) 45 47 ' out.WriteLine(Ex"\t*/") 46 out.WriteLine(Ex"\t Sub On" & eventName & "(e As " & argsType & ")")48 out.WriteLine(Ex"\t" & staticKeyword & "Sub On" & eventName & "(e As " & argsType & ")") 47 49 out.WriteLine(Ex"\t\tIf Not IsNothing(" & eventMember & ") Then") 48 50 out.WriteLine(Ex"\t\t\t" & eventMember & "(This, e)") … … 50 52 out.WriteLine(Ex"\tEnd Sub") 51 53 out.WriteLine("Private") 52 out.WriteLine(Ex"\t" & eventMember & " As " & handlerType)54 out.WriteLine(Ex"\t" & staticKeyword & eventMember & " As " & handlerType) 53 55 out.WriteLine() 54 56 End Sub … … 57 59 ' "ウィンドウの描画が必要なときに呼び出されます。") 58 60 59 Sub MakeControlEvent(t As String )61 Sub MakeControlEvent(t As String, isStatic = False As Boolean) 60 62 Dim event As String, handler As String, comment As String 61 63 Dim n As DWord, i As DWord … … 70 72 Dim a = ActiveBasic.Strings.Detail.Split(s, 9) 'Tab 71 73 If a.Count >= 3 Then 72 OutputEventHandlerCode(out, a[0], a[1], a[2] )74 OutputEventHandlerCode(out, a[0], a[1], a[2], isStatic) 73 75 End If 74 76 Loop … … 79 81 MakeControlEvent("Control") 80 82 MakeControlEvent("Form") 81 MakeControlEvent("Application" )83 MakeControlEvent("Application", True) 82 84 End
Note:
See TracChangeset
for help on using the changeset viewer.