source: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Button.ab@ 637

Last change on this file since 637 was 637, checked in by イグトランス (egtra), 16 years ago

Button.OnClickの仕組みを汎用的(WM_COMMAND全般)に。WndProcなどをProtectedへ。

File size: 1.1 KB
RevLine 
[551]1'Classes/ActiveBasic/Windows/UI/Button.ab
2
3#require <Classes/ActiveBasic/Windows/UI/Control.ab>
4
5Namespace ActiveBasic
6Namespace Windows
7Namespace UI
8
9/*!
10@date 2008/07/13
11@brief ボタンを表すクラス。
12@author Egtra
13*/
14Class Button
[637]15 Inherits WmCommandControl
[551]16Protected
17 Override Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
18 With cs
19 .lpszClass = "BUTTON"
20 .style Or= BS_PUSHBUTTON
21 End With
22 End Sub
23Public
24 Sub RaiseClick()
25 OnClick(Args.Empty)
26 End Sub
27
[637]28 Override Function RaiseCommandEvent(notificationCode As Word) As Boolean
29 Dim lr As LRESULT
30 RaiseCommandEvent = False
31 Select Case notificationCode
32 Case BN_CLICKED
33 RaiseCommandEvent = OnClick(Args.Empty)
34 Case BN_DBLCLK
35 RaiseCommandEvent = OnDoubleClick(Args.Empty)
36 Case BN_SETFOCUS
37 RaiseCommandEvent = ProcessMessage(WM_SETFOCUS, 0, 0, lr)
38 Case BN_KILLFOCUS
39 RaiseCommandEvent = ProcessMessage(WM_KILLFOCUS, 0, 0, lr)
40 'ここに挙げられなかったBNメッセージは、16ビットWindowsとの互換性のためとされているもの。
41 End Select
42 End Function
43
[551]44End Class
45
46End Namespace 'UI
47End Namespace 'Widnows
48End Namespace 'ActiveBasic
Note: See TracBrowser for help on using the repository browser.