DBCOMBO class problem ?

Post Reply
Milan Mehta
Posts: 115
Joined: Mon Oct 17, 2005 4:42 am
Location: India

DBCOMBO class problem ?

Post by Milan Mehta »

Hello,

Should the table being used be set to any specific active index

tag ? If yes, to ListField index or ItemField Index ?

I am gettig quite strange result with it.

Here is the small example demonstrating the same.

In this example, selecting 'ABC' should return 1 instead it returns 2,
selecting 'XYZ' should return 2 instead it returns 2 ,
selecting 'DEF' returns correctly 3.

Please help

Milan.

----------------Prg------------------------
# include "fivewin.ch"
# INCLUDE "dbcombo.ch"

#define PBSEARCHOK 10121
#define CBDIARY 10122

PROCEDURE Main
LOCAL oDlg, oMiscInfo, cMiscInfo
LOCAL oDlgSearch, oVno, nVno, nRecNo

Cret_Table()

SELE 0
USE Test
appe blank
REPLACE VNO WITH 1, NAME WITH 'ABC'
appe blank
REPLACE VNO WITH 2, NAME WITH 'XYZ'
appe blank
REPLACE VNO WITH 3, NAME WITH 'DEF'

INDEX ON VNO TAG VNO
INDEX ON NAME TAG NAME

DEFINE DIALOG oDlgSearch RESOURCE "Search"

nVno := Test->VNO

Select Test
Set ORDER TO TAG name

REDEFINE DBCOMBO oVno VAR nVno ID CBDIARY OF oDlgSearch ;
ALIAS "Test" ;
ITEMFIELD "VNO" ;
LISTFIELD "NAME"

REDEFINE BUTTON ID PBSEARCHOK OF oDlgSearch ACTION

oDlgSearch:END()

ACTIVATE DIALOG oDlgSearch

msginfo (nvno)

return

PROCEDURE Cret_Table
LOCAL aDbf := { { "VNO" , "N", 5, 0 },;
{ "NAME" , "C", 40, 0 }}
DBCREATE ('test', aDbf)
RETURN
----------------End Prg--------------------

------------------Rc-----------------------
#define PBSEARCHOK 10121
#define CBDIARY 10122

Search DIALOG 18, 25, 266, 190
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |

WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
CAPTION "Search Name"
FONT 8, "MS Sans Serif"
{
COMBOBOX CBDIARY, 20, 19, 227, 143, CBS_DROPDOWNLIST |

WS_TABSTOP
PUSHBUTTON "&Ok", PBSEARCHOK, 109, 170, 50, 14
}
------------------End Rc-------------------
Post Reply