I have compiled successfully all my application in 13.09 fwh / xharbour. But the below function is not working properly and also Windows OS stops to my application.
The function is written for LOV incremental search. Its works fine in 12.08 but not latest version 13.09. Please let me know where the code is not correct. Thanks in advance..!
- Code: Select all Expand view
FUNCTION mySQLLov( oGet , aGF , aGV )
LOCAL oLovBrw
LOCAL nWnd_H := ( LST_CHARPIX_H * 15 )
LOCAL nTop := oGet:xnTop
LOCAL nLeft := oGet:xnLeft
LOCAL nRight := oGet:xnRight
LOCAL nBottom := oGet:xnBottom
LOCAL cKeyID
LOCAL nLovHight
LOCAL nLovWidth
LOCAL oLovWnd
LOCAL oQry
LOCAL j
aGCoors := GetWndRect( oGet:hWnd )
nTop := aGCoors[ 1 ] + ( ( aGCoors[ 3 ] - aGCoors[ 1 ] ) + 1 )
nLeft := aGCoors[ 2 ]
nBottom := aGCoors[ 3 ] + ( ( aGCoors[ 3 ] - aGCoors[ 1 ] ) * oGet:xnRows2Display )
nRight := aGCoors[ 4 ]
nLovHight := ( nBottom - nTop ) / 2
nLovWidth := ( nRight - nLeft ) / 2
//msgalert( oGet:xcQry )
oQry := oApp:gDBServer:Query( oGet:xcQry )
DEFINE DIALOG oLovWnd FROM nTop , nLeft TO nBottom, nRight STYLE nOr( DS_MODALFRAME, WS_POPUP ) PIXEL
@ 0 , 0 XBROWSE oLovBrw SIZE nLovWidth, nLovHight PIXEL ;
OF oLovWnd FONT oApp:oFontBrw1 ;
COLUMNS oGet:xaCols;
OBJECT oQry AUTOSORT
//HEADERS oGet:xaHeaders ;
oLovBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
//oLovBrw:nColDividerStyle := LINESTYLE_BLACK
//oLovBrw:nRowDividerStyle := LINESTYLE_BLACK
//oLovBrw:bClrSelFocus := { || { nRGB( 250, 145, 30 ), nRGB( 100, 0, 0 ) } }
oLovBrw:bClrSelFocus := { || { nRGB( 255, 255, 255 ) , nRGB( 0, 0, 160 ) } }
//oLovBrw:bClrStd := { || { CLR_BLACK, IIf( oQry:RecNo() % 2 == 0, nRGB( 193, 221, 255 ), nRGB( 221, 245, 255 ) ) } }
oLovBrw:bChange := { || ( oGet:cText( oLovBrw:cSeek ) ) }
oLovBrw:bKeyChar := { | n, f | IIf( n == VK_RETURN , ( oGet:cText( AllTrim( ( oQry:FieldGet( oGet:xuGetField ) ) ) ), oLovWnd:END() ) , NIL ) }
oLovBrw:lHeader := .F.
oLovBrw:lFooter := .F.
oLovBrw:lHScroll := .F.
oLovBrw:lRecordSelector := .F.
oLovBrw:cSeek := AllTrim( oGet:cText() )
oQry:Seek( Upper( AllTrim( oGet:cText() ) ) , oGet:xuGetField , , ,.T. )
oLovBrw:CreateFromCode()
oLovWnd:oClient := oLovBrw
ACTIVATE DIALOG oLovWnd ON INIT ( oLovBrw:SetFocus() )
cKeyID := oQry:FieldGet( oGet:xuKeyField )
IF aGF != NIL .AND. aGV != NIL
FOR j := 1 TO Len(aGF)
AAdd(aGV, oQry:FieldGet( aGF[j] ) )
NEXT
ENDIF
oQry:END()
oGet:oWnd:GoNextCtrl( oGet:hWnd ) // Move NEXT Control
RETURN cKeyID[code]
// CALLING SAMPLE IN THE GET
#xtranslate :xnTop => :cargo\[1\]
#xtranslate :xnLeft => :cargo\[2\]
#xtranslate :xnRight => :cargo\[3\]
#xtranslate :xnBottom => :cargo\[4\]
#xtranslate :xcQry => :cargo\[5\]
#xtranslate :xuGetField => :cargo\[6\]
#xtranslate :xuKeyField => :cargo\[7\]
#xtranslate :xaCols => :cargo\[8\]
#xtranslate :xaHeaders => :cargo\[9\]
#xtranslate :xnRows2Display => :cargo\[10\]
#define LOV_NUM_IVARS 11
#define ALOV {0,0,20,40,"",1,2,{},{},15}
@ 140, 120 GET aoGET[ AI_IGRP_NAME ] VAR AD_IGRP_NAME SIZE 275, C_GETH PICTURE "@!" PIXEL OF oWnd ;
NOBORDER COLOR C_FCLR, C_BCLR FONT oApp:oFontGet UPDATE
//------------------------------------------------------------------------------
// Lov Gets
//------------------------------------------------------------------------------
aoGET[ AI_IGRP_NAME ]:cargo := ALOV
aoGET[ AI_IGRP_NAME ]:bWhen := { || IIf( aoGET[ AI_IGRP_NAME ]:SelectAll() = NIL, .T., .T. ) }
// FUNCTION CALLED HERE **************************************************************************
aoGET[ AI_IGRP_NAME ]:bChange := { | n, f | AD_IGRP_ID := mySQLLov( aoGET[ AI_IGRP_NAME ] ) }
// FUNCTION CALLED HERE **************************************************************************
aoGET[ AI_IGRP_NAME ]:bValid := { || ! Empty( aoGET[ AI_IGRP_NAME ]:cText() ) } //.AND. GetCustAreaInfo( aoGET[ 4 ] ) ) }
aoGET[ AI_IGRP_NAME ]:xnRight := 15
aoGET[ AI_IGRP_NAME ]:xnBottom := 50
aoGET[ AI_IGRP_NAME ]:xnRows2Display := 15
aoGET[ AI_IGRP_NAME ]:xcQry := "SELECT igrp_name, igrp_id FROM "+TBL_IGRP+" ORDER BY igrp_name ASC"
aoGET[ AI_IGRP_NAME ]:xaCols := { "igrp_name" }
aoGET[ AI_IGRP_NAME ]:xaHeaders := { "List Of Item Groups" }
aoGET[ AI_IGRP_NAME ]:xuGetField := "igrp_name"
aoGET[ AI_IGRP_NAME ]:xuKeyField := "igrp_id"
[/code]