Vous êtes sur la page 1sur 5

*form1.

Init
*object : form1 Procedure : Init
IF fontmetric(1, 'MS Sans Serif', 8, '') # 13 OR ;
fontmetric(4, 'MS Sans Serif', 8, '') # 2 OR ;
fontmetric(6, 'MS Sans Serif', 8, '') # 5 OR ;
fontmetric(7, 'MS Sans Serif', 8, '') # 11
this.setall('fontname', 'Tahoma')
ELSE
this.setall('fontname','MS Sans Serif')
ENDIF
this.setall('fontsize',8)
***********************************************************************************
***************
*form1.Activate
*object :form1 Procedure :Activate
THIS.c_solutions1.saveHelp
***********************************************************************************
***************
*form1.Deactivate
object : form1 Procedure : Deactivate

IF TYPE("THIS.c_solutions1") = "O" THEN


THIS.c_solutions1.restoreHelp
ENDIF

***********************************************************************************
****************
**form1.resetcombos
** object = form1 procedure = resetcombos
*-Start------------------------------------------------------------------*
PARAMETER oCboName
DO CASE
CASE UPPER(oCboName.Name) = "CBOCOMBO"
THIS.cboDrop.Value = ""
THIS.cboIntSearch.Value = ""
CASE UPPER(oCboName.Name) = "CBODROP"
THIS.cboCombo.Value = ""
THIS.cboIntSearch.Value = ""
CASE UPPER(oCboName.Name) = "CBOINTSEARCH"
THIS.cboDrop.Value = ""
THIS.cboCombo.Value = ""
ENDCASE
*----------------------------------------------------End----------------*
*Combobox Select
*This combo box allows you to enter the first few characters of a country . Tthe
*first country to match is displayed below
*cboCombo properties - lookup.scx
DisplayCount = 0
DisplayValue = cboCombo
GotFocus (User Procedure )
Inputmask ="XXXXXXXXXXXXXXXXXXXX"
InteractiveChange(User Procedure)
Keypress (User Procedure)
LostFocus (User Procedure)
Name = cboCombo
RowSource = "All"
RowSourceType = 2-Value
SelectonEntry = .T. - True
Value = =SPACE(15)
***********************************************************************************
*****
*-Start------------------------------------------------------------------*
form1.Deactivate
object : form1 Procedure :Deactivate
IF TYPE("THIS.c_solutions1") = "O" THEN
THIS.c_solutions1.restoreHelp
ENDIF

*----------------------------------------------------End----------------*
form1.Init
Object : form1 Procedure : Init
IF fontmetric(1, 'MS Sans Serif', 8, '') # 13 OR ;
fontmetric(4, 'MS Sans Serif', 8, '') # 2 OR ;
fontmetric(6, 'MS Sans Serif', 8, '') # 5 OR ;
fontmetric(7, 'MS Sans Serif', 8, '') # 11
this.setall('fontname', 'Tahoma')
ELSE
this.setall('fontname','MS Sans Serif')
ENDIF
this.setall('fontsize',8)
**********************************************************************************
*-Start------------------------------------------------------------------*
form1.resetcombos
Object : form1 Procedure : resetcombos
PARAMETER oCboName
DO CASE
CASE UPPER(oCboName.Name) = "CBOCOMBO"
THIS.cboDrop.Value = ""
THIS.cboIntSearch.Value = ""
CASE UPPER(oCboName.Name) = "CBODROP"
THIS.cboCombo.Value = ""
THIS.cboIntSearch.Value = ""
CASE UPPER(oCboName.Name) = "CBOINTSEARCH"
THIS.cboDrop.Value = ""
THIS.cboCombo.Value = ""
ENDCASE

*----------------------------------------------------End----------------*
form1
BorderStyle = 3-Sizable(Default)
Caption : Add New Items to a Combo Box

*-Start------------------------------------------------------------------*
*cboIntSearch.LostFocus
*Object : cboIntSearch Procedure : LostFocus

LOCAL cDisplayValue,cSqlStr,cCountryName
cDisplayValue = ALLTRIM(THIS.DisplayValue)
THIS.SelLength = 0
IF EMPTY(m.cDisplayValue)
RETURN
ENDIF

THISFORM.LockScreen = .T.

IF THIS.Value = "(All)"
SELECT country AS location,* FROM CUSTOMER INTO CURSOR Custs
thisform.grdcust.recordsource = "Custs"
ELSE
SELECT country AS location,* FROM CUSTOMER ;
WHERE UPPER(ALLTRIM(Customer.Country)) = UPPER(m.cDisplayValue);
INTO CURSOR Custs
thisform.grdcust.recordsource = "Custs"
IF _TALLY #0
cCountryName = ALLTRIM(Custs.Country)
IF ATC(m.cCountryName,THIS.RowSource) = 0 AND !EMPTY(m.cCountryName)
THIS.RowSource=THIS.RowSource+","+m.cCountryName
ENDIF
THIS.Value = m.cCountryName
ENDIF
ENDIF
THISFORM.ResetCombos(THIS)
THISFORM.LockScreen = .F.
*----------------------------------------------------End----------------*
*-Start------------------------------------------------------------------*
form1.resetcombos
Object : form1 Procedure : resetcombos
PARAMETER oCboName
DO CASE
CASE UPPER(oCboName.Name) = "CBOCOMBO"
THIS.cboDrop.Value = ""
THIS.cboIntSearch.Value = ""
CASE UPPER(oCboName.Name) = "CBODROP"
THIS.cboCombo.Value = ""
THIS.cboIntSearch.Value = ""
CASE UPPER(oCboName.Name) = "CBOINTSEARCH"
THIS.cboDrop.Value = ""
THIS.cboCombo.Value = ""
ENDCASE
*----------------------------------------------------End----------------*
*-Start------------------------------------------------------------------*
cboDrop.Init
Object : cboDrop Procedure : Init
#DEFINE ALLCOUNTRY_LOC "(All)"
this.clear
this.additem(ALLCOUNTRY_LOC)

LOCAL aCountries,cCountry
DIMENSION aCountries[1]

SELECT distinct country FROM CUSTOMER INTO array aCountries

FOR EACH m.cCountry IN aCountries


IF !EMPTY(m.cCountry)
this.additem(m.cCountry)
ENDIF
ENDFOR

THIS.VALUE = ALLCOUNTRY_LOC
*----------------------------------------------------End----------------*
*-Start------------------------------------------------------------------*
cboDrop.InteractiveChange
Object : cboDrop Procedure : InteractiveChange

LOCAL cDisplayValue
THISFORM.LockScreen = .T.
IF THIS.Value = "(All)"
SELECT country AS Location,* FROM CUSTOMER INTO CURSOR Custs
thisform.grdcust.recordsource = "Custs"
ELSE
SELECT country AS Location,* FROM CUSTOMER ;
WHERE UPPER(ALLTRIM(Customer.Country)) = UPPER(ALLTRIM(THIS.Value));
INTO CURSOR Custs
thisform.grdcust.recordsource = "Custs"
ENDIF
THISFORM.ResetCombos(THIS)
THISFORM.LockScreen = .F.

*----------------------------------------------------End----------------*
*-Start------------------------------------------------------------------*
cboIntSearch.Keypress
Object :cboIntSearch Procedure : Keypress
DO CASE
CASE EMPTY(m.cDisplayValue)
THISFORM.grdcust.recordsource = " "
CASE THIS.Value = "(All)"
SELECT country AS location,* FROM CUSTOMER;
INTO CURSOR Custs
thisform.grdcust.recordsource = "Custs"
OTHERWISE
SELECT country AS location,* FROM CUSTOMER ;
WHERE UPPER(ALLTRIM(Customer.Country)) = UPPER(m.cDisplayValue);
INTO CURSOR Custs
thisform.grdcust.recordsource = "Custs"
ENDCASE
THISFORM.ResetCombos(THIS)
THISFORM.LockScreen = .F.

*----------------------------------------------------End----------------*
cboIntSearch.LostFocus
Object : cboIntSearch Procedure : LostFocus

LOCAL cDisplayValue,cSqlStr,cCountryName
cDisplayValue = ALLTRIM(THIS.DisplayValue)
THIS.SelLength = 0
IF EMPTY(m.cDisplayValue)
RETURN
ENDIF

THISFORM.LockScreen = .T.

IF THIS.Value = "(All)"
SELECT country AS location,* FROM CUSTOMER INTO CURSOR Custs
thisform.grdcust.recordsource = "Custs"
ELSE
SELECT country AS location,* FROM CUSTOMER ;
WHERE UPPER(ALLTRIM(Customer.Country)) = UPPER(m.cDisplayValue);
INTO CURSOR Custs
thisform.grdcust.recordsource = "Custs"
IF _TALLY #0
cCountryName = ALLTRIM(Custs.Country)
IF ATC(m.cCountryName,THIS.RowSource) = 0 AND !EMPTY(m.cCountryName)
THIS.RowSource=THIS.RowSource+","+m.cCountryName
ENDIF
THIS.Value = m.cCountryName
ENDIF
ENDIF
THISFORM.ResetCombos(THIS)
THISFORM.LockScreen = .F.
*****************************************************************
grdCust.ActivateCell
Object : grdcust Procedure : ActivateCell
LPARAMETERS nRow, nCol
***********************************************
grdCust - Properties
RecordSource (None)
RecordSourceType 1-Alias
**********************************************

Vous aimerez peut-être aussi