Using ListBox
Using ListBox
Hi,
I'm trying to use ListBox, to show just those fields matching a predefined
condition, like:
"MasLoad->Manifest == cManifest .and. MasLoad->TalyFlag"
where Manifest is C
and TalyFlag is L
I was trying: SELECT <cField> FOR <uValue1> [ TO <uValue2>]
But I'm doing something wrong.
*. Is there a way to use something like AChoice()?
*. Is there a picklist that does an incremental search as letters are entered?
Thanks,
Moshe Yarden
I'm trying to use ListBox, to show just those fields matching a predefined
condition, like:
"MasLoad->Manifest == cManifest .and. MasLoad->TalyFlag"
where Manifest is C
and TalyFlag is L
I was trying: SELECT <cField> FOR <uValue1> [ TO <uValue2>]
But I'm doing something wrong.
*. Is there a way to use something like AChoice()?
*. Is there a picklist that does an incremental search as letters are entered?
Thanks,
Moshe Yarden
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Moshe,
> I was trying: SELECT <cField> FOR <uValue1> [ TO <uValue2>]
In order to use that clause, you need to have an index built with the expression to be searched.
Alternatively you can use OrdScope() to set a top and bottom range in the database. Please do a search in these forums for "OrdScope", thanks
> I was trying: SELECT <cField> FOR <uValue1> [ TO <uValue2>]
In order to use that clause, you need to have an index built with the expression to be searched.
Alternatively you can use OrdScope() to set a top and bottom range in the database. Please do a search in these forums for "OrdScope", thanks
Last edited by Antonio Linares on Thu Sep 18, 2008 12:01 pm, edited 1 time in total.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Here you have an example:
Code: Select all
DbSelectArea( "bp" )
bp->( OrdSetFocus( "bpopen" ) ) // it's a conditional index created with FOR ...
bp->( ordScope( 0, topValue ) )
bp->( ordScope( 1, bottomValue ) )
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Moshe,
Regarding the SELECT clause here you have an example from FWH:
Nombre is a field name. "Laureano" is the top value and "Paco" is the bottom value. The index has to use Nombre as the key.
Regarding the SELECT clause here you have an example from FWH:
Code: Select all
@ 1, 1 LISTBOX oLbx FIELDS aHBitmaps[ Max( 1, Clientes->Nivel ) ],;
Clientes->Nombre, Clientes->Direccion,;
Clientes->Telefono, ;
Str( Clientes->Edad, 3 ) ;
HEADERS "Lev.", "Name", "Address", "Phone", "Age" ;
FIELDSIZES 34, 240, 310, 114, 24 ;
SELECT Nombre FOR "Laureano" TO "Paco" ;
SIZE 284, 137 OF oDlg
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg, oBrw
LOCAL aArray := { { "Test1_1", "Test1_2" },;
{ "Test2_1", "Test2_2" },;
{ "Test3_1", "Test3_2" } }
LOCAL nCur := 1
DEFINE DIALOG oDlg;
TITLE "Browsing array";
SIZE 800, 600
@ 0, 0 LISTBOX oBrw FIELDS IF( EMPTY( aArray ), "", aArray[ nCur, 1 ] ),;
IF( EMPTY( aArray ), "", aArray[ nCur, 2 ] );
SIZE 200, 200;
HEADERS "Test1", "Test2"
oBrw:bLogicLen = { || Len( aArray ) }
oBrw:bGoTop = { || nCur := 1 }
oBrw:bGoBottom = { || nCur := Len( aArray ) }
oBrw:bSkip = { | nSkip | Skipper( aArray, @nCur, nSkip ) }
oBrw:cAlias = "ARRAY"
ACTIVATE DIALOG oDlg;
ON INIT oDlg:SetControl( oBrw );
CENTER
RETURN NIL
STATIC FUNCTION SKIPPER( aArray, nCur, nSkip )
LOCAL nOld := nCur
nCur += nSkip
IF nCur > LEN( aArray ); nCur = LEN( aArray ); ENDIF
IF nCur < 1; nCur = 1; ENDIF
RETURN nCur - nOld
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Antonio and EMG,
Thanks.
With: SELECT Nombre FOR "Laureano" TO "Paco"
Can the SELECT / FOR be with more than one field?
like: FistName + FamilyName
I was trying EMG's example for arrays. It works good.
My problem is with the multi dimensional array filled from a data base. I'm trying the enclosed code and receive error:
LOCAL aArray := { {}, {}, {} }
LOCAL nCur := 1
LOCAL oWnd, oBrw
//
DO WHILE !MasLoad->( EOF() )
AADD( aArray[1], MasLoad->ContNumber )
AADD( aArray[2], Str( MasLoad->ContSize, 2 ) )
AADD( aArray[3], MasLoad->ContKind )
MasLoad->( dbSkip() )
ENDDO
DEFINE WINDOW oWnd TITLE "Status "
@ 1, 1 LISTBOX oBrw FIELDS;
IF( EMPTY( aArray ), "", aArray[ nCur, 1 ] ),;
IF( EMPTY( aArray ), "", aArray[ nCur, 2 ] ),;
IF( EMPTY( aArray ), "", aArray[ nCur, 3 ] );
HEADERS "Container", "Size", "Type" ;
SIZE 220, 167
oBrw:bLogicLen = { || Len( aArray ) }
oBrw:bGoTop = { || nCur := 1 }
oBrw:bGoBottom = { || nCur := Len( aArray ) }
oBrw:bSkip = { | nSkip | Skipper( aArray, @nCur, nSkip ) }
oBrw:cAlias = "ARRAY"
@ 12, 2 BUTTON "Dlg" SIZE 80, 30 ACTION MsgInfo( aArray[ nCur, 1 ] )
@ 12,17 BUTTON "Done" SIZE 80, 30 ACTION oWnd:End()
ACTIVATE WINDOW oWnd ON CLICK MsgInfo( "Click!" )
Thanks,
Moshe Yarden
Thanks.
With: SELECT Nombre FOR "Laureano" TO "Paco"
Can the SELECT / FOR be with more than one field?
like: FistName + FamilyName
I was trying EMG's example for arrays. It works good.
My problem is with the multi dimensional array filled from a data base. I'm trying the enclosed code and receive error:
LOCAL aArray := { {}, {}, {} }
LOCAL nCur := 1
LOCAL oWnd, oBrw
//
DO WHILE !MasLoad->( EOF() )
AADD( aArray[1], MasLoad->ContNumber )
AADD( aArray[2], Str( MasLoad->ContSize, 2 ) )
AADD( aArray[3], MasLoad->ContKind )
MasLoad->( dbSkip() )
ENDDO
DEFINE WINDOW oWnd TITLE "Status "
@ 1, 1 LISTBOX oBrw FIELDS;
IF( EMPTY( aArray ), "", aArray[ nCur, 1 ] ),;
IF( EMPTY( aArray ), "", aArray[ nCur, 2 ] ),;
IF( EMPTY( aArray ), "", aArray[ nCur, 3 ] );
HEADERS "Container", "Size", "Type" ;
SIZE 220, 167
oBrw:bLogicLen = { || Len( aArray ) }
oBrw:bGoTop = { || nCur := 1 }
oBrw:bGoBottom = { || nCur := Len( aArray ) }
oBrw:bSkip = { | nSkip | Skipper( aArray, @nCur, nSkip ) }
oBrw:cAlias = "ARRAY"
@ 12, 2 BUTTON "Dlg" SIZE 80, 30 ACTION MsgInfo( aArray[ nCur, 1 ] )
@ 12,17 BUTTON "Done" SIZE 80, 30 ACTION oWnd:End()
ACTIVATE WINDOW oWnd ON CLICK MsgInfo( "Click!" )
Thanks,
Moshe Yarden
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact: