Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Listbox dblclick strange occurrance
Message
De
24/09/2004 15:24:56
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Listbox dblclick strange occurrance
Divers
Thread ID:
00945855
Message ID:
00945855
Vues:
58
Nevermind, I got it working.


I have a page with two listboxes on it. The first one works as it should. The 2nd one works strangely. There is code in each listboxes' when event of the following:

ON KEY LABEL F5 oappscrn.a2add()
ON KEY LABEL F6 oappscrn.a2del()
RETURN .T.

Here is code in the oappscrn.ad2dd method:
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
ENDCASE
Now 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 :
THIS.PAGEFRAME.Page2.Controlbottom.REQUERY()
THIS.PAGEFRAME.Page2.REFRESH()
because pageframe is a member of the main form not the appscr2b form. Yet that code should not even be running yet.
I forgot to mention that in both listboxes, if the user actually 'dblclicks' on an item in the list the dblclick runs as it should and launches the appropriate modal form for editing the item in the list ON TOP of the main form as it should.
Any ideas?
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Répondre
Fil
Voir

Click here to load this message in the networking platform