home *** CD-ROM | disk | FTP | other *** search
- *******************************************************************************
- * PROGRAM: Filter.wfm
- *
- * WRITTEN BY: Borland Samples Group
- *
- * DATE: 1/94
- *
- * UPDATED: 6/95
- *
- * REVISION: $Revision: 1.31 $
- *
- * VERSION: Visual dBASE
- *
- * DESCRIPTION: This form allows setting a filter on the items currently
- * viewed. It allows you to create a combination filter based
- * on the artist, title, price, release date, and media type
- * of the available items from the Musical Methods store.
- *
- * PARAMETERS: None
- *
- * CALLS: Music.qbe (view of tables)
- * Music.cc (for custom pushbuttons)
- *
- *
- * USAGE: DO Filter.wfm && or
- *
- * local f
- * set procedure to Filter.wfm additive
- * f = new FilterForm()
- * f.ReadModal
- *******************************************************************************
- #include <Messdlg.h>
- #include "Music.h"
- #define EMPTY_STRING " "
- #define EMPTY_OP " "
- #define EMPTY_LOGIC " "
- #define STRING_DELIMITERS ['"]
- #define ENTRY_WIDTH 30
- #define AND_STRING " and "
- #define OR_STRING " or "
- #define LOGIC_OP_LEN 7 && -Max length of logical op
- #define DISPLAY_LOGIC_OP_LEN 5 && -Max length of logical op
- #define RETURN_CHAR chr(13) && in a sentence to be
- && displayed
- create session && If form run on its own, it should close all open tables
- set century on
- set talk off
- set ldcheck off
-
- ** END HEADER -- do not remove this line*
- * Generated on 05/12/94
- *
- parameter bModal
- local f
- f = new FILTERFORM()
- if (bModal)
- f.mdi = .F. && ensure not MDI
- f.ReadModal()
- else
- f.Open()
- endif
- CLASS FILTERFORM OF FORM
- Set Procedure To Music.cc Additive
- this.OnOpen = CLASS::ONOPEN
- this.OnSelection = CLASS::ONSELECTION
- this.OnClose = CLASS::ONCLOSE
- this.MousePointer = 1
- this.ColorNormal = "W"
- this.Text = "Set Filter"
- this.Width = 96.64
- this.Top = 2.02
- this.Left = 2.70
- this.Height = 16.3
- this.Minimize = .F.
- this.Maximize = .F.
- this.HelpFile = ""
- this.HelpId = ""
-
-
- DEFINE RECTANGLE MEDIATYPERECT OF THIS;
- PROPERTY;
- ColorNormal "N/W",;
- Text "",;
- Height 2.02,;
- Width 94.61,;
- Top 10.61,;
- Left 0.67,;
- Border .T.
-
- DEFINE RECTANGLE RELEASEDATERECT OF THIS;
- PROPERTY;
- ColorNormal "N/W",;
- Text "",;
- Height 2.02,;
- Width 94.61,;
- Top 8.58,;
- Left 0.67,;
- Border .T.
-
- DEFINE RECTANGLE SALESPRICERECT OF THIS;
- PROPERTY;
- ColorNormal "N/W",;
- Text "",;
- Height 2.02,;
- Width 94.61,;
- Top 6.57,;
- Left 0.67,;
- Border .T.
-
- DEFINE RECTANGLE RANKRECT OF THIS;
- PROPERTY;
- ColorNormal "N/W",;
- Text "",;
- Height 2.02,;
- Width 94.61,;
- Top 4.55,;
- Left 0.67,;
- Border .T.
-
- DEFINE RECTANGLE TITLERECT OF THIS;
- PROPERTY;
- ColorNormal "N/W",;
- Text "",;
- Height 2.02,;
- Width 94.61,;
- Top 2.53,;
- Left 0.67,;
- Border .T.
-
- DEFINE RECTANGLE ARTISTRECT OF THIS;
- PROPERTY;
- ColorNormal "N/W",;
- Text "",;
- Height 2.02,;
- Width 94.61,;
- Top 0.50,;
- Left 0.67,;
- Border .T.
-
- DEFINE NORMALTEXT ARTISTTEXT OF THIS;
- PROPERTY;
- Alignment 5,;
- Text "Artist",;
- Width 16.22,;
- Top 1.01,;
- Left 1.35,;
- Height 1.01,;
- Border .F.
-
- DEFINE COMBOBOX ARTISTOPCOMBO OF THIS;
- PROPERTY;
- Tabstop .F.,;
- Enabled .F.,;
- Width 8.11,;
- Top 1.01,;
- Left 18.92,;
- Height 1.26,;
- FontSize 7.00,;
- Style 2
-
- DEFINE COMBOBOX ARTISTCOMBO OF THIS;
- PROPERTY;
- OnGotFocus CLASS::ONGOTFOCUSFIELD,;
- OnLostFocus CLASS::ONLOSTFOCUSFIELD,;
- Style 1,;
- Enabled .T.,;
- Width 40.55,;
- Top 1.01,;
- Left 31.08,;
- Height 1.07,;
- Value ""
-
- DEFINE COMBOBOX ARTISTLOGICCOMBO OF THIS;
- PROPERTY ;
- Tabstop .F.,;
- Enabled .F.,;
- Width 10.81, ;
- Top 1.01, ;
- Left 72.98, ;
- Height 1.26, ;
- Value "", ;
- Style 2
-
- DEFINE PUSHBUTTON CLEARARTISTBUTTON OF THIS;
- PROPERTY;
- Id 1,;
- ColorNormal "N/W",;
- OnClick CLASS::CLEARARTIST,;
- Text "Clear",;
- Tabstop .F.,;
- Width 6.76,;
- Top 1.15,;
- Left 86.53,;
- Height 1.01
-
- DEFINE NORMALTEXT TITLETEXT OF THIS;
- PROPERTY;
- Alignment 5,;
- Text "Title",;
- Width 16.22,;
- Top 3.03,;
- Left 1.35,;
- Height 1.21
-
- DEFINE COMBOBOX TITLEOPCOMBO OF THIS;
- PROPERTY ;
- Tabstop .F.,;
- Enabled .F.,;
- Width 8.11, ;
- Top 3.03, ;
- Left 18.92, ;
- Height 1.26, ;
- Value "", ;
- Style 2
-
- DEFINE COMBOBOX TITLECOMBO OF THIS;
- PROPERTY;
- OnGotFocus CLASS::ONGOTFOCUSFIELD,;
- OnLostFocus CLASS::ONLOSTFOCUSFIELD,;
- Style 1,;
- Enabled .T.,;
- Width 40.55,;
- Top 3.03,;
- Left 31.08,;
- Height 1.07,;
- Value ""
-
-
-
- DEFINE COMBOBOX TITLELOGICCOMBO OF THIS ;
- PROPERTY ;
- Tabstop .F.,;
- Enabled .F.,;
- Width 10.81, ;
- Top 3.03, ;
- Left 72.98, ;
- Height 1.26, ;
- Value "", ;
- Style 2
-
-
- DEFINE PUSHBUTTON CLEARTITLEBUTTON OF THIS;
- PROPERTY;
- Id 2,;
- ColorNormal "N/W",;
- OnClick CLASS::CLEARTITLE,;
- Text "Clear",;
- Tabstop .F.,;
- Width 6.76,;
- Top 3.17,;
- Left 86.53,;
- Height 1.01
-
- DEFINE NORMALTEXT RANKTEXT OF THIS;
- PROPERTY;
- Alignment 5,;
- Text "Rank",;
- Width 16.22,;
- Top 5.05,;
- Left 1.35,;
- Height 1.01
-
- DEFINE COMBOBOX RANKOPCOMBO OF THIS;
- PROPERTY ;
- Tabstop .F.,;
- Enabled .F.,;
- Width 8.11, ;
- Top 5.05, ;
- Left 18.92, ;
- Height 1.26, ;
- Value "", ;
- Style 2
-
- DEFINE SPINBOX RANKSPIN OF THIS;
- PROPERTY;
- OnGotFocus CLASS::ONGOTFOCUSFIELD,;
- OnLostFocus CLASS::ONLOSTFOCUSFIELD,;
- ColorNormal "r/w",;
- Picture "9999",;
- Function "J",;
- Width 13.52,;
- Top 5.05,;
- Left 31.08,;
- Height 1.01,;
- Border .T.,;
- Value 0,;
- Rangemin 0,;
- Rangemax 2500,;
- ColorHighLight "r/w*"
-
-
- DEFINE COMBOBOX RANKLOGICCOMBO OF THIS;
- PROPERTY ;
- Tabstop .F.,;
- Enabled .F.,;
- Width 10.81, ;
- Top 5.05, ;
- Left 72.98, ;
- Height 1.26, ;
- Value "", ;
- Style 2
-
- DEFINE PUSHBUTTON CLEARRANKBUTTON OF THIS;
- PROPERTY;
- Id 3,;
- ColorNormal "N/W",;
- OnClick CLASS::CLEARRANK,;
- Text "Clear",;
- Tabstop .F.,;
- Width 6.76,;
- Top 5.20,;
- Left 86.53,;
- Height 1.01
-
- DEFINE NORMALTEXT SALESPRICETEXT OF THIS;
- PROPERTY;
- Alignment 5,;
- Text "Sales Price",;
- Width 16.22,;
- Top 7.07,;
- Left 1.35,;
- Height 1.01
-
- DEFINE COMBOBOX SALESPRICEOPCOMBO OF THIS;
- PROPERTY ;
- Tabstop .F.,;
- Enabled .F.,;
- Width 8.11, ;
- Top 7.07, ;
- Left 18.92, ;
- Height 1.26, ;
- Value "", ;
- Style 2
-
- DEFINE SPINBOX SALESPRICESPIN OF THIS;
- PROPERTY;
- OnGotFocus CLASS::ONGOTFOCUSFIELD,;
- OnLostFocus CLASS::ONLOSTFOCUSFIELD,;
- ColorNormal "r/w",;
- Width 13.52,;
- Top 7.07,;
- Left 31.08,;
- Height 1.01,;
- Border .T.,;
- Value 0,;
- Rangemin 1,;
- Rangemax 100,;
- ColorHighLight "r/w*",;
- Picture "999.99",;
- Function "$J"
-
- DEFINE COMBOBOX SALESPRICELOGICCOMBO OF THIS;
- PROPERTY ;
- Tabstop .F.,;
- Enabled .F.,;
- Width 10.81, ;
- Top 7.07, ;
- Left 72.98, ;
- Height 1.26, ;
- Value "", ;
- Style 2
-
- DEFINE PUSHBUTTON CLEARSALESPRICEBUTTON OF THIS;
- PROPERTY;
- Id 5,;
- ColorNormal "N/W",;
- OnClick CLASS::CLEARSALESPRICE,;
- Text "Clear",;
- Tabstop .F.,;
- Width 6.76,;
- Top 7.23,;
- Left 86.53,;
- Height 1.01
-
- DEFINE NORMALTEXT RELEASEDATETEXT OF THIS;
- PROPERTY;
- Alignment 5,;
- Text "Release Date",;
- Width 16.22,;
- Top 9.09,;
- Left 1.35,;
- Height 1.01
-
- DEFINE COMBOBOX RELEASEDATEOPCOMBO OF THIS;
- PROPERTY ;
- Tabstop .F.,;
- Enabled .F.,;
- Width 8.11, ;
- Top 9.09, ;
- Left 18.92, ;
- Height 1.26, ;
- Value "", ;
- Style 2
-
- DEFINE ENTRYFIELD RELEASEDATEENTRY OF THIS;
- PROPERTY;
- OnGotFocus CLASS::ONGOTFOCUSFIELD,;
- OnLostFocus CLASS::ONLOSTFOCUSFIELD,;
- ColorNormal "r/w",;
- Width 13.52,;
- Top 9.09,;
- Left 31.08,;
- Height 1.07,;
- Border .T.,;
- Value {},;
- ColorHighLight "r/w*",;
- Function "DJ",;
- Maxlength 10
-
- DEFINE COMBOBOX RELEASEDATELOGICCOMBO OF THIS;
- PROPERTY ;
- Tabstop .F.,;
- Enabled .F.,;
- Width 10.81, ;
- Top 9.09, ;
- Left 72.98, ;
- Height 1.26, ;
- Value "", ;
- Style 2
-
- DEFINE PUSHBUTTON CLEARRELEASEDATEBUTTON OF THIS;
- PROPERTY;
- Id 4,;
- ColorNormal "N/W",;
- OnClick CLASS::CLEARRELEASEDATE,;
- Text "Clear",;
- Tabstop .F.,;
- Width 6.76,;
- Top 9.24,;
- Left 86.53,;
- Height 1.01
-
-
- DEFINE NORMALTEXT MEDIATYPETEXT OF THIS;
- PROPERTY;
- Alignment 5,;
- Text "Media Type",;
- Width 16.22,;
- Top 11.11,;
- Left 1.35,;
- Height 1.21
-
-
- DEFINE COMBOBOX MEDIATYPEOPCOMBO OF THIS;
- PROPERTY ;
- Tabstop .F.,;
- Enabled .F.,;
- Width 8.11, ;
- Top 11.11, ;
- Left 18.92, ;
- Height 1.26, ;
- Value "", ;
- Style 2
-
-
- DEFINE COMBOBOX MEDIATYPECOMBO OF THIS;
- PROPERTY;
- Tabstop .F.,;
- OnGotFocus CLASS::ONGOTFOCUSFIELD,;
- OnLostFocus CLASS::ONLOSTFOCUSFIELD,;
- Width 40.55,;
- Top 11.11,;
- Left 31.08,;
- Height 1.26,;
- Value " ",;
- Style 2
-
- DEFINE PUSHBUTTON CLEARMEDIATYPEBUTTON OF THIS;
- PROPERTY;
- Id 6,;
- ColorNormal "N/W",;
- OnClick CLASS::CLEARMEDIATYPE,;
- Text "Clear",;
- Tabstop .F.,;
- Width 6.76,;
- Top 11.26,;
- Left 86.53,;
- Height 1.01
-
- DEFINE IMAGE LOGOIMAGE OF THIS;
- PROPERTY;
- Width 10.81,;
- Top 13.13,;
- Left 1.35,;
- Height 3.03,;
- DataSource "FILENAME SMLMUSIC.BMP"
-
- DEFINE OKMBUTTON FILTEROKBUTTON OF THIS;
- PROPERTY;
- Width 14.11,;
- Top 14.14,;
- Left 64.87,;
- Height 1.50,;
- Default .T.,;
- Group .T.
-
- DEFINE CANCELMBUTTON FILTERCANCELBUTTON OF THIS;
- PROPERTY;
- Width 14.11,;
- Top 14.14,;
- Left 79.74,;
- Height 1.50,;
- ID 0,;
- Group .F.
-
-
- *******************************************************************************
- procedure OnOpen
- *******************************************************************************
-
- set procedure to Music.prg additive
- this.saveExact = set("exact")
- this.saveFields = setto("fields")
- setSkip = "Music"
- if empty(alias())
- set view to Music.qbe
- endif
- use configs again in select() alias configs2 order descript && for media types
- set exact off
- set fields to
- set skip to &setSkip
-
-
- this.CreateArrays()
-
- this.mediaTypeCombo.dataSource = "array form.configsAr"
- this.artistOpCombo.dataSource = "array form.charOpAr"
- this.titleOpCombo.dataSource = "array form.charOpAr"
- this.rankOpCombo.dataSource = "array form.operatorAr"
- this.salesPriceOpCombo.dataSource = "array form.operatorAr"
- this.releaseDateOpCombo.dataSource = "array form.operatorAr"
- this.mediaTypeOpCombo.dataSource = "array form.charOpAr"
- this.artistLogicCombo.dataSource = "array form.logicOpAr"
- this.titleLogicCombo.dataSource = "array form.logicOpAr"
- this.rankLogicCombo.dataSource = "array form.logicOpAr"
- this.salesPriceLogicCombo.dataSource = "array form.logicOpAr"
- this.releaseDateLogicCombo.dataSource = "array form.logicOpAr"
-
- this.artistCombo.Datasource = "field music->artist"
- this.titleCombo.Datasource = "field music->title"
- this.titleCombo.value = ""
-
-
- this.artistCombo.prevObj = this.artistOpCombo
- this.titleCombo.prevObj = this.titleOpCombo
- this.rankSpin.prevObj = this.rankOpCombo
- this.salesPriceSpin.prevObj = this.salesPriceOpCombo
- this.releaseDateEntry.prevObj = this.releaseDateOpCombo
- this.mediaTypeCombo.prevObj = this.mediaTypeOpCombo
-
- this.artistCombo.nextObj = this.artistLogicCombo
- this.titleCombo.nextObj = this.titleLogicCombo
- this.rankSpin.nextObj = this.rankLogicCombo
- this.salesPriceSpin.nextObj = this.salesPriceLogicCombo
- this.releaseDateEntry.nextObj = this.releaseDateLogicCombo
- this.mediaTypeCombo.nextObj = this.mediaTypeCombo.prevObj && no combobox
- && after media types
- this.filter = "" && property containing selected filter
- this.count = reccount() && count of records in the filter
-
-
- *******************************************************************************
- procedure OnClose
- *******************************************************************************
- private saveExact, saveFields
-
- set skip to
- saveExact = this.saveExact
- saveFields = this.saveFields
- set exact &saveExact
- set fields to &saveFields
- use in configs2 && Close temporary configs table
-
- *** If form is not opened modally
- if _app.framewin.text <> "Musical Methods" .and. type("this.viewForm") <> "U"
- this.viewForm.filter = set("filter")
- endif
-
-
- *******************************************************************************
- procedure OnGotFocusField
- *******************************************************************************
-
- if empty(this.prevObj.value)
- this.prevObj.value = " is "
- endif
- if .not. empty(this.nextObj) .and. empty(this.nextObj.value)
- this.nextObj.value = AND_STRING
- endif
- this.prevObj.enabled = .T.
- this.nextObj.enabled = .T.
- this.prevObj.tabstop = .T.
- this.nextObj.tabstop = .T.
-
-
- *******************************************************************************
- procedure OnLostFocusField
- *******************************************************************************
-
- if empty(this.value) && Nothing was entered
- this.prevObj.value = EMPTY_OP
- this.prevObj.tabstop = .F.
- this.prevObj.enabled = .F.
- show object this.prevObj
- this.nextObj.value = EMPTY_LOGIC
- this.nextObj.tabstop = .F.
- this.nextObj.enabled = .F.
- show object this.nextObj
- else && Enable comboboxes if they exist
- if .not. empty(this.nextObj) && (MediaTypeCombo doesn't have nextObj)
- this.nextObj.enabled = .T.
- if empty(this.nextObj.value)
- this.nextObj.value = "and"
- endif
- endif
- this.prevObj.enabled = .T.
- if empty(this.prevObj.value) && if no operator, assign one
- this.prevObj.value = " is "
- endif
- endif
- if type("this.value") = "C"
- this.value = form.CleanString(this.value)
- show object this
- endif
-
-
- *******************************************************************************
- procedure CreateArrays
- *******************************************************************************
- local arrayRef && variable for minimizing property access
-
- * combobox datasource arrays
- this.operatorAr = new array(5)
- this.charOpAr = new array(3)
- this.logicOpAr = new array(3)
- this.configsAr = new array(reccount("configs2") + 1) && add 1 for empty value
-
- arrayRef = this.operatorAr
- arrayRef[1] = EMPTY_OP
- arrayRef[2] = " is "
- arrayRef[3] = " isn't "
- arrayRef[4] = " < "
- arrayRef[5] = " > "
-
- acopy(this.operatorAr,this.charOpAr,1,3) && only want "is" and "isn't"
-
- arrayRef = this.logicOpAr
- arrayRef[1] = EMPTY_LOGIC
- arrayRef[2] = AND_STRING
- arrayRef[3] = OR_STRING
-
- arrayRef = this.configsAr
- arrayRef[1] = EMPTY_STRING
- arrayRef[2] = "12 in. VINYL"
- arrayRef[3] = "COMPACT DISC"
- arrayRef[4] = "VHS VIDEO"
- arrayRef[5] = "CASSETTE"
- arrayRef[6] = "DIGITAL COMPACT CASSETTE"
- arrayRef[7] = "12 in. LASER DISC"
- arrayRef[8] = "MINI-DISC"
- arrayRef[9] = "ACCESSORIES"
-
-
- *******************************************************************************
- Procedure OnSelection(controlId)
- *******************************************************************************
- private filterVar, filterStr, strConfig, saveFilter, saveRec, closeForm,;
- curTable
-
- form.selectedId = controlId && Indicates to calling procedure what
- closeForm = .F.
- curTable = alias()
- do case && control was selected
- case controlId > 0 && Clear buttons were selected -- don't do anything
- case controlId = 0 && Cancel was selected
- closeForm = .T.
- otherwise
- filterVar = ""
- filterStr = ""
- if .not. empty(this.artistCombo.value) && Artist was entered
- this.AddFilter(filterVar, filterStr, " Music->Artist ",;
- this.artistText.text, this.artistOpCombo,;
- this.artistCombo.value, this.artistLogicCombo)
- endif
- if .not. empty(this.titleCombo.value) && Title was entered
- this.AddFilter(filterVar, filterStr, " Music->Title ",;
- this.titleText.text, this.titleOpCombo,;
- this.titleCombo.value, this.titleLogicCombo)
- endif
- if .not. empty(this.rankSpin.value) && Rank was entered
- this.AddFilter(filterVar, filterStr, " Music->Rank ",;
- this.rankText.text, this.rankOpCombo,;
- this.rankSpin.value, this.rankLogicCombo)
- endif
- if .not. empty(this.salesPriceSpin.value) && Sales Price was entered
- this.AddFilter(filterVar, filterStr, " Music->List_Price ",;
- this.salesPriceText.text, this.salesPriceOpCombo,;
- this.salesPriceSpin.value, this.salesPriceLogicCombo)
- endif
- if .not. empty(this.releaseDateEntry.value) && Release Date was entered
- this.AddFilter(filterVar, filterStr, " Music->Street_Dt ",;
- this.releaseDateText.text, this.releaseDateOpCombo,;
- this.releaseDateEntry.value, this.ReleaseDateLogicCombo)
- endif
- if .not. empty(this.mediaTypeCombo.value) && Media Type was specified
- select configs2
- seek this.mediaTypeCombo.value
- strConfig = str(configs2->config)
- select &curTable
- this.AddFilter(filterVar, filterStr, " Music->Config ",;
- this.mediaTypeText.text, this.mediaTypeOpCombo,;
- strConfig, "")
- endif
- * If last word was .and./.or., delete it
- if CLASS::BackRat(" .or. ",filterVar) = 7 .or.;
- CLASS::BackRat(" .and. ",filterVar) = 7
- filterVar = substr(filterVar,1,len(filterVar) - LOGIC_OP_LEN)
- filterStr = substr(filterStr,1,len(filterStr) - DISPLAY_LOGIC_OP_LEN)
- endif
- saveRec = iif(eof(), reccount(), recno())
- saveFilter = set("filter")
-
- * Set the filter
- select music
- set filter to &filterVar
- go top
-
- select &curTable
- set filter to &filterVar
- count to form.count
- go top
-
- if eof() && no matching records
- set filter to &saveFilter
- go top
- go saveRec
- if ConfirmationMessage("No matching data was found. Continue?",;
- "Sorry") = NO
- closeForm = .T.
- endif
- else && matching records
- form.filter = filterStr
- if type("form.viewForm") <> "U"
- form.viewForm.filter = filterStr && Save filter in view form
- endif
- InformationMessage(;
- FormatStr("%1 items meet the specified condition:\n\n%2",;
- ltrim(str(this.count)),;
- form.filter),;
- "Information")
- closeForm = .T.
- endif
- endcase
- if closeForm
- form.Close()
- endif
-
-
- *******************************************************************************
- procedure DecodeOp(opControl)
- *******************************************************************************
- private op,decodedOp
-
- op = opControl.value
- decodedOp = op && some operators are directly transferable, but
- do case && the case statement handles ones that aren't
- case op = " is "
- decodedOp = " = "
- case op = " isn't "
- decodedOp = " <> "
- case op = AND_STRING
- decodedOp = " .and. "
- case op = OR_STRING
- decodedOp = " .or. "
- endcase
- return decodedOp
-
-
- *******************************************************************************
- Procedure ClearArtist
- *******************************************************************************
-
- form.artistOpCombo.value = EMPTY_OP
- form.artistCombo.value = space(ENTRY_WIDTH)
- form.artistLogicCombo.value = EMPTY_LOGIC
- form.artistCombo.OnLostFocus()
-
-
- *******************************************************************************
- Procedure ClearTitle
- *******************************************************************************
-
- form.titleOpCombo.value = EMPTY_OP
- form.titleCombo.value = space(ENTRY_WIDTH)
- form.titleLogicCombo.value = EMPTY_LOGIC
- form.titleCombo.OnLostFocus()
-
-
- *******************************************************************************
- Procedure ClearRank
- *******************************************************************************
-
- form.rankOpCombo.value = EMPTY_OP
- form.rankSpin.value = 0
- form.rankLogicCombo.value = EMPTY_LOGIC
- form.rankSpin.OnLostFocus()
-
-
- *******************************************************************************
- Procedure ClearSalesPrice
- *******************************************************************************
-
- form.salesPriceOpCombo.value = EMPTY_OP
- form.salesPriceSpin.value = 0
- form.salesPriceLogicCombo.value = EMPTY_LOGIC
- form.salesPriceSpin.OnLostFocus()
-
-
- *******************************************************************************
- Procedure ClearReleaseDate
- *******************************************************************************
-
- form.releaseDateOpCombo.value = EMPTY_OP
- form.releaseDateEntry.value = {//}
- form.releaseDateLogicCombo.value = EMPTY_LOGIC
- form.releaseDateEntry.OnLostFocus()
-
-
- *******************************************************************************
- Procedure ClearMediaType
- *******************************************************************************
-
- form.mediaTypeOpCombo.value = EMPTY_OP
- form.mediaTypeCombo.value = " "
- form.mediaTypeCombo.OnLostFocus()
-
-
- *******************************************************************************
- procedure AddFilter(filterVar, filterStr, field,;
- text, opCombo, value, logicCombo)
- *******************************************************************************
- private filterValue, displayValue, filterLogicOp, displayLogicOp
-
- do case
- case text = "Artist" .or. text = "Title"
- filterValue = '"' + ALLTRIM(value) + '"'
- displayValue = ALLTRIM(value)
- case text = "Rank"
- filterValue = str(value,4)
- displayValue = str(value,4)
- case text = "Sales Price"
- filterValue = stuff(str(value,5,2),3,1,".")
- displayValue = "$" + ltrim(stuff(str(value,5,2),3,1,"."))
- case text = "Release Date"
- filterValue = "ctod('" +dtoc(this.releaseDateEntry.value) + "')"
- displayValue = dtoc(value)
- case text = "Media Type"
- filterValue = value
- displayValue = configs2->descript
- endcase
-
- * Make sure comboboxes have meaningful values
- opCombo.value = iif(empty(opCombo.value)," is ", opCombo.value)
- if .not. empty(logicCombo)
- logicCombo.value = iif(empty(logicCombo.value), " and ", logicCombo.value)
- filterLogicOp = this.DecodeOp(logicCombo)
- displayLogicOp = logicCombo.value + RETURN_CHAR && end sentence with Return
- else
- filterLogicOp = ""
- displayLogicOp = ""
- endif
- filterVar = filterVar + ;
- field + ;
- this.DecodeOp(opCombo) +;
- filterValue +;
- filterLogicOp
- filterStr = filterStr +;
- text +;
- opCombo.value +;
- displayValue +;
- displayLogicOp
-
-
- *******************************************************************************
- function BackRat(searchStr, targetStr)
- *******************************************************************************
- local lenTarget, lenSearch, foundLoc
-
- lenTarget = len(targetStr)
- lenSearch = len(searchStr)
- foundLoc = rat(searchStr, targetStr)
- return iif(foundLoc = 0,;
- 0,;
- lenTarget - foundLoc + 1)
-
-
- *******************************************************************************
- function CleanString(s)
-
- * Delete extraneous delimiters from string
- *******************************************************************************
- private firstChar, lastChar, lenS, atDelim1
-
- s = rtrim(s)
- firstChar = left(s, 1)
- lastChar = right(s, 1)
- lenS = len(s)
- atDelim1 = at('"', s)
- do case
- case firstChar $ STRING_DELIMITERS
- do case
- case lenS = 1
- * string only contains quote -- make it be empty
- s = ""
- case lastChar = firstChar
- * Get rid of first and last characters, and try function again
- s = this.CleanString(substr(s, 2, lenS - 2))
- otherwise
- * Get rid of first character and try function again
- s = this.CleanString(substr(s, 2))
- endcase
- case lastChar $ STRING_DELIMITERS
- * Get rid of last character
- s = this.CleanString(substr(s, 1, lenS - 1))
- case atDelim1 > 0
- * Get rid of delimiters in middle
- s = left(s, atDelim1 - 1) + this.CleanString(right(s, lenS - atDelim1 + 1))
- endcase
-
- return s + space(ENTRY_WIDTH - lenS) && return string of ENTRY_WIDTH length
-
-
-
- ENDCLASS
-
-
-
-
-
-
-
-
-