Update 06.04.2005:
Fixed a serious bug that disabled you form typing certain characters. This will be the last update to this object.
NOTE THIS VERSION IS OUT OF DATE. It's meant to be a JScript code example. New VBScript version is here:
LinkYou would think that a textbox would be a simple object. It is not so. I wanted a textbox where I could apply an alphatransparent bitmap as background. So I went ahead and created one. It consist of four objects and one script. No additional edit controls.
It contains almost all the features of a native textbox. You can easily clone it without any further editing of the script. Written in JScript and commented.
It is meant to act as close as possible as the native textbox. Contact me for inprovement suggestions and bug reports.
Features:
* Caret. Place the caret in any position inside the text and type from there.
* Select text with the mouse or keyboard
* Ctrl+Arrows move cursor between words
* Ctrl+Shift+Arrows modifies selection between words
* Shift+Arrow modify selection by one character
* Cut, Copy, Paste and Delete
* Undo function
* Rightclick menu
* Insert mode. Use Insert key to overwrite text
* Password mode
Limitations:
* No multiline support
* Can only use fonts with a fixed character width
Known issues:
* Not tested against all types of strange characters
* OnSetFocus and OnKillFocus doesn't hide/show the selection and caret. This is due to a DX bug that doesn't trigger these events in JScript. Should work when this issue has been fixed in DX.
Usage:
Shift+RightClick to access DX native menu.
DesktopX.ScriptObject('txtObject').Text - Read the text value
DesktopX.ScriptObject('txtObject').SelStart - Read the Selection start value
DesktopX.ScriptObject('txtObject').SelLength - Read the Selection length value
DesktopX.ScriptObject('txtObject').SetText(strText) - Set text value
DesktopX.ScriptObject('txtObject').Selection(iSelStart, iSelLength) - Change the Selection
Btw, is there any equal of VBScripts Property Get in JScript?
Comment #1 Saturday, March 19, 2005 11:23 PM
now let's see a skinnable combo box (just kidding)