Discussion:
list box
(too old to reply)
sherry
2010-04-14 20:42:06 UTC
Permalink
can a search be done on a listbox control?
Rush Strong
2010-04-14 21:15:00 UTC
Permalink
Post by sherry
can a search be done on a listbox control?
Does the IncrementalSearch help?

- Rush
sherry
2010-04-15 12:30:07 UTC
Permalink
no
I only get the first letter, and all records have the same letter.
thanks
Post by Rush Strong
Post by sherry
can a search be done on a listbox control?
Does the IncrementalSearch help?
- Rush
.
Beverly Howard
2010-04-15 13:48:39 UTC
Permalink
Learning from this question as well and thinking out loud...

"TopIndex" perhaps? Seems like it would be possible to assign a method
to <rightclick> to run whatever search you wanted, then set
form.object.topindex and refresh

Also setting "Sorted" should then keep close matches together.

Beverly Howard
Bernhard Sander
2010-04-15 14:29:38 UTC
Permalink
Hi sherry,
Post by sherry
no
I only get the first letter, and all records have the same letter.
With IncrementalSearch you should get more than only the first letter.
Maybe you are typing too slowly. Then have a look at _INCSEEK variable in help.

Regards
Bernhard Sander
Villi Bernaroli
2010-04-15 15:17:07 UTC
Permalink
Post by Bernhard Sander
Post by sherry
no
I only get the first letter, and all records have the same letter.
With IncrementalSearch you should get more than only the first letter.
Maybe you are typing too slowly. Then have a look at _INCSEEK
variable in help.
They finally made a separate variable instead of depending on the windows
setting for typing/mouse double click? Wonderful! Last time I checked it I
was using VFP5 and it was horrible.
--
Villi Bernaroli, Italy
VFP, SOAP, MS SQLserver, MySQL, Oracle
sherry
2010-04-20 15:20:01 UTC
Permalink
Let's try something different.
I have 2 txt boxes, on lost focus of #2 I want to do a locate for the info
in the 2 boxes. This sort of works. I locates the record in the table, but
the listbox doesn't go to that record. I know my coding is wrong but don't
know what to put.

Thanks
Help need to be specific and detailed please.

Sherry
Post by Rush Strong
Post by sherry
can a search be done on a listbox control?
Does the IncrementalSearch help?
- Rush
.
Rush Strong
2010-04-20 17:44:47 UTC
Permalink
Not to be snide, but we need more "specific and detailed" info about
your code.

Have you used the Class Browser to view your form as code? If so,
please copy and post the sections relating to your controls. If
you're not familiar with the Class Browser, then learn it! It is a
very useful tool.

In brief:
- Open the Class Browser from the Tools menu;
- Use the "File Open" icon to Open your form (select "Form" under
the "Files of type");
- Click the "View class code" button;
- Copy and paste.

[Note: the code you view may be able to create a simple form, but it
will fail for most cases. It is intended only for review, though it
can be modified to run. If you want to properly appreciate the GUI,
consider that this is how you'd create a form from code.]

- Rush
Post by sherry
Let's try something different.
I have 2 txt boxes, on lost focus of #2 I want to do a locate for the info
in the 2 boxes. This sort of works. I locates the record in the table, but
the listbox doesn't go to that record. I know my coding is wrong but don't
know what to put.
Thanks
Help need to be specific and detailed please.
Sherry
Post by Rush Strong
Post by sherry
can a search be done on a listbox control?
Does the IncrementalSearch help?
- Rush
.
sherry
2010-04-20 20:02:01 UTC
Permalink
************************************
*PROCEDURE text4.LostFocus IS WHERE i GET LOST

**********************

PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


**************************************************
*-- Form: form1 (q:\pncommadvice\pnadvice.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 04/20/10 11:11:08 AM
*
DEFINE CLASS form1 AS form


Height = 470
Width = 1047
DoCreate = .T.
AutoCenter = .T.
Caption = "Form1"
WindowState = 0
BackColor = RGB(255,156,108)
Name = "Form1"


ADD OBJECT label1 AS label WITH ;
FontBold = .T., ;
FontSize = 11, ;
BackStyle = 0, ;
Caption = "TO PUT ADVICE NUMBERS INTO 'SLSPNPAY.DBF'", ;
Height = 24, ;
Left = 50, ;
Top = 24, ;
Width = 396, ;
TabIndex = 7, ;
Name = "Label1"


ADD OBJECT command2 AS commandbutton WITH ;
Top = 192, ;
Left = 384, ;
Height = 37, ;
Width = 49, ;
FontBold = .T., ;
Picture = "..\close.bmp", ;
Caption = "EXIT", ;
TabIndex = 6, ;
Name = "Command2"


ADD OBJECT line1 AS line WITH ;
Height = 228, ;
Left = 36, ;
Top = 12, ;
Width = 0, ;
Name = "Line1"


ADD OBJECT line4 AS line WITH ;
Height = 0, ;
Left = 38, ;
Top = 12, ;
Width = 442, ;
Name = "Line4"


ADD OBJECT text1 AS textbox WITH ;
FontBold = .T., ;
FontSize = 10, ;
Value = "", ;
ControlSource = "LCADVICE", ;
Format = "R", ;
Height = 32, ;
InputMask = "", ;
Left = 192, ;
TabIndex = 1, ;
Top = 85, ;
Width = 109, ;
Name = "Text1"


ADD OBJECT label2 AS label WITH ;
FontBold = .T., ;
FontSize = 10, ;
BackStyle = 0, ;
Caption = "ENTER FIRST ADVICE NUMBER", ;
Height = 25, ;
Left = 149, ;
Top = 61, ;
Width = 204, ;
TabIndex = 8, ;
Name = "Label2"


ADD OBJECT label3 AS label WITH ;
FontBold = .T., ;
FontSize = 10, ;
BackStyle = 0, ;
Caption = "CHECK DATE", ;
Height = 25, ;
Left = 204, ;
Top = 151, ;
Width = 84, ;
TabIndex = 9, ;
Name = "Label3"


ADD OBJECT text2 AS textbox WITH ;
Alignment = 3, ;
Value = {}, ;
ControlSource = "ldpayckdate", ;
Format = "", ;
Height = 32, ;
InputMask = "", ;
Left = 192, ;
TabIndex = 2, ;
Top = 184, ;
Width = 109, ;
Name = "Text2"


ADD OBJECT line5 AS line WITH ;
Height = 0, ;
Left = 36, ;
Top = 240, ;
Width = 444, ;
Name = "Line5"


ADD OBJECT line2 AS line WITH ;
Height = 228, ;
Left = 480, ;
Top = 12, ;
Width = 0, ;
Name = "Line2"


ADD OBJECT text3 AS textbox WITH ;
Value = "", ;
ControlSource = "lcsearch", ;
Format = "R", ;
Height = 25, ;
InputMask = "#########", ;
Left = 151, ;
TabIndex = 4, ;
Top = 312, ;
Width = 109, ;
Name = "Text3"


ADD OBJECT label4 AS label WITH ;
FontBold = .T., ;
FontSize = 10, ;
BackStyle = 0, ;
Caption = "TO SEARCH...ENTER ACCOUNT NUMBER AND REG NUMBER", ;
Height = 25, ;
Left = 59, ;
Top = 264, ;
Width = 384, ;
Name = "Label4"


ADD OBJECT list1 AS listbox WITH ;
BoundColumn = 2, ;
ColumnCount = 5, ;
ColumnWidths = "54,93,25,81,60", ;
RowSourceType = 6, ;
RowSource = "slspnpay.payreg,payacct,payfreests,payckno,payckdt", ;
FirstElement = 1, ;
Height = 446, ;
Left = 516, ;
NumberOfElements = 0, ;
SpecialEffect = 1, ;
TabIndex = 3, ;
Top = 12, ;
Width = 469, ;
Name = "List1"


ADD OBJECT text4 AS textbox WITH ;
Alignment = 3, ;
Value = 0, ;
ControlSource = "lnreg", ;
Format = "R", ;
Height = 25, ;
InputMask = "####", ;
Left = 283, ;
TabIndex = 5, ;
Top = 312, ;
Width = 73, ;
Name = "Text4"


PROCEDURE command2.Click

CLOSE ALL
CLEAR EVENTS
QUIT
ENDPROC


PROCEDURE list1.DblClick
REPLACE SLSPNPAY.PAYFREESTS WITH 'D'
REPLACE SLSPNPAY.PAYCKNO WITH 'DD'+PADL(ALLTRIM(LCADVICE), 8, '0')
REPLACE SLSPNPAY.PAYCKDT WITH LDPAYCKDATE


SET DECIMALS TO 0
LCADVICE=VAL(LCADVICE)+1
LCADVICE=TRANSFORM(LCADVICE)
THISFORM.Refresh
ENDPROC


PROCEDURE text4.LostFocus
LOCATE FOR slspnpay.PAYACCT=LCSEARCH AND slspnpay.PAYREG=LNREG

ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Post by Rush Strong
Not to be snide, but we need more "specific and detailed" info about
your code.
Have you used the Class Browser to view your form as code? If so,
please copy and post the sections relating to your controls. If
you're not familiar with the Class Browser, then learn it! It is a
very useful tool.
- Open the Class Browser from the Tools menu;
- Use the "File Open" icon to Open your form (select "Form" under
the "Files of type");
- Click the "View class code" button;
- Copy and paste.
[Note: the code you view may be able to create a simple form, but it
will fail for most cases. It is intended only for review, though it
can be modified to run. If you want to properly appreciate the GUI,
consider that this is how you'd create a form from code.]
- Rush
Post by sherry
Let's try something different.
I have 2 txt boxes, on lost focus of #2 I want to do a locate for the info
in the 2 boxes. This sort of works. I locates the record in the table, but
the listbox doesn't go to that record. I know my coding is wrong but don't
know what to put.
Thanks
Help need to be specific and detailed please.
Sherry
Post by Rush Strong
Post by sherry
can a search be done on a listbox control?
Does the IncrementalSearch help?
- Rush
.
.
Dan Freeman
2010-04-20 20:08:51 UTC
Permalink
Post by sherry
************************************
*PROCEDURE text4.LostFocus IS WHERE i GET LOST
**********************
What should happen? You don't have any controls bound to the underlying
data.

Locate for ......

&& and then what?

Dan
sherry
2010-04-21 02:33:01 UTC
Permalink
and then I want it to locate that record in the listbox . It locates it in
the table but doesn't refresh it in the listbox. What code do I need to
accomplish this.
Post by Dan Freeman
Post by sherry
************************************
*PROCEDURE text4.LostFocus IS WHERE i GET LOST
**********************
What should happen? You don't have any controls bound to the underlying
data.
Locate for ......
&& and then what?
Dan
.
Dan Freeman
2010-04-21 06:19:03 UTC
Permalink
There's no such thing as "record in the listbox". The listbox is bound
to a table. Move the record pointer in the table, and the listbox
selection should follow along.

Try Listbox.SetFocus() to visually refresh the listbox to show the
current record position.

Dan
Post by sherry
and then I want it to locate that record in the listbox . It locates it in
the table but doesn't refresh it in the listbox. What code do I need to
accomplish this.
Post by Dan Freeman
Post by sherry
************************************
*PROCEDURE text4.LostFocus IS WHERE i GET LOST
**********************
What should happen? You don't have any controls bound to the underlying
data.
Locate for ......
&& and then what?
Dan
.
Loading...