Datagrid send focus to a field

Trevor DeVore lists at mangomultimedia.com
Wed Apr 22 22:57:49 EDT 2009


On Apr 22, 2009, at 5:51 PM, Josep wrote:

> I have a trouble with sending the focus to a field. The objective of  
> this
> code is move a field text over the datagrid, copy the values from the
> datagrid to the field text, make some changes, perform some  
> operations and
> update some values into the datagrid.
> When I set the location of the field and send the focus, the field  
> text
> don't recive the focus, and I need to click again inside to select  
> the text.
> Have the datagrid trapped the focus?
>
> What is wrong? Or other way to do the same better?

The data grid shouldn't be stealing focus on selectionChanged. I just  
created a new data grid and a field named "temp" and added the  
following code to the data grid:

on selectionChanged pHilitedIndex, pPrevHilitedIndex
     switch the shiftkey is down
         case true
             show fld "temp"
             put GetDataOfIndex(pHilitedIndex, "col 2") into field  
"Temp"
             select text of fld "temp"
             focus on field "temp"
             break
         default
             hide field "temp"
     end switch
end selectionChanged

When holding the shiftkey down the field appeared, had the correct  
text and had focus. Does this simple example work for you? If so then  
we need to track down what extra steps you are performing that cause  
focus to not go into the field.

By the way, are you just editing text in table cells? If so, would the  
built-in cell editing do what you need?

Regards,

-- 
Trevor DeVore
Blue Mango Learning Systems
www.bluemangolearning.com    -    www.screensteps.com



More information about the use-livecode mailing list