FoxPro/Visual FoxPro - Ir al último elemento de un list

 
Vista:

Ir al último elemento de un list

Publicado por Ángel I. (86 intervenciones) el 29/05/2006 19:37:03
Hola a todos:

Voy agregando a un List elementos mediante
*
frase="Iniciando inserción de clientes..."
thisform.list1.additem(frase)

con un bucle y cambiando el valor de frase. Ahora bien cuando los elementos sobrepasan el tamaño del List...no se ve los que va agregando. ¿Cómo se hace para ir al último elemento insertado en un List?

Muchas gracias por adelantado.

Un cordial saludo.
Ángel.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

RE:Ir al último elemento de un list

Publicado por Ernesto Hernandez (4623 intervenciones) el 29/05/2006 22:13:19
Prueba esto a ver si te da una idea.


CLEAR

DIMENSION gaMyListArray(10)
FOR gnCount = 1 to 10 && Fill the array with letters
STORE REPLICATE(CHR(gnCount+64),6) TO gaMyListArray(gnCount)
ENDFOR

frmMyForm = CREATEOBJECT('Form') && Create a Form
frmMyForm.Closable = .f. && Disable the Control menu box

frmMyForm.Move(150,10) && Move the form

frmMyForm.AddObject('cmbCommand1','cmdMyCmdBtn') && Add "Quit" Command button
frmMyForm.AddObject('lstListBox1','lstMyListBox') && Add list box control

frmMyForm.lstListBox1.RowSourceType = 5 && Specifies an array
frmMyForm.lstListBox1.RowSource = 'gaMyListArray' && Array containing listbox items

frmMyForm.cmbCommand1.Visible =.T. && "Quit" Command button visible
frmMyForm.lstListBox1.Visible =.T. && "List Box visible

frmMyForm.SHOW && Display the form
READ EVENTS && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton && Create Command button
Caption = '\<Quit' && Caption on the Command button
Cancel = .T. && Default Cancel Command button (Esc)
Left = 125 && Command button column
Top = 210 && Command button row
Height = 25 && Command button height

PROCEDURE Click
CLEAR EVENTS && Stop event processing, close Form
CLEAR && Clear main Visual FoxPro window
ENDDEFINE

DEFINE CLASS lstMyListBox AS ListBox && Create ListBox control
Left = 10 && List Box column
Top = 10 && List Box row
MultiSelect = .T. && Allow selecting more than 1 item

PROCEDURE Click
ACTIVATE SCREEN
CLEAR
? "Selected items:"
? "---------------"
FOR nCnt = 1 TO ThisForm.lstListBox1.ListCount
IF ThisForm.lstListBox1.Selected(nCnt) && Is item selected?
? SPACE(5) + ThisForm.lstListBox1.List(nCnt) && Show item
ENDIF
ENDFOR

ENDDEFINE

Suerte
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

RE:Ir al último elemento de un list

Publicado por DALSOM (612 intervenciones) el 29/05/2006 22:13:32
SOLO TIENES QUE ASIGNARLE EL TOTAL DE ITEMS DE LA LISTA AL INDICE.

thisform.list1.ListIndex=thisform.list1.ListCount

O EL PRIMER ITEM DE LA LISTA, SI QUIERES IR AL PRIMERO.

thisform.list1.ListIndex=1

SALUDOS,
DALSOM.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar