Unit inedit |
TInEdit component. Copyright 1996 MIKSoft, Inc. ********************************************** Freeware by MIKSoft, Inc. Uploaded by Mik Kvitchko, mik@cnj.digex.com This unit contains one component implementing an in-place editor. The component can be used to extend the functionality of the non-editable components (like ListBox, for example) by providing the in-place editing ability. Actually, this component is a "promotionware": you are free to use it as you wish in any projects, however we ask you to visit our WWW home page and read about our other nice products. Chances are, you'll get an extra bonus - right from our home page :-) http://www.cnj.digex.net/~mik ********************* TInEdit does not make an attempt to recognize its parent and to adjust its behavior accordingly - it is made as a "base" or "generic" in-place editor, you can create a set of specialized in-place editors (TListBoxInEdit, TOutlineInEdit etc) by deriving from TInEdit and adding the behavior appropriate for the certain parent component. The techniques for implementing such customized behavior you will find in the accompanying sample - uined1.pas. This unit shows how to make an editable listbox. TInEdit derives from TEdit and inherits all TEdit's properties. It is possible, that some other flavor of edit's control will suit your needs better - in such case you simply need to change the source code to derive TInEdit from some other edit component. Being a generic in-place editor, TInEdit has no way to know where it must be placed, and what text it must contain - so it is your responsibility to position the component during the run-time and to make it visible at the appropriate time - see uined1.pas for example. How it works? When designing the form, place TInEdit on top of some uneditable component, ie. make sure that this component becomes TInEdit's parent. You can also assign the parent during the run-time, of course - using this approach you can use just one TInEdit control to edit numerous other components on your form - a great way to save system resources. When TInEdit is first created, it makes itself invisible. At some time your program must position it in the proper place inside the parent, assign some text to it and make it visible. From this moment on, TInEdit takes over, and allows to edit the assigned text. However, it watches for certain keys and events which indicate that the user finished editing and is attempting to leave TInEdit - at this point the special event (published as OnGoingOff property) will be triggered. When you assign the handler to this event, it must be defined as follows: procedure InPlaceEditGoingOff(Sender: TObject; Reason: TGoingOffReason; Value: String; var AllowExit: Boolean); "Reason" parameter allows you to find out why the event was triggered: goLeft - Left Arrow key (past the first position of the editable text) or Ctrl-Left goRight - Right Arrow key (past the last position of the editable text) or Ctrl-Right goUp - Up Arrow key goDown - Down Arrow key goRTab - Tab key goLTab - Shift-Tab key goEnter - Return key goEscape - Escape key goPgUp - Page Up key goPgDn - Page Down key goHome - Ctrl-Home key goEnd - Ctrl-End key goNone - some other reason (perhaps user switched to another control with the mouse); "Value" parameter contains the current text of the edit control, that is what user expects to be assigned to the proper element of the underlined parent component. "AllowExit" parameter allows you to decide whether user is allowed to exit editing at this point. If you assign False to this parameter - TInEdit will not allow to exit from the editing state. If you don't assign False to AllowExit in this handler, TInEdit will make itself unvisible upon return from this event. Procedure GoOff; This procedure allows you to discard currently active in-place editor without triggering the OnGoingOff event. ********************* You may use TInEdit freely at your own risk in any kind of environment. This component is not to be sold at any charge, and must be distributed along with the source code. While MIKSoft, Inc. claims the copyright to the original source code, this does not mean that you may not modify or enhance it. Just add your credits, and if you think you came up with some major improvement that the Delphi community might find useful, upload it at some Delphi site. Send us a copy as well to mik@cnj.digex.com Of course, any enhancement/modification must be released as Freeware. Have fun! A few words about MIKSoft: ************************** MIKSoft, Inc. is a software development company founded in 1994. Currently MIKSoft offers two tools for developing demos and tutorials, authoring multimedia titles and for developing reliable Windows automation programs based on keyboard and mouse simulation. One is StDemo Player v2.1 and another one is ShowBasic for Windows 1.2. Both tools allow to develop demos/tutorials for "live" applications, i.e. they can control any Windows application. ShowBasic also supports slide-show and AVI-captured demos. Both tools include "smart" Recorders which allow to generate simulation script that can be played invariantly of Windows resolution, device driver, window size and position etc. StDemo Player is quite straightforward - you write script using simple scripting language and from this script you can (1) simulate mouse and keyboard and (2) show some dialogs with explanatory text, graphics, menu or input fields. ShowBasic is a much more powerful tool - the scripting language is full-featured Basic capable even of calling external DLLs, and its set of specialized functions allows to do numerous thing: create popup windows with formatted text and graphics (use even Windows API if you need something special), handle different events (that's how you do more than demos - computer based training titles), plenty of presentation features (transition effects, multimedia, sprites, animation), code any dialog boxes as templates inside your program, and much more. You can get more information from http://www.cnj.digex.net/~mik/ This site offers the description of both tools, ShowBasic demo and StDemo Player shareware version. Alternatively you can get them from: ftp://ftp.digex.net/pub/cnj/mik/sbdemo.txt ftp://ftp.digex.net/pub/cnj/mik/sbdemo.zip ftp://ftp.digex.net/pub/cnj/mik/stdm21.txt ftp://ftp.digex.net/pub/cnj/mik/stdm21.zip MIKSoft, Inc. 37 Landsdowne Road East Brunswick, NJ 08816 voice/fax: (908) 390-8986 mik@cnj.digex.net http://www.cnj.digex.net/~mik/
Classes |
TInEdit -
Functions |
Register - --------------------------------------------------------------------------
Types |
Constants |
Variables |
Functions |
Types |
TGoingOffEvent = procedure(Sender: TObject; Reason: TGoingOffReason; Value: string; var AllowExit: Boolean) of object
TGoingOffReason = (goNone, goLeft, goRight, goUp, goDown, goRTab, goLTab, goEnter, goEscape, goPgUp, goPgDn, goHome, goEnd);
Constants |
Variables |