problems with ListBox
MorgoZ
Posts: 116
Hi all,
i?m trying to make a dynamic list box. I?ve created a listbox button with TPDesign, a DataList dynamically with NetLinx, and i?ve bound them together.
The code is as follows:
BUTTON_EVENT[dvTpiProInicio,1]
{
push:
{
//Creamos el Data List
SEND_COMMAND dvTpiProInicio, "'^LDN-2,1,4,listaPacientes'"
//Establecemos los tipos de datos que contendr?n las columnas (todos texto)
SEND_COMMAND dvTpiProInicio, "'^LDT-1,1,0,0,0,0'"
for(i=1; i<=max_length_array(pacientes); i++)
{
cadena = "pacientes.familyName,' ',pacientes.mothersMaidenName,',',pacientes.name,',',itoa (pacientes.medicalRecordNumber),',',itoa(pacientes.patientAppointment.studyId)"
SEND_COMMAND dvTpiProInicio, "'^LDA-1,0,',cadena"
}
}
"pacientes" is the structure where i save all the data to be displayed.
The ListBox Button has a listPort of 2 and a listAddress of 1
The problem is that when i push the button to load the listBox, at the beginning it shows an empty list; i have to push the list to make it show the data loaded.... why?
The second problem is that i need to refresh the list by pressing another button. To do this i tried to clear the rows with the command
SEND_COMMAND dvTpiProInicio, "'^LDC-1'"
.... and it didn?t work, so i tried to delete all the list with the command
SEND_COMMAND dvTpiProInicio, "'^LDD-1'"
.... and it didn?t work.....
Does someone knows how to manage a ListBox or why is this happening to me?
Many thanks!
Salutes.
i?m trying to make a dynamic list box. I?ve created a listbox button with TPDesign, a DataList dynamically with NetLinx, and i?ve bound them together.
The code is as follows:
BUTTON_EVENT[dvTpiProInicio,1]
{
push:
{
//Creamos el Data List
SEND_COMMAND dvTpiProInicio, "'^LDN-2,1,4,listaPacientes'"
//Establecemos los tipos de datos que contendr?n las columnas (todos texto)
SEND_COMMAND dvTpiProInicio, "'^LDT-1,1,0,0,0,0'"
for(i=1; i<=max_length_array(pacientes); i++)
{
cadena = "pacientes.familyName,' ',pacientes.mothersMaidenName,',',pacientes.name,',',itoa (pacientes.medicalRecordNumber),',',itoa(pacientes.patientAppointment.studyId)"
SEND_COMMAND dvTpiProInicio, "'^LDA-1,0,',cadena"
}
}
"pacientes" is the structure where i save all the data to be displayed.
The ListBox Button has a listPort of 2 and a listAddress of 1
The problem is that when i push the button to load the listBox, at the beginning it shows an empty list; i have to push the list to make it show the data loaded.... why?
The second problem is that i need to refresh the list by pressing another button. To do this i tried to clear the rows with the command
SEND_COMMAND dvTpiProInicio, "'^LDC-1'"
.... and it didn?t work, so i tried to delete all the list with the command
SEND_COMMAND dvTpiProInicio, "'^LDD-1'"
.... and it didn?t work.....
Does someone knows how to manage a ListBox or why is this happening to me?
Many thanks!
Salutes.
0
Comments
i´ve made more tests and i´ve intserted the code:
//Sets the column number (4) to display in the view with address 2
SEND_COMMAND dvTpiProInicio, "'^LVC-2,4'"
//Updates the view at address 2
SEND_COMMAND dvTpiProInicio, "'^LVU-2'"
so now it should update the data..... and it does...... but i have to push the listBox to make the panel refresh it, it doesn´t updates the data loaded at the DataList automatically with the update command, i have to push over the list to make the panel refresh with the new data.
Any advise?
And one last question: could someone explain me the definition of "view address" or the "address of view definition"?? I haven´t found any clear definition about it.
Thanks!!!
The key is to keep track of your data list port/address and your view (i.e. list box button) port/address and don't mix them up. Also, if you're defining a data list from scratch (using ^LDN), be sure that you specify the port allocation in TPD4 under "Project Properties", particularly if the port is the highest in use.
now everything is correct.
Thanks for your help!