Last change
on this file since 642 was 637, checked in by イグトランス (egtra), 16 years ago |
Button.OnClickの仕組みを汎用的(WM_COMMAND全般)に。WndProcなどをProtectedへ。
|
File size:
1.3 KB
|
Rev | Line | |
---|
[547] | 1 | 'Classes/ActiveBasic/Windows/UI/Form.ab
|
---|
| 2 |
|
---|
| 3 | #require <Classes/ActiveBasic/Windows/UI/Control.ab>
|
---|
[551] | 4 | #require <Classes/ActiveBasic/Windows/UI/Button.ab>
|
---|
[547] | 5 |
|
---|
| 6 | Namespace ActiveBasic
|
---|
| 7 | Namespace Windows
|
---|
| 8 | Namespace UI
|
---|
| 9 |
|
---|
| 10 | /*!
|
---|
| 11 | @date 2008/07/13
|
---|
| 12 | @brief トップレベルウィンドウを表すクラス。
|
---|
| 13 | @author Egtra
|
---|
| 14 | */
|
---|
[551] | 15 |
|
---|
[547] | 16 | Class Form
|
---|
| 17 | Inherits Control
|
---|
[551] | 18 | Public
|
---|
| 19 | Sub Form()
|
---|
[615] | 20 | AddMessageEvent(WM_COMMAND, AddressOf(OnCommand))
|
---|
| 21 | AddPaintBackground(AddressOf(OnPaintBackground))
|
---|
[551] | 22 | End Sub
|
---|
| 23 |
|
---|
[547] | 24 | Protected
|
---|
| 25 | Override Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
|
---|
[561] | 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
|
---|
[547] | 33 | End Sub
|
---|
[551] | 34 |
|
---|
[615] | 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 |
|
---|
[551] | 40 | Sub OnCommand(sender As Object, e As MessageArgs)
|
---|
[637] | 41 | ' Dim id = e.WParam And &hffff 'LOWORD(e.WParam)
|
---|
| 42 | Dim cmd = ((e.WParam >> 16) And &hffff) As Word 'HIWORD(e.WParam)
|
---|
[551] | 43 | Dim hwnd = e.LParam As HWND
|
---|
[637] | 44 | If hwnd <> 0 Then
|
---|
| 45 | Dim c = Control.FromHWnd(hwnd) As WmCommandControl
|
---|
[551] | 46 | If IsNothing(c) = False Then
|
---|
[637] | 47 | c.RaiseCommandEvent(cmd)
|
---|
[551] | 48 | End If
|
---|
| 49 | End If
|
---|
| 50 | End Sub
|
---|
| 51 |
|
---|
[547] | 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.