source: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Form.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.3 KB
RevLine 
[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
6Namespace ActiveBasic
7Namespace Windows
8Namespace UI
9
10/*!
11@date 2008/07/13
12@brief トップレベルウィンドウを表すクラス。
13@author Egtra
14*/
[551]15
[547]16Class Form
17 Inherits Control
[551]18Public
19 Sub Form()
[615]20 AddMessageEvent(WM_COMMAND, AddressOf(OnCommand))
21 AddPaintBackground(AddressOf(OnPaintBackground))
[551]22 End Sub
23
[547]24Protected
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"
53End Class
54
55End Namespace 'UI
56End Namespace 'Widnows
57End Namespace 'ActiveBasic
Note: See TracBrowser for help on using the repository browser.