1 /******************************************************************************
2 *
3 * Copyright (C) 2004-2007, The Gentee Group. All rights reserved.
4 * This file is part of the Gentee open source project - http://www.gentee.com.
5 *
6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
8 * ACCEPTANCE OF THE AGREEMENT.
9 *
10 * ID: vis.datetimepicker 17.07.07 0.0.A.
11 *
12 * Author: Alexander Krivonogov ( gentee )
13 *
14 ******************************************************************************/
15
16 /* Компонента vDateTimePicker, порождена от vCtrl
17 События
18 onChange - изменение текста
19 */
20 type vDateTimePicker <inherit = vCtrl>
21 {
22 //Hidden fields
23 /* uint fNewText
24 uint pBorder
25 uint pChanged
26 uint pReadOnly
27 ustr pText
28 uint pPassword
29 uint pMaxLen
30 uint pMultiline
31 uint pWordWrap
32 uint pScrollBars*/
33
34 //Events
35 evEvent OnChange
36 }
37
38
39 define <export>{
40 //Режим отображения полос прокрутки ScrollBars
41 /*sbNone = 0
42 sbHorz = 1
43 sbVert = 2
44 sbBoth = 3*/
45 }
46
47 /*------------------------------------------------------------------------------
48 Public methods
49 */
50
51
52 /*------------------------------------------------------------------------------
53 Properties
54 */
55 /* Свойство uint ReadOnly - Get Set
56 Усотанавливает или определяет можно ли изменять текст
57 1 - текст изменять нельзя
58 0 - текст изменять можно
59 */
60 /*property uint vDateTimePicker.ReadOnly
61 {
62 return this.pReadOnly
63 }
64
65 property vDateTimePicker.ReadOnly( uint val )
66 {
67 if val != this.pReadOnly
68 {
69 this.pReadOnly = val
70 this.WinMsg( $EM_SETREADONLY, val )
71 }
72 }*/
73
74 /*Свойство ustr Border - Get Set
75 Установить, получить наличие рамки у поля ввода
76 1 - рамка есть
77 0 - рамки нет
78 */
79 property vDateTimePicker.Border( uint val )
80 {
81 /* .pBorder = val
82 uint style = GetWindowLong( this.hwnd, $GWL_EXSTYLE )
83 if val : style |= $WS_EX_CLIENTEDGE
84 else : style &= ~$WS_EX_CLIENTEDGE
85 SetWindowLong( this.hwnd, $GWL_EXSTYLE, style )
86 SetWindowPos( this.hwnd, 0, 0, 0, 0, 0, $SWP_FRAMECHANGED |
87 $SWP_NOACTIVATE | $SWP_NOZORDER | $SWP_NOMOVE | $SWP_NOSIZE )*/
88 }
89
90 property uint vDateTimePicker.Border
91 {
92 return .pBorder
93 }
94
95
96 /*------------------------------------------------------------------------------
97 Virtual methods
98 */
99 method vDateTimePicker vDateTimePicker.mCreateWin <alias=vDateTimePicker_mWin>()
100 {
101 uint exstyle
102 uint style = /*$ES_AUTOHSCROLL |*/ $WS_CHILD | $WS_VISIBLE | $WS_CLIPSIBLINGS
103 /*if .pBorder : exstyle |= $WS_EX_CLIENTEDGE
104 if .pReadOnly : style |= $ES_READONLY
105 if .pPassword : style |= $ES_PASSWORD
106 if .pMultiline
107 {
108 style |= $ES_WANTRETURN | $ES_MULTILINE | $ES_AUTOVSCROLL
109 if !.pWordWrap : style |= $ES_AUTOHSCROLL
110 }
111 else : style |= $ES_AUTOHSCROLL
112 if .pScrollBars & $sbHorz : style |= $WS_HSCROLL
113 if .pScrollBars & $sbVert : style |= $WS_VSCROLL
114 */
115 .CreateWin( "DATETIMEPICK".ustr(), exstyle, style )
116 this->vCtrl.mCreateWin()
117 return this
118 }
119 /*
120 method uint vDateTimePicker.mWinCmd <alias=vDateTimePicker_mWinCmd>( uint ntfcmd, uint id )
121 {
122 if ntfcmd == $EN_CHANGE
123 {
124 this.pChanged = !this.fNewText
125 .iGetText()
126 this.OnChange.Run( this )
127 }
128 return 0
129 }
130
131 method vDateTimePicker.mFocus <alias=vDateTimePicker_mFocus> ( evparValUint eu )
132 {
133 this->vCtrl.mFocus( eu )
134 if !.pMultiline && eu.val && !( GetKeyState($VK_LBUTTON) & 0x1000 )
135 {
136 this.SelAll()
137 }
138 }
139
140 */
141 /*------------------------------------------------------------------------------
142 Registration
143 */
144 method vDateTimePicker vDateTimePicker.init( )
145 {
146 this.pTypeId = vDateTimePicker
147
148 /* this.pBorder = 1
149 this.pTabStop = 1
150 this.pCanFocus = 1
151 this.loc.width = 100
152 this.loc.height = 25
153 this.pMaxLen = 0x8000*/
154 return this
155 }
156
157 func init_vDateTimePicker <entry>()
158 {
159 regcomp( vDateTimePicker, "vDateTimePicker", vCtrl, $vCtrl_last,
160 %{ %{ $mCreateWin, vDateTimePicker_mWin }/*,
161 %{ $mWinCmd, vDateTimePicker_mWinCmd },
162 %{ $mFocus, vDateTimePicker_mFocus },
163 %{ $mSetName, vDateTimePicker_mSetName }*/
164 },
165 0->collection )
166
167 ifdef $DESIGNING {
168 cm.AddComp( vDateTimePicker, 1, "Windows", "datetimepicker" )
169
170 /* cm.AddProps( vDateTimePicker, %{
171 "TabOrder" , uint , 0,
172 "Text" , ustr , 0,
173 "MaxLen" , uint , 0,
174 "Border" , uint , 1,
175 "Password" , uint , 0,
176 "Multiline", uint , 0,
177 "WordWrap" , uint , 0,
178 "ScrollBars", uint , 0,
179 "ReadOnly", uint, 0
180 })
181
182 cm.AddEvents( vDateTimePicker, %{
183 "OnChange" , "evparEvent"
184 })
185
186 cm.AddPropVals( vDateTimePicker, "ScrollBars", %{
187 "sbNone", $sbNone,
188 "sbHorz", $sbHorz,
189 "sbVert", $sbVert,
190 "sbBoth", $sbBoth
191 })
192 }*/
193 }