Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Hi Jang,
I don't know if this will help but how about doing the refresh in your add code before doing the setfocus?
Hope his helps,
Gavin...
>When building a form to display some fields,I
>encountered the following :
>I have 7 fields in my form (6 of which are textboxes
>and 1 general for picture). Besides these 7 elements
>in the form I have also put in a listbox displaying
>the records of the table. I have no problem going
>form record to record, go top, go bott etc, and the
>form displays fine, and the listbox with its highlight bar
>pointing correctly at the corresponding record.
>
>When I tried adding records (after pressing the
>add button), the textboxes do go blanks and focus
>was set at the first field as desired, but the highlight
>bar in the listbox disappeared. When save-record
>was issued, the newly entered record was found
>overwriting the record the listbox was pointing at
>right before adding. By scrolling up and down the
>list, a blank record was found at the top of the list.
>My guess is that APPEND BLANK had indeed
>added a new record to the table, but somehow the
>pointer wasn't updated to point to the new record.
>Instead it sits at where it was originally and thus
>an add-record had become an edit-record.
>
>I have tried a number of things including playing
>with the control source, en/disabling the listbox during
>add, changing the codes in the add button click event,
>playing with the datasession and dataenvironment,
>and I still couldn't get it to work. Could somone please
>tell me what I have done wrong? Any help would
>be appreciated.
>
>PS: the following is in my addbutton.click :
>
>IF NOT EOF()
> THISFORM.oldRecNo = RECNO()
>ENDIF
>APPEND BLANK
>THISFORM.itemNum1.SETFOCUS()
>THISFORM.refresh()
>
>In my savebutton.click:
>
>result = TABLEUPDATE(.F.,.T.,"Items")
>IF !result
> =MessageBox(" Record save unsuccessful ",48," Item ")
> RETURN
>ENDIF
>IF INLIST(THISFORM.opcode,1)
> THISFORM.opcode = 4
> THISFORM.onOffBtn1(2)
> THISFORM.refresh()
>ENDIF
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement