datagrid : how to show a list when the user edit a cell?

André Bisseret andre.bisseret at wanadoo.fr
Mon Nov 22 10:44:43 EST 2010


Bonjour Josep,

I reply to you yesterday but seems my message was lost due to the address change. (I don"t see it in the archives

So trying again ;-))
----------------

Not sure I understand precisely what you are looking for but the following might help:

Create 
- a field named "Entrée" (one line)
- a field "Résultats"
- a field "fldListToSearch" in which you put your list of products descriptions
- a field "fldTarget" (one line; here instead of your data grid)
(sorry for the french words ;-)

in the script of the field "Entrée" put:
----------------------------------
local maSousListe,
------------
on returnInField
 put the selectedText of fld "résultats" into fld "fldTarget"
 put empty into fld "résultats"
 put empty into me
end returnInField

on rawkeyUp
 find empty
 if the number of chars in me > 1 then
     repeat
         find fld "entrée" in fld "fldListToSearch"
         if the result is "not found" then exit repeat
         put value(the foundLine) & cr after maSousListe
     end repeat
 end if
 put empty into fld "résultats"
 put maSousListe into fld "résultats"
 select line 1 of fld "résultats"
 select after me
 put empty into maSousListe
end rawkeyUp
------------------
In the script of the field "Résultats" put:
-------------------
on mouseUp
 put the selectedText into fld "fldTarget"
 put empty into fld "résultats"
 put empty into fld "entrée"
 select after fld "entrée"
end mouseUp
---------------------
When you enter at least two characters in the field "Entrée", all the lines of field "fldListToSearch" having this two characters are displayed in the field "résultats" with the first line being selected.
When you return in fleld "entrée" then the first line of field "résultats" is put in field "fldTarget".
Or, when you click on a line in field "résultats" this line is put in fleld "fldTarget".

Is this kind of thing you are looking for?

HTH

Best regards from Grenoble

André
Le 20 nov. 2010 à 15:43, JosepM a écrit :

> 
> Hi List, 
> 
> I'm thinking about how to solve a problem I have on make easy the entry of
> data in the datagrid by the user. 
> 
> Example. I have a datagrid with four columns. 
> 
> 1 Code 
> 2 Description 
> 3 Qty 
> 4 Price 
> 
> Now the user enters a code that will query the database and retrieves the
> values, then I insert a row and they are placed in datagrid. But not
> everyone has memorized the codes of all products, so I thought about
> implementing some kind of drop-down list where the user press the first
> letter of the code and appeared the products descriptions, to select it and
> add the row. 
> 
> Has anyone tried something similar or experience which would be the best way
> to solve? 
> 
> 
> Salut, 
> Josep
> -- 
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/datagrid-how-to-show-a-list-when-the-user-edit-a-cell-tp3051603p3051603.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> 







More information about the use-livecode mailing list