|
Class: EditFieldWithCompletion
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)
an editfield, which does some completion on the Tab key.
[instance variables:]
[class variables:]
accepting
-
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
-
showOptions
-
-
showOptions: aBoolean
-
accessing-dimensions
-
absoluteLeft
-
answer the absolute left (x) coordinate (i.e. relative to the display)
-
absoluteTop
-
answer the absolute top (y) coordinate (i.e. relative to the display)
accessing-mvc
-
optionsHolder
-
-
optionsHolder: aValueHolder
-
set the 'options' value holder (automatically generated)
event handling
-
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
].
-
handleNonCommandKey: char
-
(comment from inherited method)
pasted selection will NOT be replaced by keystroke
-
handlesKeyPress: key inView: aView
-
-
hasKeyboardFocus: gotFocusBoolean
-
no change
-
keyPress: key x: x y: y
-
Forward certain events to optionsView if any
-
keyPress: key x: x y: y view: aView
-
-
tabCompletion: best options: options
-
options size > 1
-
updateContentsForLongest: best options: options
-
initialization & release
-
destroy
-
(comment from inherited method)
unmap & destroy - make me invisible, destroy subviews then
make me unknown to the device
-
initialize
-
private
-
doCompletion
-
-
doCompletionThenSend: selector
-
(options includes:best) ifFalse:[
-
doTabCompletion
-
-
hideOptionsWindow
-
-
showOptionsWindow
-
JV: Looks good to me
-
startCompletion
-
-
startTabCompletion
-
Opens a LiveCompletionEditField on a class name
LiveCompletionEditField example_1
|
|