Listbox data browsing problem
From: Zeljko Drascic (zdrascic_at_barok.foi.hr)
Date: 09/27/04
- Next message: Anders Altberg: "Re: Syntax in VFP8"
- Previous message: Bankim Desai: "Sending Email"
- Next in thread: Mark: "RE: Listbox data browsing problem"
- Reply: Mark: "RE: Listbox data browsing problem"
- Reply: Mark: "RE: Listbox data browsing problem"
- Reply: Mark: "RE: Listbox data browsing problem"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 27 Sep 2004 13:49:59 +0200
Hello.
My current project is to transfer an 8 years old FoxPro 2.5 program from DOS
to windows.
Currently using VisualFox 7.0.
The problem is like this.
One of the tables I use has structure like this:
CODE
NAME
ADDRESS
etc...
On one of the forms I have text input field. The point is that when I enter
partially name of the customer, user is supposed to be able to browse the
table to chose the name that is the nearest to the partially typed name.
In the old program it was being don by opening new window, SEEK() was used
and then in the opened window table was browsed:
this is an example from other procedure but the principle is the same (but
it uses fewer variables and it is lot easier to read)
BTW: I did not wrote the original program, and yes, there is exactly 15
comments (code oriented) in the entire program (25000+ lines)
----------------------------------
FUNCTION brow_valuta
parameters field1
private rezultat,pojam,suma,last_area,last_pos,last_order,last_exact
last_area=SELECT()
SELECT valute
last_pos=recno()
last_order=order()
last_exact=set("EXACT")
suma=reccount()
if suma>20
suma=20
endif
seek(field1)
set exact on
if !found()
define window valute from 1,scols()-38 to 4+suma,scols()-1 ;
title " Valute " ;
footer short_msg ;
shadow close grow float zoom ;
minimize color scheme 10
push key clear
on key label enter release window valute
on key label ctrl+enter do un_valuta with .t.
do while .t.
activate window valute
browse fields sifra :H="Oznaka" , ;
tecaj :H="TeĽaj" ;
noappend nomodify nomenu in window valute
deactivate window valute
if lastkey()=27
rezultat=.f.
exit
else
field1=sifra
rezultat=.t.
exit
endif
enddo
pop key
else
rezultat=.t.
field1=sifra
endif
release window valute
set order to tag (last_order)
if last_exact="ON"
set exact on
else
set exact off
endif
scatter memvar
tecaj1=m.tecaj
SELECT (last_area)
release suma,last_area,last_pos,last_order,last_exact
RETURN rezultat
-------
in new project i tried to do the same thing using one text input filed and
LISTBOX.
at the begining:
List box source is a table with addreses and
LISTBOX.Visible=.f.
when i type partial name, press ENTER, i set
-----------------------------------
SELECT SYSTEM_USERS
SET NEAR ON
SET EXACT ON
SET ORDER TO 9 * (name of the user)
seek_data = ALLTRIM(thisform.txt_name_naziv.Value)
SEEK(seek_data)
thisform.lst_users.Visible = .T.
thisform.lst_users.Refresh
-----------------------------------
data has been found (nearest of them) but the listbox is still focused at
the beginig of the table.
Question: RECNO() shows that data has been found and i would like to know
how can i focus listbox to show me data i received from SEEK()
EXAMPLE
table:
ALISON DANIELS
ANTHONY AARDWARK
ARETHA MULLER
*
*
*
MARTIN ALLI
MARTIN LANGLEY
MARTIN LONGLEY
MARTIN LUTHER
MARTIN BEEF
MARTINA SORENSON
*
*
*
YITZAK FRESHMAN
ZDRAVKO BUBALO
seek_data= "MARTIN L"
RECNO() pinpoints at MARTIN LANGLEY and that is ok.
but listbox shows:
--------------------------- <- listbox border
ALISON DANIELS
ANTHONY AARDWARK
ARETHA MULLER
*
*
*
---------------------------
*
*
MARTIN ALLI
MARTIN LANGLEY <- seek() data,
MARTIN LONGLEY
MARTIN LUTHER
MARTIN BEEF
MARTINA SORENSON
*
*
*
YITZAK FRESHMAN
ZDRAVKO BUBALO
And i would like that listbox shows:
ALISON DANIELS
ANTHONY AARDWARK
ARETHA MULLER
*
*
*
MARTIN ALLI
--------------------------- <- listbox border
MARTIN LANGLEY <- seek() data,
MARTIN LONGLEY
MARTIN LUTHER
MARTIN BEEF
MARTINA SORENSON
---------------------------
*
*
*
YITZAK FRESHMAN
ZDRAVKO BUBALO
Thank you very much and sorry for all of the explanation but wanted to be
sure that question is set in the understandable way since my English is
insufficient for this kind of conversation
- Next message: Anders Altberg: "Re: Syntax in VFP8"
- Previous message: Bankim Desai: "Sending Email"
- Next in thread: Mark: "RE: Listbox data browsing problem"
- Reply: Mark: "RE: Listbox data browsing problem"
- Reply: Mark: "RE: Listbox data browsing problem"
- Reply: Mark: "RE: Listbox data browsing problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|