EnglishРусский  

   ..

   addustr.g

   app.g

   btn.g

   btnpic.g

   comp.g

   ctrl.g

   ctrlci.g

   datetimepick.g

   dialogs.g

   dlgbtns.g

   edit.g

   events.g

   fonts.g

   form.g

   gray.g

   grey.g

   header.g

   images.g

   label.g

   labeled.g

   locustr.g

   menu.g

   panel.g

   picture.g

   styles.g

   tab.g

   tabitem.g

   tabpage.g

   timer.g

   toolbar.g

   tray.g

   url.g

   vis.g

   viswin.g

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

source\lib\vis\datetimepick.g
  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.datetimepick 17.07.07 0.0.A.
 11 *
 12 * Author: Alexander Krivonogov ( gentee )
 13 *
 14 ******************************************************************************/
 15 
 16 /* Компонента vDateTimePick, порождена от vCtrl
 17 События
 18    onChange - изменение текста
 19 */
 20 type vDateTimePick <inherit = vCtrl>
 21 {  
 22 //Hidden fields
 23    uint pFormat
 24    uint pShowUpDown
 25    ustr pCustomFormat
 26    datetime pDT
 27 /*   uint fNewText
 28    uint pBorder
 29    uint pChanged
 30    uint pReadOnly 
 31    ustr pText  
 32    uint pPassword
 33    uint pMaxLen
 34    uint pMultiline
 35    uint pWordWrap
 36    uint pScrollBars*/
 37    
 38 //Events
 39    evEvent OnChange
 40 }
 41 
 42 
 43 define <export>{
 44 //Формат выбора даты/времени
 45    dtpShort = 0
 46    dtpLong  = 1
 47    dtpTime  = 2
 48    dtpCustom = 3
 49    /*sbNone = 0 
 50    sbHorz = 1
 51    sbVert = 2
 52    sbBoth = 3*/
 53 }
 54 
 55 /*------------------------------------------------------------------------------
 56    Public methods
 57 */
 58 
 59 
 60 /*------------------------------------------------------------------------------
 61    Properties
 62 */
 63 /* Свойство uint ReadOnly - Get Set
 64 Усотанавливает или определяет можно ли изменять текст
 65 1 - текст изменять нельзя
 66 0 - текст изменять можно
 67 */
 68 /*property uint vDateTimePick.ReadOnly 
 69 {
 70    return this.pReadOnly
 71 }
 72 
 73 property  vDateTimePick.ReadOnly( uint val )
 74 {
 75    if val != this.pReadOnly
 76    {
 77       this.pReadOnly = val
 78       this.WinMsg( $EM_SETREADONLY, val )
 79    }
 80 }*/
 81 
 82 /*Свойство ustr Border - Get Set
 83 Установить, получить наличие рамки у поля ввода
 84 1 - рамка есть
 85 0 - рамки нет
 86 */
 87 property vDateTimePick.Border( uint val )
 88 {
 89 /*   .pBorder = val
 90    uint style = GetWindowLong( this.hwnd, $GWL_EXSTYLE )
 91    if val : style |= $WS_EX_CLIENTEDGE
 92    else : style &= ~$WS_EX_CLIENTEDGE
 93    SetWindowLong( this.hwnd, $GWL_EXSTYLE, style )      
 94    SetWindowPos( this.hwnd, 0, 0, 0, 0, 0, $SWP_FRAMECHANGED | 
 95                   $SWP_NOACTIVATE | $SWP_NOZORDER | $SWP_NOMOVE | $SWP_NOSIZE )*/
 96 }
 97 
 98 property uint vDateTimePick.Border
 99 {   
100    return 0//.pBorder
101 }
102 
103 /*Свойство ustr Format - Get Set
104 Установить, получить формат dtp*
105 */
106 method vDateTimePick.iSetCustomFormat()
107 {
108    .WinMsg( $DTM_SETFORMATW, 0, 
109          ?( .pFormat == $dtpCustom, .pCustomFormat.ptr(), 0 ) ) 
110 }
111 
112 method uint vDateTimePick.iGetFormat()
113 {
114    switch .pFormat 
115    {      
116       case $dtpLong : return $DTS_LONGDATEFORMAT     
117       case $dtpTime : return $DTS_TIMEFORMAT
118    }   
119    return 0
120 } 
121 property vDateTimePick.Format( uint val )
122 {
123    if .pFormat != val
124    {      
125       .SetStyle(.iGetFormat(), 0 )
126       .pFormat = val
127       .SetStyle(.iGetFormat(), 1 )
128       .iSetCustomFormat()
129    }    
130 }
131 
132 property uint vDateTimePick.Format
133 {
134    return .pFormat
135 }
136 
137 /*Свойство ustr Format - Get Set
138 Установить, получить пользовательский формат даты/времени
139 */
140 property vDateTimePick.CustomFormat( ustr val )
141 {
142    if .pCustomFormat != val
143    {  
144       .pCustomFormat = val
145       .iSetCustomFormat()
146       //.SetStyle(.iGetFormat(), 1 )
147    }    
148 }
149 
150 property ustr vDateTimePick.CustomFormat<result>()
151 {   
152    result = .pCustomFormat
153 }
154 
155 /*Свойство ustr ShowUpDown - Get Set
156 Установить, получить формат кнопок управления слева
157 1 - кнопки вверх и вниз
158 0 - кнопка выпадающего списка
159 */
160 property vDateTimePick.ShowUpDown( uint val )
161 {
162    if .pShowUpDown != val
163    {      
164       .pShowUpDown = val
165       .Virtual( $mReCreateWin )
166    }    
167 }
168 
169 property uint vDateTimePick.ShowUpDown
170 {   
171    return .pShowUpDown
172 }
173 
174 /*Свойство ustr ShowUpDown - Get Set
175 Установить, получить формат кнопок управления слева
176 1 - кнопки вверх и вниз
177 0 - кнопка выпадающего списка
178 */
179 property vDateTimePick.DateTime( datetime val )
180 {
181    if .pDT != val
182    {      
183       .pDT = val
184       .WinMsg( $DTM_SETSYSTEMTIME, 0, &.pDT )
185    }    
186 }
187 
188 property datetime vDateTimePick.DateTime<result>
189 {   
190    result = .pDT
191 }
192 
193 
194 /*------------------------------------------------------------------------------
195    Virtual methods
196 */
197 method vDateTimePick vDateTimePick.mCreateWin <alias=vDateTimePick_mCreateWin>()
198 {
199    uint exstyle
200    uint style = /*$ES_AUTOHSCROLL |*/ $WS_CHILD | $WS_CLIPSIBLINGS 
201    style |= .iGetFormat()
202    if .pShowUpDown : style |= $DTS_UPDOWN
203 
204    .CreateWin( "SysDateTimePick32".ustr(), exstyle, style )   
205    this->vCtrl.mCreateWin()
206    .iSetCustomFormat()
207    .WinMsg( $DTM_GETSYSTEMTIME, 0, &.pDT )
208    return this
209 }
210 
211 method uint vDateTimePick.mWinNtf <alias=vDateTimePick_mWinNtf>( winmsg wmsg )
212 {
213    uint nmtv as wmsg.lpar->NMHDR 
214    switch nmtv.code
215    {
216       case $DTN_DATETIMECHANGE
217       {  
218          .WinMsg( $DTM_GETSYSTEMTIME, 0, &.pDT )      
219          this.OnChange.Run( this )   
220       }       
221    }
222    return 0
223 }
224 /*
225 method vDateTimePick.mFocus <alias=vDateTimePick_mFocus> ( evparValUint eu )
226 {
227    this->vCtrl.mFocus( eu )
228    if !.pMultiline && eu.val && !( GetKeyState($VK_LBUTTON) & 0x1000 )
229    {      
230       this.SelAll()
231    }   
232 }
233 
234 */
235 /*------------------------------------------------------------------------------
236    Registration
237 */
238 method vDateTimePick vDateTimePick.init( )
239 {  
240    this.pTypeId = vDateTimePick
241    
242 /*   this.pBorder = 1*/
243    this.pTabStop = 1
244    this.pCanFocus = 1   
245    /*this.loc.width = 100
246    this.loc.height = 25
247    this.pMaxLen = 0x8000*/       
248    return this 
249 }  
250 
251 func init_vDateTimePick <entry>()
252 {
253    regcomp( vDateTimePick, "vDateTimePick", vCtrl, $vCtrl_last, 
254       %{ %{ $mCreateWin,    vDateTimePick_mCreateWin },
255          %{ $mWinNtf,       vDateTimePick_mWinNtf }/*
256          %{ $mWinCmd,       vDateTimePick_mWinCmd },
257          %{ $mFocus,        vDateTimePick_mFocus },
258          %{ $mSetName,      vDateTimePick_mSetName }*/
259        },
260       0->collection )   
261       
262 ifdef $DESIGNING {
263    cm.AddComp( vDateTimePick, 1, "Windows", "datetimepick" )
264    
265    cm.AddProps( vDateTimePick, %{ 
266 "TabOrder" , uint , 0,
267 "Format"   , uint , 0,
268 "ShowUpDown", uint, 0,
269 "CustomFormat", ustr, 0
270 /*"Text"     , ustr , 0,
271 "MaxLen"   , uint , 0,
272 "Border"   , uint , 1,
273 "Password" , uint , 0,
274 "Multiline", uint , 0,
275 "WordWrap" , uint , 0,
276 "ScrollBars", uint , 0,
277 "ReadOnly", uint, 0*/
278    })
279    
280    cm.AddEvents( vDateTimePick, %{
281 "OnChange"      , "evparEvent"
282    })
283    
284    cm.AddPropVals( vDateTimePick, "Format", %{ 
285 "dtpShort", $dtpShort,
286 "dtpLong" , $dtpLong,     
287 "dtpTime" , $dtpTime,
288 "dtpCustom", $dtpCustom
289    })
290 }
291 }