Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ListBox Woes
Message
De
11/08/2004 15:52:52
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
ListBox Woes
Divers
Thread ID:
00932469
Message ID:
00932469
Vues:
56
VFP8 SP1, Windows XP Sp1
Can anyone with the available time please test the below program? I am experiencing strange erratic behavior. At times the quick search (hotkey) works and other times it does not. If I type 'A' for example it may or may not go to the first item in the list that begins with the letter 'A.' The same with the other letters of the alphabet...
CLEAR
SET SAFETY OFF
SET ESCAPE ON
SET TALK OFF

CREATE TABLE letter (title c(20), descript c(30))
select letter
APPEND BLANK
REPLACE letter.title WITH "STATEMENT OF NO LOSS"
REPLACE letter.descript WITH "LETTER TO THE CARRIER"
APPEND BLANK
REPLACE letter.title WITH "CONTACT LETTER"
REPLACE letter.descript WITH "CONTACT LETTER"
APPEND BLANK
REPLACE letter.title WITH "FR-9 INSURED"
REPLACE letter.descript WITH "FR-9 INSURED"
APPEND BLANK
REPLACE letter.title WITH "FR-9 ANYONE"
REPLACE letter.descript WITH "FR-9 ANYONE"
APPEND BLANK
REPLACE letter.title WITH "ORION AUTO CLAIM"
REPLACE letter.descript WITH "ORION AUTO CLAIM"
APPEND BLANK
REPLACE letter.title WITH "ADD PREM"
REPLACE letter.descript WITH "ADD PREM"
APPEND BLANK
REPLACE letter.title WITH "ADDRESS"
REPLACE letter.descript WITH "ADDRESS"
APPEND BLANK
REPLACE letter.title WITH "ATLANTA AUTO CLAIM"
REPLACE letter.descript WITH "ATLANTA AUTO CLAIM"
APPEND BLANK
REPLACE letter.title WITH "DAIRYLAND CLAIMS"
REPLACE letter.descript WITH "DAIRYLAND CLAIMS"
APPEND BLANK
REPLACE letter.title WITH "CANCELLATION REQUEST"
REPLACE letter.descript WITH "CANCELLATION REQUEST"
APPEND BLANK
REPLACE letter.title WITH "RENEW OFFER"
REPLACE letter.descript WITH "RENEWAL OFFER"
APPEND BLANK
REPLACE letter.title WITH "UNISUN EXCLUSION"
REPLACE letter.descript WITH "UNISUN EXCLUSION"
INDEX ON title TAG title
SET ORDER TO TAG TITLE
GO TOP

oform = CREATEOBJECT('ltrsel')
oform.show
READ EVENTS

CLOSE ALL
RETURN


DEFINE CLASS ltrsel AS form

	Height = 366
	Width = 469
	ShowWindow = 0
	DoCreate = .T.
	AutoCenter = .T.
	BorderStyle = 2
	Caption = "Select Letter to Print"
	MaxButton = .F.
	MinButton = .F.
	WindowType = 1
	WindowState = 0
	assignto = "''"
	crntalias = "''"
	crntdel = "''"
	closeit = .F.
	Name = "LTRSEL"


	ADD OBJECT shape1 AS shape WITH ;
		Top = 14, ;
		Left = 21, ;
		Height = 241, ;
		Width = 421, ;
		SpecialEffect = 0, ;
		ZOrderSet = 0, ;
		Name = "Shape1"


	ADD OBJECT cmdcancel AS commandbutton WITH ;
		Top = 314, ;
		Left = 232, ;
		Height = 25, ;
		Width = 64, ;
		Cancel = .T., ;
		Caption = "Cancel", ;
		TabIndex = 7, ;
		TerminateRead = .T., ;
		ZOrderSet = 7, ;
		Name = "cmdCancel"


	ADD OBJECT lbldouble_c5 AS label WITH ;
		FontName = "Arial", ;
		FontSize = 9, ;
		WordWrap = .T., ;
		BackStyle = 0, ;
		Caption = ("Double-Click on the Letter to Print or Use arrow keys to"), ;
		Height = 15, ;
		Left = 72, ;
		Top = 261, ;
		Width = 318, ;
		ReleaseErase = .F., ;
		TabIndex = 4, ;
		ColorSource = 4, ;
		ZOrderSet = 3, ;
		Name = "lblDouble_c5"


	ADD OBJECT lblselect_a7 AS label WITH ;
		FontName = "Arial", ;
		FontSize = 9, ;
		WordWrap = .T., ;
		Alignment = 2, ;
		BackStyle = 0, ;
		Caption = ("select and press [Enter]. "), ;
		Height = 15, ;
		Left = 68, ;
		Top = 276, ;
		Width = 327, ;
		ReleaseErase = .F., ;
		TabIndex = 5, ;
		ColorSource = 4, ;
		ZOrderSet = 4, ;
		Name = "lblSelect_a7"


	ADD OBJECT cmdok AS commandbutton WITH ;
		Top = 314, ;
		Left = 166, ;
		Height = 25, ;
		Width = 64, ;
		Caption = "OK", ;
		Default = .T., ;
		TabIndex = 6, ;
		ZOrderSet = 6, ;
		Name = "cmdOK"


	ADD OBJECT lstletter AS listbox WITH ;
		FontBold = .F., ;
		FontName = "Arial", ;
		FontSize = 9, ;
		BoundColumn = 1, ;
		ColumnCount = 2, ;
		ColumnWidths = "200,300", ;
		RowSourceType = 6, ;
		RowSource = "letter.title,descript", ;
		ControlSource = "m.letterselected", ;
		Enabled = .T., ;
		Height = 208, ;
		ColumnLines = .F., ;
		Left = 28, ;
		SpecialEffect = 0, ;
		TabIndex = 3, ;
		TerminateRead = .F., ;
		Top = 30, ;
		Width = 405, ;
		ReleaseErase = .F., ;
		ColorSource = 4, ;
		ZOrderSet = 5, ;
		Name = "lstLetter"


	PROCEDURE close
		IF THISFORM.crntdel="ON"
			SET DELETED ON
		ELSE
			SET DELETED OFF
		ENDIF

		RETURN .T.
	ENDPROC


	PROCEDURE Init
		PARAMETERS assignto

		PRIVATE ltralias, crntdel
		ltralias=ALIAS()
		crntdel = SET('DELETED')

		PRIVATE closeit
		closeit=.F.
		IF USED("letter")
			SELECT letter
			SET ORDER TO TAG TITLE
			closeit = .F.
		ELSE
			SELECT 0
			USE LETTER
			SET ORDER TO TAG TITLE
			closeit = .T.
		ENDIF

		GO TOP

		DODEFAULT()

		THISFORM.closeit = closeit
		THISFORM.assignto = assignto
		IF !EMPTY(ltralias)
			THISFORM.crntalias=ltralias
		ELSE
			THISFORM.crntalias = ''
		ENDIF
		THISFORM.crntdel=crntdel
		THISFORM.lstLetter.listindex=1
		m.letterselected=letter.title
		THISFORM.lstLetter.setfocus()
		THISFORM.lstLetter.click()
	ENDPROC

	PROCEDURE Destroy
		CLEAR EVENTS
		DODEFAULT()
	ENDPROC

	PROCEDURE QueryUnload

		thisform.close

		IF THISFORM.closeit .and. USED('letter')
			USE IN Letter
		ENDIF

		PRIVATE ltralias
		ltralias=''
		IF !EMPTY(thisform.crntalias)
			ltralias=thisform.crntalias
			IF USED(ltralias)
				SELECT (ltralias)
			ENDIF
		ENDIF

		DODEFAULT()
	ENDPROC


	PROCEDURE Release
		DODEFAULT()

		IF THISFORM.closeit .and. USED('letter')
			USE IN Letter
		ENDIF

		PRIVATE ltralias
		ltralias=''
		IF !EMPTY(thisform.crntalias)
			ltralias=thisform.crntalias
			IF USED(ltralias)
				SELECT (ltralias)
			ENDIF
		ENDIF
	ENDPROC


	PROCEDURE cmdcancel.Click
		thisform.close
		thisform.release()
	ENDPROC


	PROCEDURE cmdok.Click
		SELECT letter

		IF EMPTY(thisform.assignto)
			KEYBOARD CHR(1) + CHR(25) + letter.title+"{ENTER}"
		ELSE
			assignto = THISFORM.assignto
			&assignto = letter.title
		ENDIF

		thisform.close
		thisform.release
	ENDPROC


	PROCEDURE lstletter.KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl

		IF LASTKEY() = 13 .or. LASTKEY() = -9
			nKeyCode = 13
			nShiftAltCtrl = 0
		ENDIF

		IF nKeyCode = 13 .or. nkeyCode = -9 
			NODEFAULT
			CLEAR TYPEAHEAD
			THISFORM.cmdOK.click
		ELSE
			DODEFAULT()
		ENDIF
	ENDPROC


	PROCEDURE lstletter.DblClick
		NODEFAULT
		CLEAR TYPEAHEAD
		THIS.CLICK()
		KEYBOARD "{ENTER}" 
	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"
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform