Datagrid can't not find stack

Andre.Bisseret Andre.Bisseret at
Sat May 8 11:33:13 EDT 2010

Buenos dias Josep,
I replicated your two stacks according to your explanations

The main stack "s_document" with
-  a data grid "dg_lineas" with 7 columns: Name,  
TaxNumber,Address,ZipCode,City,State,Country (I just suppressed  
"customer" to get the headers shorter ;-))
- a button "OpenSheet" with your script
- a field "lbl_datos_cliente"
- a button "add" whose script is :
on mouseUp
  dispatch "addLine" to group "dg_lineas" of this stack with the  
dialogData ## instead of tLinea (seems to me that your problem was  
here ; See below)
end mouseUp
- a button "delete line" whose script is :
on mouseUp
    local tLine,
    put the dgHilitedLines of group "dg_lineas" into tLine
    dispatch "deleteLines" to group "dg_lineas" with tLine
end mouseUp

The substack "ss_newcustomer with
the 7 fields (with their nice spanish names ;-) (I pratically don't  
speak it but like your language a lot ;-))
and the button "OK" with exactly your script

Then all is working as (it seems to me that) your are expecting (If I  
have well understood ;-))

Le 7 mai 10 à 20:24, JosepM a écrit :

> Code from the Button on the main stack that open the substack.
> In the substack only I have some fields that are as I said filled  
> manually
> or from the database.
> on mouseup
>   go stack ss_newcustomer of stack "s_document" as sheet
>   set itemdel to tab
>   put item 1 of dialogdata into tCliente[1]["CUSTOMER_NAME"]
>   put item 2 of dialogdata into tCliente[1]["CUSTOMER_TAXNUMBER"]
>   put item 3 of dialogdata into tCliente[1]["CUSTOMER_ADDRESS"]
>   put item 4 of dialogdata into tCliente[1]["CUSTOMER_ZIPCODE"]
>   put item 5 of dialogdata into tCliente[1]["CUSTOMER_CITY"]
>   put item 6 of dialogdata into tCliente[1]["CUSTOMER_STATE"]
>   put item 7 of dialogdata into tCliente[1]["CUSTOMER_COUNTRY"]
>   ## Rellenar los datos del cliente, numero documento y fecha
>   put empty into fld lbl_datos_cliente
>   put tCliente[1]["CUSTOMER_NAME"] & return after fld  
> lbl_datos_cliente
>   put tCliente[1]["CUSTOMER_TAXNUMBER"] & return & return after fld
> lbl_datos_cliente
>   put tCliente[1]["CUSTOMER_ADDRESS"] & return after fld  
> lbl_datos_cliente
>   put tCliente[1]["CUSTOMER_ZIPCODE"] && tCliente[1] 
> return after fld lbl_datos_cliente
>   put "(" & tCliente[1]["CUSTOMER_STATE"] & ")" after fld  
> lbl_datos_cliente
> end mouseup
> Then from the main stack. I have two buttons, one to add and other  
> to delete
> rows from the datagrid.
> It's here when I try to add a row the error occur.
> Button add:
> on mouseUp
>   put the dgNumberOfLines of group "dg_lineas" of this stack into  
> tFilas
>   if tFilas<10 then
>      put "0" & tFilas+1 into tLinea
>   else
>      put tFilas+1 into tLinea
>   end if
Here from the above, I understand that you want to add the line after  
the lines which are already in the data grid.
In this case, you don't have to indicate the line. it will be added  
automatically to the end of the current content (see "AddLine" in the  

>   dispatch "addLine" to group "dg_lineas" of this stack with  tLinea
Here the dialogData is missing (could be the problem) ; you should  
have :

dispatch "addLine" to group "dg_Lineas" of this stack with the  

In fact the complete syntax is :  AddLine pText, pColumns, pLine (see  
addLine in the doc from Trevor
a line number is necessary only if you want to add the line between  
two current lines (for example if you already have 5 lines and you  
want your new line be the second one then you should put
dispatch "addLine" to group "dg_Lineas" of this stack with the  
dialogData,,2   --(note the two commas, it is a place reserved for  
pColumns in case it should be necessary)
>   dispatch "ResetList" to group "dg_lineas" of this stack
this line seems not necessary with addLine (it's working as well  
without it)
> end mouseUp
> I don't see where can fail... :(
> Button "OK" from the substack
> on mouseUp
>   put fld f_NOMBRE & tab & fld f_NIF & tab & fld f_DIRECCION & tab &  
> fld
> f_CP & tab & fld f_POBLACION & tab & fld f_PROVINCIA & tab & fld  
> f_PAIS into
> tDatosCliente
>   set the dialogdata to tDatosCliente
>   close this stack
> end mouseUp
> Salut,
> Josep
> -- 
¡Hasta luego!


More information about the Use-livecode mailing list