Last Update: 07 September 2005 - Version 2.2.0
Published on March 23, 2005 By Thomas Thomassen In Objects & Widgets
DXTextbox
Version: 2.2.0
First Released: 23 March 2005
Last Update: 07 September 2005
Download: https://www.wincustomize.com/ViewSkin.aspx?SID=1&SkinID=3947&LibID=3
Attention!
Version 2.0.0 had some serious bugs. Bugs have now been fixed in version 2.1.0. Please update if you downloaded version 2.0.0.
[03 April 2005]
Features
  • Caret position adjustable from mouse and keyboard
  • Selection adjustable from mouse and keyboard
  • Ctrl+[Any Arrowkey] to skip between words
  • Shift+[Any Arrowkey] to adjust the selection by one character
  • Ctrl+Shift+[Any Arrowkey] to adjust selection on a word by word basis
  • Doubleclick words to select them
  • Hotkeys (Ctrl+A, Ctrl+C, Ctrl+V, Ctrl+X, Ctrl+Z)
  • Rightclick menu
  • Insert mode (Toggle Insert key)
  • Undo (One step only)
  • Text Scrolling (Mouse and Keyboard)
  • Password mode
  • MaxLength
  • Supports Unicode characters
  • Focus and LostFocus state
  • OnChange event
  • OnSelChange event
  • OnTab event
  • Property menu in Builder mode
  • Property form in Builder mode

Properties
  • Property Text (string)
  • Property MaxLength (integer)
  • Property Password (boolean)
  • Property Numeric (boolean)
  • Property SelStart (integer)
  • Property SelLength (integer)
Methods
  • Sub SelectText(intStart, intLength, boolSelectStart)The boolSelectStart argument determines if the caret should be at the beginning or end of the selection.
  • Sub Cut()
  • Sub Copy()
  • Sub Paste()
  • Sub Delete()
Events
You can set an object to handle event callbacks from the textbox. Before you define the object to handle it you have to add the appropriate functions. You can have the object handle the callbacks from several textboxes, the name of the textbox that triggers the event is given in the first argument strTextboxName.
  • Sub OnChange(strTextboxName) Triggers when the text changes.
  • Sub OnChange(strTextboxName) Triggers when the selection length changes
  • Sub OnChange(strTextboxName, boolShift) Triggers when the user presses the Tab key. boolShift returns true if the user presses Shift+Tab.

Usage:
Shift+RightClick to access DX's native rightlick menu for the object.

For the following example you need to do the following:
  1. Add two textboxes. Name one of them txtThis the other one txtThat.
  2. Create a new text object and give it an ID.
  3. Add the script below to the text object.
  4. Set the textboxes event callback to the text object you just created.
Example:
Dim txtThis, txtThat

Sub Object_OnScriptEnter
  'Make references for easier access
  Set txtThis = DesktopX.ScriptObject("txtThis").Textbox
  Set txtThat = DesktopX.ScriptObject("txtThat").Textbox
  Object.Text = "[Ready]"
End Sub

Sub Object_OnScriptExit
  'Clean up
  Set txtThis = Nothing
  Set txtThat = Nothing
End Sub

Public Sub Textbox_OnChange(strTextboxName)
  Object.Text = strTextboxName & "_OnChange() Triggered - " & Time
End Sub

Public Sub Textbox_OnSelChange(strTextboxName)
  Select Case strTextboxName
    Case "txtThis"
      txtThat.Text = "txtThis_OnSelChange() triggered " & Time
    Case "txtThat"
      txtThat.Text = "txtThat_OnSelChange() triggered " & Time
  End Select
End Sub

Public Sub Textbox_OnTab(strTextboxName, boolShift)
  If boolShift Then
    'Send foucs backwards
  Else
    'Send foucs forwards
  End If
End Sub

History
  • Version 2.1.0 - 03 April 2005
    • Fixed bug in substr that cause text to multiply
    • Fixed bug in handling of CTRL and ALT GR
    • Fixed selection bug when overwriting selected text
    • Fixed bug where error is caused by Chr() when you try to type the Euro sign. This might have affected other characters as well. Used ChrW() instead that uses unicode values.
  • Version 2.2.0 - 07 September 2005
    • Fixed intial text diplay for when the textbox are used for the first time.
    • Fixed bug, the caret where initally visible even though the textbox didn't have focus.
    • Focus and LostFocus state
    • OnChange event
    • OnSelChange event
    • OnTab event
    • Property menu in Builder mode
    • Property form in Builder mode

Comments
No one has commented on this article. Be the first!