EditTextField in Datagrid
Trevor DeVore
lists at mangomultimedia.com
Mon Jul 20 12:43:01 EDT 2009
On Jul 20, 2009, at 12:03 PM, Josep wrote:
> Step by step...
>
> On preOpenFieldEditor assign my bInputControl
>
> On bInputControl control the keypress and show the stack and store
> the value
> in a global var
>
> And where put the value from the global var?
I thought about this for a minute and I think the solution is pretty
straightforward. Here is a customized version of the default "Field
Editor" script that has your rawKeyDown handler included. This script
would be assigned to your "bInputControl" button. It is completely
untested.
I also added some commented code to rawKeyDown that uses the
dialogData rather than a global and doesn't require the code you
currently have in selectionChanged.
Notes:
1) When your stack opens you don't want to close the field editor.
That is the reason for the script local used in closefield and
exitField.
2) Why not use the dialogData rather than a global?
Regards,
--
Trevor DeVore
Blue Mango Learning Systems
www.bluemangolearning.com - www.screensteps.com
======================
local sEditingValueInDialog = false
on escapeKey
send "DeleteFieldEditor false" to the dgControl of me in 0 seconds
end escapeKey
on closeField
if not sEditingValueInDialog then
## Don't delete editor within same message
send "DeleteFieldEditor" to the dgControl of me in 0 seconds
end if
end closeField
on exitField
if not sEditingValueInDialog then
send "DeleteFieldEditor" to the dgControl of me in 0 seconds
end if
end exitField
on returnInField
if the autotab of me then
send "DeleteFieldEditor" to the dgControl of me in 0 seconds
else
pass returnInField
end if
end returnInField
on enterInField
if the autotab of me then
send "DeleteFieldEditor" to the dgControl of me in 0 seconds
else
pass enterInField
end if
end enterInField
on tabKey
if the autotab of me then
send "DeleteFieldEditorAndOpenNext" to the dgControl of me in
0 seconds
else
pass tabkey
end if
end tabKey
on selectionChanged
## don't pass as selectionChanged is reserved for group
## developer can override behavior to process selectionChanged
end selectionChanged
on rawkeydown keycode
Global gConcepte
put keycode
switch keycode
case 65472
put true into sEditingValueInDialog ## so field editor does
not close
## set the dialogData to the text of me
go stack "ss_conceptos" as sheet
##########
## Update cell with new value.
set the text of me to gConcepte ## Why not use the dialogData here?
## set the text of me to the dialogData
##########
focus on me ## bring focus back to this field
put false into sEditingValueInDialog ## field editor should
close next time focus leaves.
break
end switch
pass rawkeydown
end rawkeydown
More information about the use-livecode
mailing list