Listbox data browsing problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Zeljko Drascic (zdrascic_at_barok.foi.hr)
Date: 09/27/04


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



Relevant Pages

  • RE: Listbox data browsing problem
    ... > In the old program it was being don by opening new window, ... > on key label enter release window valute ... > data has been found but the listbox is still focused at ... > MARTIN LANGLEY ...
    (microsoft.public.fox.programmer.exchange)
  • Re: popup to same window
    ... "Martin Walke" wrote: ... > Hi Pete, ... >> javascript but something is happenng within the application as the window ... You do say though that it works without the query string. ...
    (microsoft.public.scripting.jscript)
  • Re: Reporter flooded with colourtrans message
    ... > In article, Martin ... If there is a displayed JPEG (in a window or the Pinboard backdrop) then ...
    (comp.sys.acorn.apps)
  • RE: Listbox data browsing problem
    ... CREATE CURSOR curdemo (fruit C(15)) ... > set exact on ... > MARTIN LANGLEY ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Open a Powerpoint file in different windows
    ... You can also select Window>Arrange All and widen the Powerpoint window to ... "Martin" wrote: ... >> window across multiple screens, open two files and go to Windows> Arrange All. ...
    (microsoft.public.powerpoint)