@ ...,... listbox

Post Reply
JoaquimC
Posts: 16
Joined: Fri Feb 09, 2007 6:43 pm
Location: Porto - Portugal

@ ...,... listbox

Post by JoaquimC »

Hello,
I'm new to FiveWin and i got into trouble with listboxes:

I have a program with this code:

Code: Select all | Expand

#include "FWCE.ch"
REQUEST DBFCDX
STATIC oWnd, oBrw

function Main()
  USE ( CurDir() + "\dbfs\pedido" ) alias pedido VIA "DBFCDX"         
  desenhar_janela()
  ACTIVATE WINDOW oWnd
return nil

function desenhar_tabela()
.
.
  @ 70, 3 LISTBOX oBrw FIELDS pedido->cama HEADERS "Cama" ;
      SIZE 237, 150 pixel
.
.
return nil


where: pedido is a DBF table with a field called "cama" and 3 records on it.

I open the table in the
All seems to work fine, but all i see is the listbox space with the "Cama" header, nut no records on it.

What am i doing wrong?

Thank you,
Joaquim
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: @ ...,... listbox

Post by Richard Chidiak »

Joaquim

It is not the correct way to do it

Try to code something like the ollowing

Define window first,
Open the file
Define the listbox object
Activate the window

This is a workig sample

DEFINE WINDOW OWND1 TITLE "A Faire"
DEFINE FONT aFONT NAME "TAHOMA" SIZE 0,-12

// HideKeyboard()

@ 0, 0 LISTBOX oBrw ;
FIELDS DEPANBMP(BLEU,JAUNE,vert,rouge,blanc), ;
SUBS(TRNDATE(PKDEPAN->DATEDEP),1,5), ;
TRANSFORM(PKDEPAN->Hdeb,"@Z 99.99") , ;
GETCLI(PKDEPAN->CLIREEL) ;
HEADERS " ","Date","Heure","Client" ;
FIELDSIZES 15,40,30,150 ;
ON CLICK SHOWstat(OBRW) ;
FONT AFONT ;
COLORS CLR_BLACK, CLR_WHITE ;
SIZE GETSYSMETRICS( SM_CXSCREEN ) , GETSYSMETRICS( SM_CYSCREEN ) - 30 OF OWND1

OBRW:nClrBackHead := CLR_YELLOW // header
OBRW:nClrForeHead := CLR_HBLUE // header

ACTIVATE WINDOW OWND1 MODAL
AFONT:END()


Hth

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
JoaquimC
Posts: 16
Joined: Fri Feb 09, 2007 6:43 pm
Location: Porto - Portugal

Post by JoaquimC »

Thank you Richard, your reply was very helpful.

But the real problem was in something that i didn't said in the first post:
Before the grid was displayed, the program called a function that opened another table, and because i didn' put the clause 'new' in 'use' (i'm a VFP man - i'm used to 'use table in 0') the program opened the new table in the work area of the first table, therefore there was nothing to show.

Thank you anyway.
Joaquim
Post Reply