Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Listbox RowsourceType of PopUp Click Not working
Message
From
24/03/2004 16:13:01
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Listbox RowsourceType of PopUp Click Not working
Miscellaneous
Thread ID:
00889406
Message ID:
00889406
Views:
58
Ok, I'm definitely overlooking something here. I have a form that has a listbox and a commandbutton only. The properties of the listbox are:

*Userhelp form init only contains:
thisform.caption = poptitle
popchoice = 1

*Userhelp form's listbox properties:

controlsource=popchoice
dblclick event = thisform.release && no code in form release
rowsource = userhelp
rowsourcetype = 9 - Popup
Value = 1

*Userhelp command button click:
thisform.release && no code in form release

When the user presses F1 in a field, a program is run that checks to see which object the user is currently on. Based on the object, different popup forms are created for the user to select from. In about 20% of the cases, the below popup is created on the fly (most other cases a form already exists that is designed specifically for that object). What is strange is that when the form pops up, if the user dblclicks on a item in the list, the value is returned to the calling form as it should be. Also works if the user Presses F10 while an item in the listbox is selected or if the user selects an item in the listbox and presses Enter. However, if the user just clicks once on an item in the listbox to select it and then clicks on the OK commandbutton, the form closes, but the value in the listbox is not carried over to the object on the form. What am I missing?

TIA!

The listbox is populated as so:
*--The next line is a valid example, pickhelp is used in many places
DO PickHelp WITH m.ag_state, 'BI', 'SELECT BI LIMIT', map_incep

PROCEDURE PickHelp
PARAMETERS sState, sKey, sTitle, dEff

PRIVATE dbfarea, sKeyBoard, iBar
dbfarea = ALIAS()
sKeyBoard = ''
iBar = 0

IF EMPTY(dEff)
	dEff = DATE()
ENDIF

SELECT 0
USE (ddir+'USERHELP')

SELECT 0
SELECT * FROM UserHelp ;
	WHERE Uh_state = sState ;
	AND Uh_key = sKey ;
	AND ( EMPTY(Uh_Begin) OR Uh_Begin <= dEff) ;
	AND ( EMPTY(Uh_End) OR Uh_End > dEff ) ;
	INTO CURSOR uHelp

USE IN UserHelp

SELECT uHelp
GOTO TOP

IF RECCOUNT() = 0
	USE IN uHelp

	IF !EMPTY(dbfarea)
		SELECT (dbfarea)
	ENDIF

	RETURN
ENDIF

DEFINE POPUP UserHelp MARK CHR(32) MARGIN PROMPT FIELD uHelp.Uh_value

poptitle = sTitle
popchoice = 1

DO FORM "USERHELP.SCX" NAME oUserhelp LINKED
		
IF LASTKEY() <> 27
	sKeyBoard = CHR(25) + PADR(ALLTRIM(uHelp.Uh_value),uHelp.Uh_length)
ENDIF

USE IN uHelp

IF !EMPTY(dbfarea)
	SELECT (dbfarea)
ENDIF

IF !EMPTY(sKeyBoard)
	KEYBOARD sKeyBoard
ENDIF

RELEASE POPUP UserHelp

RETURN
I saved the form as a class so I could post the form's code. Nothing special:
DEFINE CLASS popuplist AS FORM

	Height = 375
	Width = 420
	DoCreate = .T.
	MaxButton = .F.
	MinButton = .F.
	Name = "frmUserhelp"

	ADD OBJECT list1 AS listbox WITH ;
		RowSourceType = 9, ;
		RowSource = "Userhelp", ;
		Value = 1, ;
		ControlSource = "popchoice", ;
		Height = 312, ;
		Left = 12, ;
		Top = 12, ;
		Width = 396, ;
		Name = "List1"

	ADD OBJECT cmdok AS commandbutton WITH ;
		Top = 336, ;
		Left = 177, ;
		Height = 25, ;
		Width = 65, ;
		Cancel = .T., ;
		Caption = "OK", ;
		Default = .T., ;
		Name = "cmdOK"

	PROCEDURE Init
		thisform.caption = poptitle
		popchoice = 1
	ENDPROC

	PROCEDURE list1.DblClick
		thisform.Release
	ENDPROC

	PROCEDURE cmdok.Click
		thisform.Release
	ENDPROC

ENDDEFINE
.·*´¨)
.·`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"
Reply
Map
View

Click here to load this message in the networking platform