Last change
on this file since 673 was 637, checked in by イグトランス (egtra), 17 years ago |
Button.OnClickの仕組みを汎用的(WM_COMMAND全般)に。WndProcなどをProtectedへ。
|
File size:
1.3 KB
|
Line | |
---|
1 | 'Classes/ActiveBasic/Windows/UI/Form.ab
|
---|
2 |
|
---|
3 | #require <Classes/ActiveBasic/Windows/UI/Control.ab>
|
---|
4 | #require <Classes/ActiveBasic/Windows/UI/Button.ab>
|
---|
5 |
|
---|
6 | Namespace ActiveBasic
|
---|
7 | Namespace Windows
|
---|
8 | Namespace UI
|
---|
9 |
|
---|
10 | /*!
|
---|
11 | @date 2008/07/13
|
---|
12 | @brief トップレベルウィンドウを表すクラス。
|
---|
13 | @author Egtra
|
---|
14 | */
|
---|
15 |
|
---|
16 | Class Form
|
---|
17 | Inherits Control
|
---|
18 | Public
|
---|
19 | Sub Form()
|
---|
20 | AddMessageEvent(WM_COMMAND, AddressOf(OnCommand))
|
---|
21 | AddPaintBackground(AddressOf(OnPaintBackground))
|
---|
22 | End Sub
|
---|
23 |
|
---|
24 | Protected
|
---|
25 | Override Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
|
---|
26 | With cs
|
---|
27 | .style = WS_OVERLAPPEDWINDOW
|
---|
28 | .x = CW_USEDEFAULT
|
---|
29 | .y = CW_USEDEFAULT
|
---|
30 | .cx = CW_USEDEFAULT
|
---|
31 | .cy = CW_USEDEFAULT
|
---|
32 | End With
|
---|
33 | End Sub
|
---|
34 |
|
---|
35 | Sub OnPaintBackground(sender As Object, e As PaintBackgroundArgs)
|
---|
36 | Dim rc = ClientRect
|
---|
37 | FillRect(e.Handle, rc, (COLOR_3DFACE + 1) As HBRUSH)
|
---|
38 | End Sub
|
---|
39 |
|
---|
40 | Sub OnCommand(sender As Object, e As MessageArgs)
|
---|
41 | ' Dim id = e.WParam And &hffff 'LOWORD(e.WParam)
|
---|
42 | Dim cmd = ((e.WParam >> 16) And &hffff) As Word 'HIWORD(e.WParam)
|
---|
43 | Dim hwnd = e.LParam As HWND
|
---|
44 | If hwnd <> 0 Then
|
---|
45 | Dim c = Control.FromHWnd(hwnd) As WmCommandControl
|
---|
46 | If IsNothing(c) = False Then
|
---|
47 | c.RaiseCommandEvent(cmd)
|
---|
48 | End If
|
---|
49 | End If
|
---|
50 | End Sub
|
---|
51 |
|
---|
52 | #include "FormEvent.sbp"
|
---|
53 | End Class
|
---|
54 |
|
---|
55 | End Namespace 'UI
|
---|
56 | End Namespace 'Widnows
|
---|
57 | End Namespace 'ActiveBasic
|
---|
Note:
See
TracBrowser
for help on using the repository browser.