Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Listbox Refreshing... (again)
Message
De
01/03/2001 16:03:13
 
 
À
01/03/2001 14:11:02
Chuck Tripi
University of Wisconsin - Milwaukee
Milwaukee, Wisconsin, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00480993
Message ID:
00481113
Vues:
13
Chuck, I think you are going to have to move the listbox pointer yourself (set the selected property). There may well be a simpler way to do this, but this this should work - after you add the record, temporarily turn off the index, select the record number in the listbox, set the focus to the listbox, refresh it, and reset the index.

For Example:
Local lcTag, lcAlias, lnRecNo

lcAlias = Alias   && get current workarea
Select authtype
lnRecNo = RecNo('authtype')  && record number of current record
lcTag = Tag()   && get current tag name
Set order to 0 in 'orditems'  && turn off the index

ThisForm.List1.Requery()   && get current data
Thisform.List1.SetFocus()
ThisForm.List1.Selected(lnRecNo) = .T.  && set list highlight to current record
If !Empty(lcTag)
   Set order to &cTag in 'orditems'   && turn index back on with proper tag
Endif
Thisform.List1.Refresh()

If !Empty(lcAlias)
   Select (lcAlias)   && set workarea back as it was
Endif
>I thought I had the Listbox ControlSource filled in, so I put AUTHTYPE.AUTHTYPE in it, still no effect. So, I took it out. For some reason, the executable file and the "Run" from the project ('Run' the main.prg) does different things to the listbox?
>
>This is what is need to be done. Example, there is 500 records and the listbox is showing the first 10 of the indexed table. And we want to add a record (using mem var, m.at), type something in the textbox, click 'Save'. Then the listbox is supposed to rearrange the listbox into alphabetic order (the table itself is already regular indexed, but can not use REINDEX since it's not exclusive open) AND also display the newly entered record. So, at this case with 500 records and the first 10 (top of the alphabetic) record is showing, after clicking the 'Save' button, it need to SHOW that the new record was 'successfully' entered by refreshing the listbox and go to that record, which could be anyway on that listbox (instead of having the user to scroll around to see if it was saved or not).
>
>Data Properties of the listbox:
>ControlSource: (None)
>RecordSource: AUTHTYPE.AUTHTYPE
>RecordSourceType: 6 - Fields
>(all rest is defaulted)
>
>In the last part of the ClickEvent of the 'Save' and 'Delete':
>>>ThisForm.List1.Refresh
>>>ThisForm.List1.SetFocus()
>>>ThisForm.List1.Requery()
>>>ThisForm.Refresh
>
>If I remember correctly, when I put the ThisForm.List1.SetFocus(), it worked 'perfectly', but not anymore? Also, I was told by someone that the AUTHTYPE.AUTHTYPE must be capitalized (upper case) for the sequence to work, so I did that too...
>
>Chuck
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform