Datagrid send focus to a field

Josep jmyepes at
Thu Apr 23 03:46:55 EDT 2009

Hi Trevor,

I tryed your example and doesn't work for me. I create a new field text and
put your code into the datagrid and the focus go to the text field but go
back to the datagrid. If I click with the right button then work, but not
detect the new click over other col in the same row if I not change the
selection row.

Very extrange.

I put the openField and exitField in the field text, and the focus come in
and come out, I think to the datagrid to finish the selectionchange.
The datagrid isn't editable and auto-hilite rows checked.

I don't use the built-in editable capabilities so I need edit only one or
two cols, and handle the function keys to query database to get codes and
perform operations for each line when the user fill the data.

It's posible block many cols and auto calculate other cols versus the values
of fill data? and if the user go back and modify the values, this can be
recalculated? Can I trap the rawkeycode?

Can change the color of the entire line determined by some value in the
line? For example to show if exist or not stock for this line? But this
value will used in two cases:

a) query a database
b) fill data directly and on the fly changing the color of the line

I read the datagrid manual and don't see how change the colors. I think that
maybe is posible perform calculate field via behaviors cols. But I haven't
clear how do it.

Thanks for your time to help us to know better this very good object :)


Josep wrote:
> Hi list,
> 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?
> Code:
> on selectionChanged pHilitedIndex, pPrevHilitedIndex
>     switch tCol
>        case 2
>          show fld ftmp
>          set the width of fld ftmp to 41
>          put 322 into tCoorFila
>          add (tLinea-1)*21 to tCoorFila
>          put the dgDataOfIndex [ pHilitedIndex ] of me into t_LineData
>          put t_LineData["Col 2"] into fld ftmp
>          put the dgVScroll of group "DataGrid" into tScroll
>          set the location of fld ftmp to 625,tCoorFila-tScroll
>          select the text of fld ftmp
>          focus on field ftmp
>          break
>        case X...
>        ...
>       end switch
> end selectionChanged
> Salut,
> Josep

View this message in context:
Sent from the Revolution - User mailing list archive at

More information about the use-livecode mailing list