PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 2024 → WD8 - Retrieve entered value in editable combo box in table
WD8 - Retrieve entered value in editable combo box in table
Iniciado por Peter Holemans, jan., 24 2005 12:29 AM - 2 respostas
Publicado em janeiro, 24 2005 - 12:29 AM
Hi,
I have an editable combo box in a column within an editable table.
This combo is filled with another file (e.g. Country) because it is a foreign key in the current file browse table (on e.g. City).
Now I would like to retrieve the value that the user just entered in the editable combo box upon exit of the row to see if it exists or not and open the appropriate input window if required.
I just cannot seem to retrieve that newly entered value in the combo in anyway.
I tried Myself, Myself..value, Myself..DisplayedValue and so on in the exit code of the column... They all return blank.
Any clue out there?
Thanks,
Peter
Publicado em janeiro, 24 2005 - 7:36 PM
Hi Peter,
My advice: add a button for Country and/or City and turn the combobox into an none-editable one. If you insist on editing in the table, fill the combobox by programming. Then you should be able to detect new entries. However you must prevent users from typing new Countries for existing Cities.
Regards,
Piet
Hi,
I have an editable combo box in a column within an editable table.
This combo is filled with another file (e.g. Country) because it is a foreign key in the current file browse table (on e.g. City).
Now I would like to retrieve the value that the user just entered in the editable combo box upon exit of the row to see if it exists or not and open the appropriate input window if required.
I just cannot seem to retrieve that newly entered value in the combo in anyway.
I tried Myself, Myself..value, Myself..DisplayedValue and so on in the exit code of the column... They all return blank.
Any clue out there?
Thanks,
Peter
Publicado em janeiro, 24 2005 - 9:43 PM
Hi,
I was able to define an elegant solution.
E.g.:
1) I still have a table in edit containg a PostalCode, City and CountryID column
2) All these columns are linked to the city data source (City.xxxx)
3) The CountryID is a combo box type column with the 'Returns the specified value avec la fonction gLien' set to true.
4) The content of the CountryID column is a memory list (not a file list)
5) The column has the following init code:
//Clear the list first in case this method is called for refresh
ListDeleteAll(MySelf)
//Load the combo with all countries and add a first
//custom row allowing the "New..." functionality
ListAdd(MySelf,gLink("")+"New...")
FOR ALL Country on CountryID
__ListAdd(MySelf,gLink(Country.CountryID)+Country.CountryID)
END
6) the column has the following 'Row selection of country ID' code:
//Test if "New..." is selected
IF ListSelect(MySelf) = 1 THEN
__sStoredValue is string = Open(Win_CountryNew)
__IF sStoredValue <> "" THEN
____//Refresh the combo
____ExecuteProcess(MySelf..Name,trtInit)
____//Position on the new entry
____MySelf=sStoredValue
__ELSE
____//Restore the previous value
____MySelf=City.CountryID
__END
END
This does everything I need and it works great allowing a consistent look and feel througout the application: each combo box containing a foreign key value has a first custom row allowing the user to open a window for creating a new value for a foreign entity to the current entity.
I have requested an enhancement with PCSoft to foresee the '1st custom row' functionality as well in combo boxes in editable tables as they do on forms. This would make live much easier.
I hope this may help some of you.
Cheers,
Peter