varname = LOWER(SYS(18)) DO CASE CASE varname = 'vchoice' AND mfulledit if ALEN(car_array,1) >= ALEN(mvh_year,1) =okay('No more than '+ALLTRIM(STR(ALEN(mvh_year,1)))+' vehicles can be added to a policy.') ELSE lvchoice = IIF(EMPTY(car_array[1]),1,ALEN(car_array,1)+1) IF TYPE('lviewing')="U" lviewing = .F. ENDIF *---TCH 01/05/2003 tch32 DO FORM "appscr2a.scx" NAME Oappscr2a LINKED WITH IIF(EMPTY(car_array[1]),1,ALEN(car_array,1)+1) IF UPPER(TYPE('oappscr2a'))="O" .and. oappscr2a<>.null. oappscr2a.VISIBLE=.F. oappscr2a.RELEASE() ELSE oappscr2a=.NULL. RELEASE oappscr2a ENDIF *DO appscr2a.spr WITH IIF(EMPTY(car_array[1]),1,ALEN(car_array,1)+1) SET PROCEDURE TO listarry DO getcararray SET PROCEDURE TO vchoice = ALEN(car_array,1) THIS.PageFrame.Page2.ControlTop.Requery() THIS.PageFrame.Page2.REfresh() endif CASE varname = 'lchoice' if ALEN(lp_array,1) >= ALEN(mlp_name,1) =okay('No more than '+ALLTRIM(STR(ALEN(mlp_name,1)))+' loss payees can be added to a policy.') else *DO appscr2b.spr WITH IIF(EMPTY(lp_array[1]),1,ALEN(lp_array,1)+1) *---TCH 01/05/2003 tch32 IF TYPE('lviewing')="U" lviewing = .F. ENDIF lvchoice = IIF(EMPTY(lp_array[1]),1,ALEN(lp_array,1)+1) DO FORM "appscr2b.scx" NAME Oappscr2b LINKED WITH IIF(EMPTY(lp_array[1]),1,ALEN(lp_array,1)+1), .F. IF UPPER(TYPE('oappscr2b'))="O" .and. oappscr2b<>.null. oappscr2b.VISIBLE=.F. oappscr2b.RELEASE() ELSE oappscr2b=.NULL. RELEASE oappscr2b ENDIF SET PROCEDURE TO listarry DO getlparray SET PROCEDURE TO lchoice = ALEN(lp_array,1) THIS.PageFrame.Page2.Controlbottom.Requery() THIS.PageFrame.Page2.REfresh() endif ENDCASE ON KEY LABEL F5 oappscrn.a2add() ON KEY LABEL F6 oappscrn.a2del() RETURN .t.However, on the 2nd listbox, when the user presses F5 or F6 the dblclick immediately fires. I couldn't figure out why that was happening so I removed the statements in the WHEN for that listbox and put the following code in the dblclick:
mkey = LASTKEY() varname = 'lchoice' DO CASE CASE mkey = -4 && F5 Add IF ALEN(lp_array,1) >= ALEN(mlp_name,1) =okay('No more than '+ALLTRIM(STR(ALEN(mlp_name,1)))+' loss payees can be added to a policy.') ELSE IF TYPE('lviewing')="U" lviewing = .F. ENDIF lvchoice = IIF(EMPTY(lp_array[1]),1,ALEN(lp_array,1)+1) DO FORM "appscr2b.scx" NAME Oappscr2b LINKED WITH IIF(EMPTY(lp_array[1]),1,ALEN(lp_array,1)+1), .F. IF UPPER(TYPE('oappscr2b'))="O" .AND. Oappscr2b<>.NULL. Oappscr2b.VISIBLE=.F. Oappscr2b.RELEASE() ELSE Oappscr2b=.NULL. RELEASE Oappscr2b ENDIF SET PROCEDURE TO listarry DO getlparray SET PROCEDURE TO lchoice = ALEN(lp_array,1) THIS.PAGEFRAME.Page2.Controlbottom.REQUERY() THIS.PAGEFRAME.Page2.REFRESH() ENDIF RETURN 0 CASE mkey = -5 && F6 Delete if !EMPTY(lp_array[lchoice]) AND yesno('The loss payee '+ALLTRIM(mlp_name[lchoice])+' will be deleted, Continue?') SET PROCEDURE TO listarry DO deletelp WITH lchoice DO getlparray SET PROCEDURE TO lchoice = 1 THIS.PageFrame.Page2.ControlBottom.Requery() THIS.PageFrame.page2.refresh() ENDIF RETURN 0 OTHERWISE oappscrn.a2rmvonkeys() *DO appscr2b.spr WITH lchoice *---TCH 01/05/2003 tch32 IF TYPE('lviewing')="U" lviewing = .F. ENDIF lvchoice = lchoice DO FORM "appscr2b.scx" NAME Oappscr2b LINKED WITH lchoice, .F. IF UPPER(TYPE('oappscr2b'))="O" .AND. Oappscr2b<>.NULL. Oappscr2b.VISIBLE=.F. Oappscr2b.RELEASE() ELSE Oappscr2b=.NULL. RELEASE Oappscr2b ENDIF SET PROCEDURE TO listarry DO getlparray SET PROCEDURE TO THIS.REQUERY() THIS.REFRESH() oappscrn.a2setonkeys() RETURN 0 ENDCASENow what happens is strange. On the 2nd listbox when the user presses F5, the form appscr2b does load but processing continues on to the next line of code in the dblclick instead of pausing for appscr2b and the appscr2b is BEHIND the main form which contains the 2 listboxes and the code in the dblclick (which shouldn't be running anyway yet because appscr2b is a modal form) errors out on :