Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Listbox Refreshing... (again)
Message
De
02/03/2001 09:28:13
Chuck Tripi
University of Wisconsin - Milwaukee
Milwaukee, Wisconsin, États-Unis
 
 
À
01/03/2001 16:03:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00480993
Message ID:
00481332
Vues:
11
To make it more clear in my coding, this is what I have (in the last part of ClickEvent of 'Save' and 'Delete' buttons of the form):

lnRecNo = RECNO()
SET ORDER TO 0
ThisForm.List1.Requery()
ThisForm.List1.SetFocus()
ThisForm.List1.Selected(lnRecNo) = .T.
SET ORDER TO main
ThisForm.List1.Refresh
ThisForm.Refresh

Is this in the correct order or do I need to rearrange this? This didn't really work, but I think I am getting very close. I still can not believe what's all hard about this listbox. I did some moving around and aren't getting it yet. What is really happening is it UNindex and leaves it like that (does not index it back, as coded).

Also, can someone tell me if doing "SET ORDER TO 0" and then "SET ORDER TO main" is like REINDEXing, only without the need of EXCLUSIVE? My VFP book says that (structural) index (which is what I have, as "Regular") are "Is automatically maintained as your add, change, or delete table records." So this is where I am not understanding why this mere 'ThisForm.Refresh" isn't working?

Sorry to keep all info below (not snipping it), but in case someone jumps in later, would need to see all that to understand...

Chuck

>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...
Today is tomorrow's yesterday.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform