home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD150542162001.psc / CustomizedTextBox.ctl (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-02-16  |  59.0 KB  |  1,113 lines

  1. VERSION 5.00
  2. Begin VB.UserControl CustomizedTextBox 
  3.    BackStyle       =   0  'Transparent
  4.    ClientHeight    =   90
  5.    ClientLeft      =   0
  6.    ClientTop       =   0
  7.    ClientWidth     =   90
  8.    ScaleHeight     =   90
  9.    ScaleWidth      =   90
  10.    ToolboxBitmap   =   "CustomizedTextBox.ctx":0000
  11.    Begin VB.TextBox txtTextBox 
  12.       Height          =   225
  13.       Left            =   0
  14.       TabIndex        =   0
  15.       Top             =   0
  16.       Width           =   75
  17.    End
  18. Attribute VB_Name = "CustomizedTextBox"
  19. Attribute VB_GlobalNameSpace = False
  20. Attribute VB_Creatable = True
  21. Attribute VB_PredeclaredId = False
  22. Attribute VB_Exposed = True
  23. ' DISCLAIMER (for public posting):
  24. ' This software is provided on an "as is, where is" basis, with no warranty whatsoever.
  25. ' As a condition of your using this software, you agree that Westinghouse Electric Company
  26. ' shall not be liable with respect to or as a result of such use.  Further, you agree to
  27. ' indemnify and hold Westinghouse harmless in the event a claim is made against
  28. ' Westinghouse with respect to or as a result of your use of the software.
  29. ' Control: CustomizedTextBox
  30. ' Purpose: To provide an enhanced textbox control
  31. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  32. ' Date: October 17, 2000 (Last Updated: 01/22/01)
  33. Option Explicit
  34. ' ******************************************************************************************************************
  35. ' DECLARATION OF PRIVATE CONTROL CONSTANTS
  36. ' ******************************************************************************************************************
  37. Private Const KEY_BACKSPACE = 8
  38. Private Const KEY_COPY As Integer = 3
  39. Private Const KEY_CUT As Integer = 24
  40. Private Const KEY_ENTER As Integer = 13
  41. Private Const KEY_ESCAPE As Integer = 27
  42. Private Const KEY_PASTE As Integer = 22
  43. Private Const KEY_UNDO As Integer = 26
  44. ' ******************************************************************************************************************
  45. ' DECLARATION OF USER DEFINED TYPES
  46. ' ******************************************************************************************************************
  47. ' Used for the "Alignment" property
  48. Enum udtAlignment
  49.     Left_Justify = 0
  50.     Right_Justify = 1
  51.     Center = 2
  52. End Enum
  53. ' Used for the "Appearance" property
  54. Enum udtAppearance
  55.     Appear_Flat = 0
  56.     Appear_3D = 1
  57. End Enum
  58. ' Used for the "BorderStyle" property
  59. Enum udtBorderStyle
  60.     None = 0
  61.     Fixed_Single = 1
  62. End Enum
  63. ' Used for the "LinkMode" property
  64. Enum udtLinkMode
  65.     None = 0
  66.     Automatic = 1
  67.     Manual = 2
  68.     Notify = 3
  69. End Enum
  70. ' Used for the "MousePointer" property
  71. Enum udtMousePointer
  72.     Default = 0
  73.     Arrow = 1
  74.     Cross = 2
  75.     I_Beam = 3
  76.     Icon = 4
  77.     Size = 5
  78.     Size_NE_SW = 6
  79.     Size_N_S = 7
  80.     Size_NW_SE = 8
  81.     Size_W_E = 9
  82.     Up_Arrow = 10
  83.     Hourglass = 11
  84.     No_Drop = 12
  85.     Arrow_And_Hourglass = 13
  86.     Arrow_And_Question = 14
  87.     Size_All = 15
  88.     Custom = 99
  89. End Enum
  90. ' Used for "OLEDragMode" property
  91. Enum udtOLEDragMode
  92.     Manual = 0
  93.     Automatic = 1
  94. End Enum
  95. ' Used for "OLEDropMode" property
  96. Enum udtOLEDropMode
  97.     None = 0
  98.     Manual = 1
  99.     Automatic = 2
  100. End Enum
  101. ' Used for "TextType" Property
  102. Enum udtTextType
  103.     AlphaNumeric = 0
  104.     AlphaNumeric_NoSymbols = 1
  105.     Alpha_WithSymbols = 2
  106.     Alpha_NoSymbols = 3
  107.     Numeric_Integers_Pos = 4
  108.     Numeric_Integers_Neg = 5
  109.     Numeric_Integers_All = 6
  110.     Numeric_Real_Pos = 7
  111.     Numeric_Real_Neg = 8
  112.     Numeric_Real_All = 9
  113.     Numeric_WithSymbols = 10
  114. End Enum
  115. ' ******************************************************************************************************************
  116. ' DECLARATION OF PRIVATE CONTROL PROPERTY HOLDERS & OBJECTS
  117. ' ******************************************************************************************************************
  118. Private mBackColor_OnGotFocus As OLE_COLOR
  119.     ' The color that the textbox changes to when it receives the focus
  120. Private mBackColor_Normal As OLE_COLOR
  121.     ' The color that the textbox has to when it doesn't have the focus
  122. Private mstrDefaultText As String
  123.     ' The default text for the textbox
  124. Private mstrUndoText As String
  125.     ' The textbox "undo" text
  126. Private mlngEntryStartTime As Long
  127.     ' Holds the tick count at the start of text entry
  128. Private mlngMaxEntryTime As Long
  129.     ' The maximum amount of time allowed once an entry begins (if expires, the "EntryTimedOut" event fires)
  130. Private mintTextType As Integer
  131.     ' The type of text that is allowed in the textbox (numeric, non-numeric, etc.)
  132. Private mblnAutoSelect As Boolean
  133.     ' Flag - Should the textbox text be automatically selected when the textbox receives the focus?
  134. Private mblnAutoUpperCase As Boolean
  135.     ' Flag - Should the textbox text be automatically converted to uppercase as text is entered?
  136. Private mblnEntryTimedOut As Boolean
  137.     ' Flag - Did the current text entry time out?
  138. Private mblnEntryTimerEnabled As Boolean
  139.     ' Flag - Should the entry timer be used?
  140. Private mblnMouseDown As Boolean
  141.     ' Flag - Is the mouse button currently clicked down?
  142. Private mblnSelectWhenClicked  As Boolean
  143.     ' Flag - Should the textbox text be selected the next time the textbox is clicked?
  144. Private mblnUseDefaultText As Boolean
  145.     ' Flag - Should default text be used when user presses escape twice (after undo)?
  146. ' ******************************************************************************************************************
  147. ' DECLARATION OF PRIVATE CONTROL EVENTS
  148. ' ******************************************************************************************************************
  149. Event Change()
  150. Event Click()
  151. Event DblClick()
  152. Event EntryTimedOut()
  153. Event KeyPress(KeyAscii As Integer)
  154. Event KeyDown(KeyCode As Integer, Shift As Integer)
  155. Event KeyUp(KeyCode As Integer, Shift As Integer)
  156. Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  157. Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  158. Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  159. Event OLECompleteDrag(Effect As Long)
  160. Event OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
  161. Event OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
  162. Event OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)
  163. Event OLESetData(Data As DataObject, DataFormat As Integer)
  164. Event OLEStartDrag(Data As DataObject, AllowedEffects As Long)
  165. ' ******************************************************************************************************************
  166. ' IMPLEMENTATION OF CLASS PROPERTY GET / LET STATEMENTS
  167. ' ******************************************************************************************************************
  168. ' ******************************************************************************************************************
  169. ' Property: CustomizedTextBox.Alignment
  170. ' Access: Read / write
  171. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  172. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  173. ' ******************************************************************************************************************
  174. Public Property Get Alignment() As udtAlignment
  175. Attribute Alignment.VB_Description = "Returns/sets the text alignmnent"
  176.     Alignment = txtTextBox.Alignment
  177. End Property
  178. Public Property Let Alignment(ByVal udtValue As udtAlignment)
  179.     txtTextBox.Alignment = udtValue
  180.     PropertyChanged "Alignment"
  181. End Property
  182. ' ******************************************************************************************************************
  183. ' Property: CustomizedTextBox.Appearance
  184. ' Access: Read / write
  185. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  186. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  187. ' ******************************************************************************************************************
  188. Public Property Get Appearance() As udtAppearance
  189.     Appearance = txtTextBox.Appearance
  190. End Property
  191. Public Property Let Appearance(ByVal udtValue As udtAppearance)
  192.     txtTextBox.Appearance = udtValue
  193.     PropertyChanged "Appearance"
  194. End Property
  195. ' ******************************************************************************************************************
  196. ' Property: CustomizedTextBox.AutoUpperCase
  197. ' Access: Read / write
  198. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  199. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  200. ' ******************************************************************************************************************
  201. Public Property Get AutoUpperCase() As Boolean
  202.     AutoUpperCase = mblnAutoUpperCase
  203. End Property
  204. Public Property Let AutoUpperCase(ByVal blnValue As Boolean)
  205.     mblnAutoUpperCase = blnValue
  206.     PropertyChanged "AutoUpperCase"
  207. End Property
  208. ' ******************************************************************************************************************
  209. ' Property: CustomizedTextBox.AutoSelect
  210. ' Access: Read / write
  211. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  212. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  213. ' ******************************************************************************************************************
  214. Public Property Get AutoSelect() As Boolean
  215.     AutoSelect = mblnAutoSelect
  216. End Property
  217. Public Property Let AutoSelect(ByVal blnValue As Boolean)
  218.     mblnAutoSelect = blnValue
  219.     PropertyChanged "AutoSelect"
  220. End Property
  221. ' ******************************************************************************************************************
  222. ' Property: CustomizedTextBox.BackColor_OnGotFocus
  223. ' Access: Read / write
  224. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  225. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  226. ' ******************************************************************************************************************
  227. Public Property Get BackColor_OnGotFocus() As OLE_COLOR
  228. Attribute BackColor_OnGotFocus.VB_Description = "This is the color that the textbox will change to when it receives focus."
  229. Attribute BackColor_OnGotFocus.VB_ProcData.VB_Invoke_Property = ";Appearance"
  230.     BackColor_OnGotFocus = mBackColor_OnGotFocus
  231. End Property
  232. Public Property Let BackColor_OnGotFocus(ByVal oleValue As OLE_COLOR)
  233.     mBackColor_OnGotFocus = oleValue
  234.     PropertyChanged "BackColor_OnGotFocus"
  235. End Property
  236. ' ******************************************************************************************************************
  237. ' Property: CustomizedTextBox.BackColor_Normal
  238. ' Access: Read / write
  239. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  240. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  241. ' ******************************************************************************************************************
  242. Public Property Get BackColor_Normal() As OLE_COLOR
  243. Attribute BackColor_Normal.VB_Description = "This is the color that the textbox will change to when it loses focus."
  244. Attribute BackColor_Normal.VB_ProcData.VB_Invoke_Property = ";Appearance"
  245.     BackColor_Normal = mBackColor_Normal
  246. End Property
  247. Public Property Let BackColor_Normal(ByVal oleValue As OLE_COLOR)
  248.     mBackColor_Normal = oleValue
  249.     PropertyChanged "BackColor_Normal"
  250. End Property
  251. ' ******************************************************************************************************************
  252. ' Property: CustomizedTextBox.BorderStyle
  253. ' Access: Read / write
  254. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  255. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  256. ' ******************************************************************************************************************
  257. Public Property Get BorderStyle() As udtBorderStyle
  258.     BorderStyle = txtTextBox.BorderStyle
  259. End Property
  260. Public Property Let BorderStyle(ByVal udtValue As udtBorderStyle)
  261.     txtTextBox.BorderStyle = udtValue
  262.     PropertyChanged "BorderStyle"
  263. End Property
  264. ' ******************************************************************************************************************
  265. ' Property: CustomizedTextBox.CausesValidation
  266. ' Access: Read / write
  267. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  268. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  269. ' ******************************************************************************************************************
  270. Public Property Get CausesValidation() As Boolean
  271.     CausesValidation = txtTextBox.CausesValidation
  272. End Property
  273. Public Property Let CausesValidation(ByVal blnValue As Boolean)
  274.     txtTextBox.CausesValidation = blnValue
  275.     PropertyChanged "CausesValidation"
  276. End Property
  277. ' ******************************************************************************************************************
  278. ' Property:  CustomizedTextBox.DataField
  279. ' Access: Read / write
  280. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  281. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  282. ' ******************************************************************************************************************
  283. Public Property Get DataField() As String
  284. Attribute DataField.VB_MemberFlags = "103c"
  285.     DataField = txtTextBox.DataField
  286. End Property
  287. Public Property Let DataField(ByVal strValue As String)
  288.     txtTextBox.DataField = strValue
  289.     PropertyChanged "DataField"
  290. End Property
  291. ' ******************************************************************************************************************
  292. ' Property: CustomizedTextBox.DefaultText
  293. ' Access: Read / write
  294. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  295. ' Date: October 17, 2000 (Last Updated: 10/18/00)
  296. ' ******************************************************************************************************************
  297. Public Property Get DefaultText() As String
  298. Attribute DefaultText.VB_ProcData.VB_Invoke_Property = ";Text"
  299.     DefaultText = mstrDefaultText
  300. End Property
  301. Public Property Let DefaultText(ByVal strValue As String)
  302.     mstrDefaultText = strValue
  303.     PropertyChanged "DefaultText"
  304. End Property
  305. ' ******************************************************************************************************************
  306. ' Property: CustomizedTextBox.Enabled
  307. ' Access: Read / write
  308. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  309. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  310. ' ******************************************************************************************************************
  311. Public Property Get Enabled() As Boolean
  312.     Enabled = txtTextBox.Enabled
  313. End Property
  314. Public Property Let Enabled(ByVal blnValue As Boolean)
  315.     txtTextBox.Enabled = blnValue
  316.     PropertyChanged "Enabled"
  317. End Property
  318. ' ******************************************************************************************************************
  319. ' Property: CustomizedTextBox.MaxEntryTime
  320. ' Access: Read / write
  321. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  322. ' Date: January 22, 2001 (Last Updated: 01/22/01)
  323. ' ******************************************************************************************************************
  324. Public Property Get MaxEntryTime() As Long
  325. Attribute MaxEntryTime.VB_Description = "The maximum amount of time (in ms) that can pass once text entry has started before the entry times out."
  326.     MaxEntryTime = mlngMaxEntryTime
  327. End Property
  328. Public Property Let MaxEntryTime(ByVal lngValue As Long)
  329.     mlngMaxEntryTime = lngValue
  330. End Property
  331. ' ******************************************************************************************************************
  332. ' Property: CustomizedTextBox.EntryTimedOut
  333. ' Access: Read only
  334. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  335. ' Date: January 22, 2001 (Last Updated: 01/22/01)
  336. ' ******************************************************************************************************************
  337. Public Property Get EntryTimedOut() As Long
  338.     EntryTimedOut = mblnEntryTimedOut
  339. End Property
  340. ' ******************************************************************************************************************
  341. ' Property: CustomizedTextBox.EntryTimerEnabled
  342. ' Access: Read / write
  343. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  344. ' Date: January 22, 2001 (Last Updated: 01/22/01)
  345. ' ******************************************************************************************************************
  346. Public Property Get EntryTimerEnabled() As Boolean
  347. Attribute EntryTimerEnabled.VB_Description = "Enables/disables the entry timer, which is used to determine whether or not the text entry is scanned."
  348.     EntryTimerEnabled = mblnEntryTimerEnabled
  349. End Property
  350. Public Property Let EntryTimerEnabled(ByVal blnValue As Boolean)
  351.     mblnEntryTimerEnabled = blnValue
  352. End Property
  353. ' ******************************************************************************************************************
  354. ' Property:  CustomizedTextBox.Font
  355. ' Access: Read / write
  356. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  357. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  358. ' ******************************************************************************************************************
  359. Public Property Get Font() As Font
  360. Attribute Font.VB_ProcData.VB_Invoke_Property = ";Font"
  361.    Set Font = txtTextBox.Font
  362. End Property
  363. Public Property Set Font(ByVal fonValue As Font)
  364.    Set txtTextBox.Font = fonValue
  365.    PropertyChanged "Font"
  366. End Property
  367. ' ******************************************************************************************************************
  368. ' Property:  CustomizedTextBox.FontBold
  369. ' Access: Read / write
  370. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  371. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  372. ' ******************************************************************************************************************
  373. Public Property Get FontBold() As Boolean
  374. Attribute FontBold.VB_ProcData.VB_Invoke_Property = ";Font"
  375. Attribute FontBold.VB_MemberFlags = "400"
  376.    FontBold = txtTextBox.FontBold
  377. End Property
  378. Public Property Let FontBold(ByVal blnValue As Boolean)
  379.    txtTextBox.FontBold = blnValue
  380.    PropertyChanged "FontBold"
  381. End Property
  382. ' ******************************************************************************************************************
  383. ' Property:  CustomizedTextBox.FontItalic
  384. ' Access: Read / write
  385. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  386. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  387. ' ******************************************************************************************************************
  388. Public Property Get FontItalic() As Boolean
  389. Attribute FontItalic.VB_ProcData.VB_Invoke_Property = ";Font"
  390. Attribute FontItalic.VB_MemberFlags = "400"
  391.    FontItalic = txtTextBox.FontItalic
  392. End Property
  393. Public Property Let FontItalic(ByVal blnValue As Boolean)
  394.    txtTextBox.FontItalic = blnValue
  395.    PropertyChanged "FontItalic"
  396. End Property
  397. ' ******************************************************************************************************************
  398. ' Property:  CustomizedTextBox.FontName
  399. ' Access: Read / write
  400. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  401. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  402. ' ******************************************************************************************************************
  403. Public Property Get FontName() As String
  404. Attribute FontName.VB_ProcData.VB_Invoke_Property = ";Font"
  405. Attribute FontName.VB_MemberFlags = "400"
  406.    FontName = txtTextBox.FontName
  407. End Property
  408. Public Property Let FontName(ByVal strValue As String)
  409.    txtTextBox.FontName = strValue
  410.    PropertyChanged "FontName"
  411. End Property
  412. ' ******************************************************************************************************************
  413. ' Property:  CustomizedTextBox.FontSize
  414. ' Access: Read / write
  415. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  416. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  417. ' ******************************************************************************************************************
  418. Public Property Get FontSize() As Integer
  419. Attribute FontSize.VB_ProcData.VB_Invoke_Property = ";Font"
  420. Attribute FontSize.VB_MemberFlags = "400"
  421.    FontSize = txtTextBox.FontSize
  422. End Property
  423. Public Property Let FontSize(ByVal intValue As Integer)
  424.    txtTextBox.FontSize = intValue
  425.    PropertyChanged "FontSize"
  426. End Property
  427. ' ******************************************************************************************************************
  428. ' Property:  CustomizedTextBox.FontStrikethru
  429. ' Access: Read / write
  430. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  431. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  432. ' ******************************************************************************************************************
  433. Public Property Get FontStrikethru() As Boolean
  434. Attribute FontStrikethru.VB_ProcData.VB_Invoke_Property = ";Font"
  435. Attribute FontStrikethru.VB_MemberFlags = "400"
  436.    FontStrikethru = txtTextBox.FontStrikethru
  437. End Property
  438. Public Property Let FontStrikethru(ByVal blnValue As Boolean)
  439.    txtTextBox.FontStrikethru = blnValue
  440.    PropertyChanged "FontStrikethru"
  441. End Property
  442. ' ******************************************************************************************************************
  443. ' Property:  CustomizedTextBox.FontUnderline
  444. ' Access: Read / write
  445. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  446. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  447. ' ******************************************************************************************************************
  448. Public Property Get FontUnderline() As Boolean
  449. Attribute FontUnderline.VB_ProcData.VB_Invoke_Property = ";Font"
  450. Attribute FontUnderline.VB_MemberFlags = "400"
  451.    FontUnderline = txtTextBox.FontUnderline
  452. End Property
  453. Public Property Let FontUnderline(ByVal blnValue As Boolean)
  454.    txtTextBox.FontUnderline = blnValue
  455.    PropertyChanged "FontUnderline"
  456. End Property
  457. ' ******************************************************************************************************************
  458. ' Property:  CustomizedTextBox.ForeColor
  459. ' Access: Read / write
  460. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  461. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  462. ' ******************************************************************************************************************
  463. Public Property Get ForeColor() As OLE_COLOR
  464.    ForeColor = txtTextBox.ForeColor
  465. End Property
  466. Public Property Let ForeColor(ByVal oleValue As OLE_COLOR)
  467.    txtTextBox.ForeColor = oleValue
  468.    PropertyChanged "ForeColor"
  469. End Property
  470. ' ******************************************************************************************************************
  471. ' Property:  CustomizedTextBox.HideSelection
  472. ' Access: Read only
  473. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  474. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  475. ' ******************************************************************************************************************
  476. Public Property Get HideSelection() As Boolean
  477.    HideSelection = txtTextBox.HideSelection
  478. End Property
  479. ' ******************************************************************************************************************
  480. ' Property:  CustomizedTextBox.hWnd
  481. ' Access: Read only
  482. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  483. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  484. ' ******************************************************************************************************************
  485. Public Property Get hWnd() As Long
  486.    hWnd = txtTextBox.hWnd
  487. End Property
  488. ' ******************************************************************************************************************
  489. ' Property:  CustomizedTextBox.Index
  490. ' Access: Read only
  491. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  492. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  493. ' ******************************************************************************************************************
  494. Public Property Get Index() As Long
  495.    Index = txtTextBox.Index
  496. End Property
  497. ' ******************************************************************************************************************
  498. ' Property:  CustomizedTextBox.Left
  499. ' Access: Read / write
  500. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  501. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  502. ' ******************************************************************************************************************
  503. Public Property Get Left() As Long
  504.    Left = txtTextBox.Left
  505. End Property
  506. Public Property Let Left(ByVal lngValue As Long)
  507.    txtTextBox.Left = lngValue
  508.    PropertyChanged "Left"
  509. End Property
  510.         
  511. ' ******************************************************************************************************************
  512. ' Property:  CustomizedTextBox.LinkItem
  513. ' Access: Read / write
  514. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  515. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  516. ' ******************************************************************************************************************
  517. Public Property Get LinkItem() As String
  518.    LinkItem = txtTextBox.LinkItem
  519. End Property
  520. Public Property Let LinkItem(ByVal strValue As String)
  521.    txtTextBox.LinkItem = strValue
  522.    PropertyChanged "LinkItem"
  523. End Property
  524. ' ******************************************************************************************************************
  525. ' Property:  CustomizedTextBox.Locked
  526. ' Access: Read / write
  527. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  528. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  529. ' ******************************************************************************************************************
  530. Public Property Get Locked() As Boolean
  531.    Locked = txtTextBox.Locked
  532. End Property
  533. Public Property Let Locked(ByVal blnValue As Boolean)
  534.    txtTextBox.Locked = blnValue
  535.    PropertyChanged "Locked"
  536. End Property
  537. ' ******************************************************************************************************************
  538. ' Property:  CustomizedTextBox.MaxLength
  539. ' Access: Read / write
  540. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  541. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  542. ' ******************************************************************************************************************
  543. Public Property Get MaxLength() As Long
  544.    MaxLength = txtTextBox.MaxLength
  545. End Property
  546. Public Property Let MaxLength(ByVal lngValue As Long)
  547.    txtTextBox.MaxLength = lngValue
  548.    PropertyChanged "MaxLength"
  549. End Property
  550. ' ******************************************************************************************************************
  551. ' Property:  CustomizedTextBox.MousePointer
  552. ' Access: Read / write
  553. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  554. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  555. ' ******************************************************************************************************************
  556. Public Property Get MousePointer() As udtMousePointer
  557.    MousePointer = txtTextBox.MousePointer
  558. End Property
  559. Public Property Let MousePointer(ByVal udtValue As udtMousePointer)
  560.    txtTextBox.MousePointer = udtValue
  561.    PropertyChanged "MousePointer"
  562. End Property
  563.         
  564. ' ******************************************************************************************************************
  565. ' Property:  CustomizedTextBox.MultiLine
  566. ' Access: Read only
  567. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  568. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  569. ' ******************************************************************************************************************
  570. Public Property Get MultiLine() As Boolean
  571.    MultiLine = txtTextBox.MultiLine
  572. End Property
  573. ' ******************************************************************************************************************
  574. ' Property:  CustomizedTextBox.OLEDragMode
  575. ' Access: Read / write
  576. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  577. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  578. ' ******************************************************************************************************************
  579. Public Property Get OLEDragMode() As udtOLEDragMode
  580.    OLEDragMode = txtTextBox.OLEDragMode
  581. End Property
  582. Public Property Let OLEDragMode(ByVal udtValue As udtOLEDragMode)
  583.    txtTextBox.OLEDragMode = udtValue
  584.    PropertyChanged "OLEDragMode"
  585. End Property
  586. ' ******************************************************************************************************************
  587. ' Property:  CustomizedTextBox.OLEDropMode
  588. ' Access: Read / write
  589. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  590. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  591. ' ******************************************************************************************************************
  592. Public Property Get OLEDropMode() As udtOLEDropMode
  593.    OLEDropMode = txtTextBox.OLEDropMode
  594. End Property
  595. Public Property Let OLEDropMode(ByVal udtValue As udtOLEDropMode)
  596.    txtTextBox.OLEDropMode = udtValue
  597.    PropertyChanged "OLEDropMode"
  598. End Property
  599. ' ******************************************************************************************************************
  600. ' Property:  CustomizedTextBox.PasswordChar
  601. ' Access: Read / write
  602. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  603. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  604. ' ******************************************************************************************************************
  605. Public Property Get PasswordChar() As String
  606.    PasswordChar = txtTextBox.PasswordChar
  607. End Property
  608. Public Property Let PasswordChar(ByVal strValue As String)
  609.    txtTextBox.PasswordChar = strValue
  610.    PropertyChanged "PasswordChar"
  611. End Property
  612. ' ******************************************************************************************************************
  613. ' Property:  CustomizedTextBox.RightToLeft
  614. ' Access: Read / write
  615. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  616. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  617. ' ******************************************************************************************************************
  618. Public Property Get RightToLeft() As Boolean
  619.    RightToLeft = txtTextBox.RightToLeft
  620. End Property
  621. Public Property Let RightToLeft(ByVal blnValue As Boolean)
  622.    txtTextBox.RightToLeft = blnValue
  623.    PropertyChanged "RightToLeft"
  624. End Property
  625. ' ******************************************************************************************************************
  626. ' Property: CustomizedTextBox.Text
  627. ' Access: Read / write
  628. ' Note: This property will be used as a "text" property, allowing textbox text to be updated at
  629. '       design time as it is entered (see "Text_AsDefaultProperty" for other half of this "trick")
  630. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  631. ' Date: October 17, 2000 (Last Updated: 10/18/00)
  632. ' ******************************************************************************************************************
  633. Public Property Get Text() As String
  634. Attribute Text.VB_ProcData.VB_Invoke_Property = ";Text"
  635. Attribute Text.VB_UserMemId = -517
  636.     Text = txtTextBox.Text
  637. End Property
  638. Public Property Let Text(ByVal strNewText As String)
  639.     txtTextBox.Text() = strNewText
  640.     PropertyChanged "Text"
  641. End Property
  642. ' ******************************************************************************************************************
  643. ' Property: CustomizedTextBox.Text_AsDefaultProperty
  644. ' Access: Read / write
  645. ' Note: This property will be used as control's default property, and can only be set at runtime;
  646. '       however, it will not be visible to the developer (even though it will receive the text)
  647. '       This trick allows textbox text to be default property as well as a "text" property
  648. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  649. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  650. ' ******************************************************************************************************************
  651. Public Property Get Text_AsDefaultProperty() As String
  652.     Text_AsDefaultProperty = txtTextBox.Text
  653. End Property
  654. Public Property Let Text_AsDefaultProperty(ByVal strNewText As String)
  655. Attribute Text_AsDefaultProperty.VB_ProcData.VB_Invoke_PropertyPut = ";Text"
  656. Attribute Text_AsDefaultProperty.VB_UserMemId = 0
  657. Attribute Text_AsDefaultProperty.VB_MemberFlags = "40"
  658.     txtTextBox.Text() = strNewText
  659.     PropertyChanged "Text_AsDefaultProperty"
  660. End Property
  661. ' ******************************************************************************************************************
  662. ' Property: CustomizedTextBox.TextType
  663. ' Access: Read / write
  664. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  665. ' Date: October 18, 2000 (Last Updated: 10/18/00)
  666. ' ******************************************************************************************************************
  667. Public Property Get TextType() As udtTextType
  668.     TextType = mintTextType
  669. End Property
  670. Public Property Let TextType(ByVal intValue As udtTextType)
  671.     mintTextType = intValue
  672.     PropertyChanged "TextType"
  673. End Property
  674. ' ******************************************************************************************************************
  675. ' Property: CustomizedTextBox.UseDefaultText
  676. ' Access: Read / write
  677. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  678. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  679. ' ******************************************************************************************************************
  680. Public Property Get UseDefaultText() As Boolean
  681.     UseDefaultText = mblnUseDefaultText
  682. End Property
  683. Public Property Let UseDefaultText(ByVal blnValue As Boolean)
  684.     mblnUseDefaultText = blnValue
  685.     PropertyChanged "UseDefaultText"
  686. End Property
  687. ' ******************************************************************************************************************
  688. ' IMPLEMENTATION OF PRIVATE CONTROL EVENTS
  689. ' ******************************************************************************************************************
  690. ' ******************************************************************************************************************
  691. ' Event: CustomizedTextBox.txtTextBox_Change
  692. ' Purpose: Raise associated control event
  693. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  694. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  695. ' *****************************************************************************************************************
  696. Private Sub txtTextBox_Change()
  697.     RaiseEvent Change
  698. End Sub
  699. ' ******************************************************************************************************************
  700. ' Event: CustomizedTextBox.txtTextBox_Click
  701. ' Purpose: Raise associated control event
  702. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  703. ' Date: October 17, 2000 (Last Updated: 01/17/01)
  704. ' *****************************************************************************************************************
  705. Private Sub txtTextBox_Click()
  706.     RaiseEvent Click
  707.     With txtTextBox
  708.         ' If text is supposed to be selected due to textbox being clicked...
  709.         If mblnAutoSelect And mblnSelectWhenClicked Then
  710.             ' Select text
  711.             .SelStart = 0
  712.             .SelLength = Len(.Text)
  713.             
  714.             ' Reset flag (this will be set again when textbox loses focus)
  715.             mblnSelectWhenClicked = False
  716.         End If
  717.     End With
  718. End Sub
  719. ' ******************************************************************************************************************
  720. ' Event: CustomizedTextBox.txtTextBox_DblClick
  721. ' Purpose: Raise associated control event
  722. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  723. ' Date: October 17, 2000 (Last Updated: 11/03/00)
  724. ' *****************************************************************************************************************
  725. Private Sub txtTextBox_DblClick()
  726.     RaiseEvent DblClick
  727. End Sub
  728. ' ******************************************************************************************************************
  729. ' Event: CustomizedTextBox.txtTextBox_GotFocus
  730. ' Purpose: Performs various operations when textbox receives the focus
  731. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  732. ' Date: October 17, 2000 (Last Updated: 01/17/01)
  733. ' ******************************************************************************************************************
  734. Private Sub txtTextBox_GotFocus()
  735.     With txtTextBox
  736.         ' If "auto select" is on...
  737.         If mblnAutoSelect Then
  738.             ' If textbox received focus via tab, select text and reset "select when clicked"
  739.             If GetKeyState(VK_TAB) < 0 Then
  740.                 .SelStart = 0
  741.                 .SelLength = Len(.Text)
  742.                 mblnSelectWhenClicked = False
  743.             ' Otherwise, if textbox received focus via click, set "select when clicked"
  744.             ElseIf mblnMouseDown Then
  745.                 mblnSelectWhenClicked = True
  746.             ' Otherwise (probably form load), select text and reset "select when clicked"
  747.             Else
  748.                 .SelStart = 0
  749.                 .SelLength = Len(.Text)
  750.                 mblnSelectWhenClicked = False
  751.             End If
  752.         End If
  753.         
  754.         ' Get the "undo" text
  755.         mstrUndoText = .Text
  756.         ' Change the color to the "got focus" color
  757.         .BackColor = mBackColor_OnGotFocus
  758.     End With
  759. End Sub
  760. ' ******************************************************************************************************************
  761. ' Event: CustomizedTextBox.txtTextBox_KeyDown
  762. ' Purpose: Raise associated control event
  763. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  764. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  765. ' *****************************************************************************************************************
  766. Private Sub txtTextBox_KeyDown(KeyCode As Integer, Shift As Integer)
  767.     RaiseEvent KeyDown(KeyCode, Shift)
  768. End Sub
  769. ' ******************************************************************************************************************
  770. ' Event: CustomizedTextBox.txtTextBox_KeyPress
  771. ' Purpose: Performs various actions when key is pressed (text entered into textbox)
  772. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  773. ' Date: October 17, 2000 (Last Updated: 01/22/01)
  774. ' ******************************************************************************************************************
  775. Private Sub txtTextBox_KeyPress(KeyAscii As Integer)
  776.     RaiseEvent KeyPress(KeyAscii)
  777.     ' Convert to uppercase
  778.     If mblnAutoUpperCase Then KeyAscii = Asc(UCase(Chr$(KeyAscii)))
  779.     ' If "escape" key pressed, undo changes made since textbox received focus, then exit sub
  780.     If KeyAscii = KEY_ESCAPE Then
  781.         ' Restore text
  782.         txtTextBox.Text = mstrUndoText
  783.         
  784.         ' Select text
  785.         txtTextBox.SelStart = 0
  786.         txtTextBox.SelLength = Len(txtTextBox.Text)
  787.         
  788.         ' If "use default" flag is true, set undo to default so that next time, "escape" will revert to default
  789.         If mblnUseDefaultText Then
  790.             mstrUndoText = mstrDefaultText
  791.         End If
  792.         
  793.         Exit Sub
  794.     ' Otherwise, if some other sort of control key (backspace, enter, etc.) was pressed, exit sub
  795.     ElseIf KeyAscii = KEY_BACKSPACE Or KeyAscii = KEY_ENTER Or KeyAscii = KEY_CUT _
  796.         Or KeyAscii = KEY_COPY Or KeyAscii = KEY_PASTE Or KeyAscii = KEY_UNDO Then
  797.         Exit Sub
  798.     End If
  799.     ' If entry timer is enabled...
  800.     If mblnEntryTimerEnabled Then
  801.         ' If entry timer hasn't been started yet, start it now
  802.         If mlngEntryStartTime = 0 And Not (mblnEntryTimedOut) Then
  803.             mlngEntryStartTime = GetTickCount()
  804.         ' Otherwise (timer started), if timer is still running (not already tripped), check to see if max time has
  805.         ' expired; if it has, trip timer now (timer will not be started and/or checked again until manually reset)
  806.         ElseIf Not (mblnEntryTimedOut) And GetTickCount() - mlngEntryStartTime > mlngMaxEntryTime Then
  807.             mblnEntryTimedOut = True
  808.             RaiseEvent EntryTimedOut
  809.         End If
  810.     End If
  811.     Select Case mintTextType
  812.         ' Allow all ASCII chars
  813.         Case udtTextType.AlphaNumeric
  814.         
  815.         ' Allow alpha and numeric chars, but no symbols
  816.         Case udtTextType.AlphaNumeric_NoSymbols
  817.             If KeyAscii < 48 Or (KeyAscii > 57 And KeyAscii < 65) Or (KeyAscii > 90 And KeyAscii < 97) _
  818.                 Or KeyAscii > 122 Then KeyAscii = 0
  819.                 
  820.         ' Allow alpha chars with symbols
  821.         Case udtTextType.Alpha_WithSymbols
  822.             If KeyAscii >= 48 And KeyAscii <= 57 Then KeyAscii = 0
  823.             
  824.         ' Allow alpha chars with no symbols
  825.         Case udtTextType.Alpha_NoSymbols
  826.             If KeyAscii < 65 Or (KeyAscii > 90 And KeyAscii < 97) Or KeyAscii > 122 Then KeyAscii = 0
  827.         
  828.         ' Allow only positive integers
  829.         Case udtTextType.Numeric_Integers_Pos
  830.             If (KeyAscii < 48 Or KeyAscii > 57) Then KeyAscii = 0
  831.         
  832.         ' Allow only negative integers
  833.         Case udtTextType.Numeric_Integers_Neg
  834.             If ((KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 45) _
  835.                 Or (KeyAscii = 45 And Len(txtTextBox) <> 0 And txtTextBox.SelLength <> Len(txtTextBox)) _
  836.                 Or ((Len(txtTextBox) = 0 Or txtTextBox.SelLength = Len(txtTextBox)) And KeyAscii <> 45) Then KeyAscii = 0
  837.         ' Allow all integers
  838.         Case udtTextType.Numeric_Integers_All
  839.             If ((KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 45) _
  840.                 Or (KeyAscii = 45 And Len(txtTextBox) <> 0 And txtTextBox.SelLength <> Len(txtTextBox)) Then KeyAscii = 0
  841.         ' Allow only positive real numbers
  842.         Case udtTextType.Numeric_Real_Pos
  843.             If ((KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 46) _
  844.                 Or (KeyAscii = 46 And (InStr(1, txtTextBox, Chr$(46)) Or txtTextBox.SelLength = Len(txtTextBox))) Then KeyAscii = 0
  845.         ' Allow only negative real numbers
  846.         Case udtTextType.Numeric_Real_Neg
  847.             If ((KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 45 And KeyAscii <> 46) _
  848.                 Or (KeyAscii = 45 And Len(txtTextBox) <> 0 And txtTextBox.SelLength <> Len(txtTextBox)) _
  849.                 Or ((Len(txtTextBox) = 0 Or txtTextBox.SelLength = Len(txtTextBox)) And KeyAscii <> 45) _
  850.                 Or (KeyAscii = 46 And (InStr(1, txtTextBox, Chr$(46)) Or txtTextBox.SelLength = Len(txtTextBox))) Then KeyAscii = 0
  851.         
  852.         ' Allow all real numbers
  853.         Case udtTextType.Numeric_Real_All
  854.             If ((KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 45 And KeyAscii <> 46) _
  855.                 Or (KeyAscii = 45 And Len(txtTextBox) <> 0 And txtTextBox.SelLength <> Len(txtTextBox)) _
  856.                 Or (KeyAscii = 46 And (InStr(1, txtTextBox, Chr$(46)) Or txtTextBox.SelLength = Len(txtTextBox))) Then KeyAscii = 0
  857.         ' Allow all numbers and symbols (no alpha)
  858.         Case udtTextType.Numeric_WithSymbols
  859.             If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Then KeyAscii = 0
  860.         
  861.         ' Undefined cases
  862.         Case Else
  863.             KeyAscii = 0
  864.     End Select
  865. End Sub
  866. ' ******************************************************************************************************************
  867. ' Event: CustomizedTextBox.txtTextBox_KeyUp
  868. ' Purpose: Raise associated control event
  869. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  870. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  871. ' *****************************************************************************************************************
  872. Private Sub txtTextBox_KeyUp(KeyCode As Integer, Shift As Integer)
  873.     RaiseEvent KeyUp(KeyCode, Shift)
  874. End Sub
  875. ' ******************************************************************************************************************
  876. ' Event: CustomizedTextBox.txtTextBox_LostFocus
  877. ' Purpose: Performs various operations when textbox loses the focus
  878. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  879. ' Date: October 17, 2000 (Last Updated: 01/11/01)
  880. ' ******************************************************************************************************************
  881. Private Sub txtTextBox_LostFocus()
  882.     txtTextBox.BackColor = mBackColor_Normal
  883.     ' Reset flag
  884.     mblnSelectWhenClicked = True
  885. End Sub
  886. ' ******************************************************************************************************************
  887. ' Event: CustomizedTextBox.txtTextBox_MouseDown
  888. ' Purpose: Raise associated control event and set flag
  889. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  890. ' Date: October 17, 2000 (Last Updated: 01/17/01)
  891. ' ******************************************************************************************************************
  892. Private Sub txtTextBox_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  893.     RaiseEvent MouseDown(Button, Shift, X, Y)
  894.     mblnMouseDown = True
  895. End Sub
  896. ' ******************************************************************************************************************
  897. ' Event: CustomizedTextBox.txtTextBox_MouseMove
  898. ' Purpose: Raise associated control event
  899. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  900. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  901. ' ******************************************************************************************************************
  902. Private Sub txtTextBox_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  903.     RaiseEvent MouseMove(Button, Shift, X, Y)
  904. End Sub
  905. ' ******************************************************************************************************************
  906. ' Event: CustomizedTextBox.txtTextBox_MouseUp
  907. ' Purpose: Raise associated control event and reset flag
  908. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  909. ' Date: October 17, 2000 (Last Updated: 01/17/01)
  910. ' ******************************************************************************************************************
  911. Private Sub txtTextBox_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  912.     RaiseEvent MouseUp(Button, Shift, X, Y)
  913.     mblnMouseDown = False
  914. End Sub
  915. ' ******************************************************************************************************************
  916. ' Event: CustomizedTextBox.txtTextBox_OLECompleteDrag
  917. ' Purpose: Raise associated control event
  918. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  919. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  920. ' ******************************************************************************************************************
  921. Private Sub txtTextBox_OLECompleteDrag(Effect As Long)
  922.     RaiseEvent OLECompleteDrag(Effect)
  923. End Sub
  924. ' ******************************************************************************************************************
  925. ' Event: CustomizedTextBox.txtTextBox_OLEDragDrop
  926. ' Purpose: Raise associated control event
  927. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  928. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  929. ' ******************************************************************************************************************
  930. Private Sub txtTextBox_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
  931.     RaiseEvent OLEDragDrop(Data, Effect, Button, Shift, X, Y)
  932. End Sub
  933. ' ******************************************************************************************************************
  934. ' Event: CustomizedTextBox.txtTextBox_OLEDragOver
  935. ' Purpose: Raise associated control event
  936. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  937. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  938. ' ******************************************************************************************************************
  939. Private Sub txtTextBox_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
  940.     RaiseEvent OLEDragOver(Data, Effect, Button, Shift, X, Y, State)
  941. End Sub
  942. ' ******************************************************************************************************************
  943. ' Event: CustomizedTextBox.txtTextBox_OLEGiveFeedback
  944. ' Purpose: Raise associated control event
  945. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  946. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  947. ' ******************************************************************************************************************
  948. Private Sub txtTextBox_OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)
  949.     RaiseEvent OLEGiveFeedback(Effect, DefaultCursors)
  950. End Sub
  951. ' ******************************************************************************************************************
  952. ' Event: CustomizedTextBox.txtTextBox_OLESetData
  953. ' Purpose: Raise associated control event
  954. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  955. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  956. ' ******************************************************************************************************************
  957. Private Sub txtTextBox_OLESetData(Data As DataObject, DataFormat As Integer)
  958.     RaiseEvent OLESetData(Data, DataFormat)
  959. End Sub
  960. ' ******************************************************************************************************************
  961. ' Event: CustomizedTextBox.txtTextBox_OLEStartDrag
  962. ' Purpose: Raise associated control event
  963. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  964. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  965. ' ******************************************************************************************************************
  966. Private Sub txtTextBox_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
  967.     RaiseEvent OLEStartDrag(Data, AllowedEffects)
  968. End Sub
  969. ' ******************************************************************************************************************
  970. ' Event: CustomizedTextBox.UserControl_InitProperties
  971. ' Purpose: Setup of the initial control properties
  972. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  973. ' Date: October 17, 2000 (Last Updated: 01/22/01)
  974. ' ******************************************************************************************************************
  975. Private Sub UserControl_InitProperties()
  976.     ' Set defaults for custom properties
  977.     mblnAutoSelect = True
  978.     mblnAutoUpperCase = False
  979.     mBackColor_OnGotFocus = vbCyan
  980.     mBackColor_Normal = vbWhite
  981.     mstrDefaultText = ""
  982.     mblnUseDefaultText = True
  983.     mlngMaxEntryTime = 400
  984. End Sub
  985. ' ******************************************************************************************************************
  986. ' Event: CustomizedTextBox.UserControl_ReadProperties
  987. ' Purpose: Reads the control properties from the "property bag" (remembers properties)
  988. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  989. ' Date: October 17, 2000 (Last Updated: 01/22/01)
  990. ' ******************************************************************************************************************
  991. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  992.     ' Customized properties
  993.     mblnAutoSelect = PropBag.ReadProperty("AutoSelect", True)
  994.     mblnAutoUpperCase = PropBag.ReadProperty("AutoUpperCase", False)
  995.     mBackColor_OnGotFocus = PropBag.ReadProperty("BackColor_OnGotFocus", vbCyan)
  996.     mBackColor_Normal = PropBag.ReadProperty("BackColor_OnlostFocus", vbWhite)
  997.     mstrDefaultText = PropBag.ReadProperty("DefaultText", "")
  998.     mlngMaxEntryTime = PropBag.ReadProperty("MaxEntryTime", 400)
  999.     mblnEntryTimerEnabled = PropBag.ReadProperty("EntryTimerEnabled", False)
  1000.     mblnUseDefaultText = PropBag.ReadProperty("UseDefaultText", True)
  1001.     mintTextType = PropBag.ReadProperty("TextType", udtTextType.AlphaNumeric)
  1002.     ' Standard "textbox" properties
  1003.     With txtTextBox
  1004.         .Alignment = PropBag.ReadProperty("Alignment", udtAlignment.Left_Justify)
  1005.         .Appearance = PropBag.ReadProperty("Appearance", udtAppearance.Appear_3D)
  1006.         .BorderStyle = PropBag.ReadProperty("BorderStyle", udtBorderStyle.Fixed_Single)
  1007.         .CausesValidation = PropBag.ReadProperty("CausesValidation", True)
  1008.         .DataField = PropBag.ReadProperty("DataField", "")
  1009.         .Enabled = PropBag.ReadProperty("Enabled", True)
  1010.         .FontBold = PropBag.ReadProperty("FontBold", False)
  1011.         .FontItalic = PropBag.ReadProperty("FontItalic", False)
  1012.         .FontName = PropBag.ReadProperty("FontName", "MS Sans Serif")
  1013.         .FontSize = PropBag.ReadProperty("FontSize", 8)
  1014.         .FontStrikethru = PropBag.ReadProperty("FontStrikethru", False)
  1015.         .FontUnderline = PropBag.ReadProperty("FontUnderline", False)
  1016.         .ForeColor = PropBag.ReadProperty("ForeColor", vbBlack)
  1017.         .Left = PropBag.ReadProperty("Left", 0)
  1018.         .Locked = PropBag.ReadProperty("Locked", False)
  1019.         .MaxLength = PropBag.ReadProperty("MaxLength", 0)
  1020.         .MousePointer = PropBag.ReadProperty("MousePointer", udtMousePointer.Default)
  1021.         .OLEDragMode = PropBag.ReadProperty("OLEDragMode", False)
  1022.         .OLEDropMode = PropBag.ReadProperty("OLEDropMode", False)
  1023.         .PasswordChar = PropBag.ReadProperty("PasswordChar", "")
  1024.         .RightToLeft = PropBag.ReadProperty("RightToLeft", False)
  1025.         .Text = PropBag.ReadProperty("Text", "")
  1026.     End With
  1027.     ' Use default text if flag is set
  1028.     If mblnUseDefaultText Then txtTextBox.Text = mstrDefaultText
  1029. End Sub
  1030. ' ******************************************************************************************************************
  1031. ' Event: CustomizedTextBox.UserControl_Resize
  1032. ' Purpose: To make sure the textbox is the same size as its container when container is resized
  1033. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  1034. ' Date: October 17, 2000 (Last Updated: 10/17/00)
  1035. ' ******************************************************************************************************************
  1036. Private Sub UserControl_Resize()
  1037.     txtTextBox.Move 0, 0, ScaleWidth, ScaleHeight
  1038. End Sub
  1039. ' ******************************************************************************************************************
  1040. ' Event: cTextBox.UserControl_WriteProperties
  1041. ' Purpose: Writes the control properties to the "property bag" (remembers properties)
  1042. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  1043. ' Date: October 17, 2000 (Last Updated: 01/22/01)
  1044. ' ******************************************************************************************************************
  1045. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  1046.     ' Customized properties
  1047.     Call PropBag.WriteProperty("AutoSelect", mblnAutoSelect, True)
  1048.     Call PropBag.WriteProperty("AutoUpperCase", mblnAutoUpperCase, False)
  1049.     Call PropBag.WriteProperty("BackColor_OnGotFocus", mBackColor_OnGotFocus, vbCyan)
  1050.     Call PropBag.WriteProperty("BackColor_OnLostFocus", mBackColor_Normal, vbWhite)
  1051.     Call PropBag.WriteProperty("DefaultText", mstrDefaultText, "")
  1052.     Call PropBag.WriteProperty("MaxEntryTime", mlngMaxEntryTime, 400)
  1053.     Call PropBag.WriteProperty("EntryTimerEnabled", mblnEntryTimerEnabled, False)
  1054.     Call PropBag.WriteProperty("TextType", mintTextType, udtTextType.AlphaNumeric)
  1055.     Call PropBag.WriteProperty("UseDefaultText", mblnUseDefaultText, True)
  1056.     ' Standard "textbox" properties
  1057.     With txtTextBox
  1058.         Call PropBag.WriteProperty("Alignment", .Alignment, udtAlignment.Left_Justify)
  1059.         Call PropBag.WriteProperty("Appearance", .Appearance, udtAppearance.Appear_3D)
  1060.         Call PropBag.WriteProperty("BorderStyle", .BorderStyle, udtBorderStyle.Fixed_Single)
  1061.         Call PropBag.WriteProperty("CausesValidation", .CausesValidation, True)
  1062.         Call PropBag.WriteProperty("DataField", .DataField, "")
  1063.         Call PropBag.WriteProperty("Enabled", .Enabled, True)
  1064.         Call PropBag.WriteProperty("FontBold", .FontBold, False)
  1065.         Call PropBag.WriteProperty("FontItalic", .FontItalic, False)
  1066.         Call PropBag.WriteProperty("FontName", .FontName, "MS Sans Serif")
  1067.         Call PropBag.WriteProperty("FontSize", .FontSize, 8)
  1068.         Call PropBag.WriteProperty("FontStrikethru", .FontStrikethru, False)
  1069.         Call PropBag.WriteProperty("FontUnderline", .FontUnderline, False)
  1070.         Call PropBag.WriteProperty("ForeColor", .ForeColor, vbBlack)
  1071.         If IsArray(txtTextBox) Then Call PropBag.WriteProperty("Index", .Index)
  1072.         Call PropBag.WriteProperty("Left", .Left, 0)
  1073.         Call PropBag.WriteProperty("Locked", .Locked, False)
  1074.         Call PropBag.WriteProperty("MaxLength", .MaxLength, 0)
  1075.         Call PropBag.WriteProperty("MousePointer", .MousePointer, udtMousePointer.Default)
  1076.         Call PropBag.WriteProperty("MultiLine", .MultiLine, False)
  1077.         Call PropBag.WriteProperty("OLEDragMode", .OLEDragMode, udtOLEDragMode.Manual)
  1078.         Call PropBag.WriteProperty("OLEDropMode", .OLEDropMode, udtOLEDropMode.None)
  1079.         Call PropBag.WriteProperty("PasswordChar", .PasswordChar, "")
  1080.         Call PropBag.WriteProperty("RightToLeft", .RightToLeft, False)
  1081.         Call PropBag.WriteProperty("Text", .Text, "")
  1082.     End With
  1083. End Sub
  1084. ' ******************************************************************************************************************
  1085. ' IMPLEMENTATION OF PUBLIC CLASS PROCEDURES
  1086. ' ******************************************************************************************************************
  1087. ' ******************************************************************************************************************
  1088. ' Procedure: CustomizedTextBox.ResetEntryTimer
  1089. ' Purpose: Reset entry timer
  1090. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  1091. ' Date: January 22, 2001 (Last Updated: 01/22/01)
  1092. ' ******************************************************************************************************************
  1093. Public Sub ResetEntryTimer()
  1094.     mblnEntryTimedOut = False
  1095.     mlngEntryStartTime = 0
  1096. End Sub
  1097. ' ******************************************************************************************************************
  1098. ' Procedure: CustomizedTextBox.SelectText
  1099. ' Purpose: Provides method of selecting all text in textbox on demand
  1100. ' Author: Jesse Davis (Copyright, Westinghouse Electric Company, 2000)
  1101. ' Date: January 9, 2001 (Last Updated: 01/11/01)
  1102. ' ******************************************************************************************************************
  1103. Public Sub SelectText()
  1104.     ' Select the text
  1105.     With txtTextBox
  1106.         .SelStart = 0
  1107.         .SelLength = Len(.Text)
  1108.     End With
  1109.     ' Reset flag so that next mouse click doesn't select the text (since already selected)
  1110.     ' Note: This flag will be set to true again if the textbox loses focus
  1111.     mblnSelectWhenClicked = False
  1112. End Sub
  1113.