eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'EditFieldWithCompletion':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: EditFieldWithCompletion


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--ListView
                  |
                  +--TextView
                     |
                     +--EditTextView
                        |
                        +--EditField
                           |
                           +--EditFieldWithCompletion

Package:
stx:libtool
Category:
Views-Text
Version:
rev: 1.18 date: 2018/04/24 07:57:13
user: cg
file: EditFieldWithCompletion.st directory: libtool
module: stx stc-classLibrary: libtool
Author:
Jan Vrany (janfrog@bruxa)

Description:


an editfield, which does some completion on the Tab key.


[instance variables:]

[class variables:]


Related information:



Instance protocol:

accepting
o  accept
(comment from inherited method)
accept the current contents by executing the accept-action and/or
changeMessage.
Do this only if the contents of the EditField differs
from the printed representation of the model.

accessing-behavior
o  showOptions

o  showOptions: aBoolean

accessing-dimensions
o  absoluteLeft
answer the absolute left (x) coordinate (i.e. relative to the display)

o  absoluteTop
answer the absolute top (y) coordinate (i.e. relative to the display)

accessing-mvc
o  optionsHolder

o  optionsHolder: aValueHolder
set the 'options' value holder (automatically generated)

event handling
o  completion: best options: options
oldContent := ((self contents ? '') asString).
newContent := ((best isNil or:[ best = oldContent ])
and:[ options isNilOrEmptyCollection not ])
ifTrue:[
options first
options inject:options anyOne
into:[:shortest :each |
shortest asString size > each asString size ifTrue:[
each
] ifFalse:[ shortest ]
]
]
ifFalse:[ best ].
self contents:newContent asString.
self cursorCol:oldContent size + 1.
oldContent size < newContent size ifTrue:[
self
selectFromLine:1
col:oldContent size + 1
toLine:1
col:newContent size
].

o  handleNonCommandKey: char
(comment from inherited method)
pasted selection will NOT be replaced by keystroke

o  handlesKeyPress: key inView: aView

o  hasKeyboardFocus: gotFocusBoolean
no change

o  keyPress: key x: x y: y
Forward certain events to optionsView if any

o  keyPress: key x: x y: y view: aView

o  tabCompletion: best options: options
options size > 1

o  updateContentsForLongest: best options: options

initialization & release
o  destroy
(comment from inherited method)
unmap & destroy - make me invisible, destroy subviews then
make me unknown to the device

o  initialize

private
o  doCompletion

o  doCompletionThenSend: selector
(options includes:best) ifFalse:[

o  doTabCompletion

o  hideOptionsWindow

o  showOptionsWindow
JV: Looks good to me

o  startCompletion

o  startTabCompletion


Examples:


Opens a LiveCompletionEditField on a class name
LiveCompletionEditField example_1


ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Wed, 19 Sep 2018 19:16:32 GMT