* If a view or cursoradapter that doesn't use the PKValue filter is being used as a lookup cursor, make sure the index tag that is used * in the SEEK() in the Refresh method has been created. Otherwise, an error occurs when the SEEK() is executed. IF This.lLookupDescription AND NOT EMPTY(This.cLookupFKExpression) AND NOT EMPTY(This.cLookupAlias) AND ; NOT EMPTY(This.cLookupPKTag) AND NOT EMPTY(This.cLookupExpression) AND slnLookupSourceType <> 3 AND ; NOT '?PKVALUE' $ UPPER(CURSORGETPROP('SQL',This.cLookupAlias))Property name is invalid for the cursor.
DEFINE CLASS dealeropt AS form_toolbar Top = 18 Left = 168 Height = 598 Width = 583 DoCreate = .T. Caption = "Aftermarket Options" MinButton = .F. MinHeight = 550 MinWidth = 520 *-- cntMoverMakes.Width / thisform.Width nmakesratio = 1 *-- cntMoverModels.Width / thisform.Width nmodelsratio = 1 ctoolbar = "" lallownoorder = .F. clistfields = "Option_Desc" ltrans_form_ = .F. Name = "dealeropt" *-- Array of Makes DIMENSION arrmakes[1] *-- Array of selected makes DIMENSION arrselectedmakes[1] ADD OBJECT txtdealeropts_optionid AS textbox_ WITH ; ControlSource = "cOptions.OptionID", ; Height = 20, ; Left = 14, ; TabIndex = 4, ; Top = 16, ; Width = 358, ; llookupdescription = .T., ; clookupalias = "DealerOptions", ; clookupexpression = "Option_Desc", ; loverridewidth = .T., ; cfkupdate_fkfields = "Option_Desc", ; cfkupdate_form = "DealerOptions", ; cfkupdate_pkfields = "OptionID", ; clookuppktag = "OptionID", ; clookupfkexpression = "OptionID", ; cname_ddd = "MNA", ; cname_ddtv = "DealerOpts", ; Name = "txtDealerOpts_OptionID" ADD OBJECT lbldealeropt_description AS label_ WITH ; FontBold = .T., ; FontSize = 8, ; Caption = "Description", ; Left = 14, ; Top = 2, ; Width = 65, ; TabIndex = 3, ; cname_ddd = "MNA", ; cname_ddf = "OptionID", ; cname_ddtv = "DealerOpts", ; Name = "lblDealeropt_Description" ADD OBJECT cntmovermodels AS cntmover WITH ; Top = 221, ; Left = 15, ; Width = 561, ; Height = 177, ; _2or12geae = "Object", ; designerstart = (iif(TYPE("Thisform.Dataenvironment") = "O", "", xfcDesigner(THIS, "Resize"))), ; Name = "cntMoverModels", ; cmdMoveOne.Top = 30, ; cmdMoveOne.Left = 264, ; cmdMoveOne.Name = "cmdMoveOne", ; cmdMoveAll.Top = 62, ; cmdMoveAll.Left = 264, ; cmdMoveAll.Name = "cmdMoveAll", ; cmdRemoveOne.Top = 104, ; cmdRemoveOne.Left = 264, ; cmdRemoveOne.Name = "cmdRemoveOne", ; cmdRemoveAll.Top = 136, ; cmdRemoveAll.Left = 264, ; cmdRemoveAll.Name = "cmdRemoveAll", ; lstSource.Height = 158, ; lstSource.Width = 250, ; lstSource.Name = "lstSource", ; lblSource.Name = "lblSource", ; lblDestination.Left = 313, ; lblDestination.Name = "lblDestination", ; lstDestination.Height = 158, ; lstDestination.Left = 310, ; lstDestination.Width = 250, ; lstDestination.Name = "lstDestination" ADD OBJECT cmdsaveclose AS commandbutton_ WITH ; Top = 559, ; Left = 252, ; Height = 27, ; Width = 100, ; Anchor = 768, ; Caption = "Save and Close", ; TabIndex = 12, ; ZOrderSet = 4, ; Name = "cmdSaveClose" ADD OBJECT cmdsavenew AS commandbutton_ WITH ; Top = 559, ; Left = 357, ; Height = 27, ; Width = 100, ; Anchor = 768, ; Caption = "Save and New", ; TabIndex = 13, ; TabStop = .F., ; ZOrderSet = 5, ; Name = "cmdSaveNew" ADD OBJECT cntmovermakes AS cntmover WITH ; Top = 38, ; Left = 14, ; Width = 561, ; Height = 180, ; _2or12geb0 = "Object", ; designerstart = (iif(TYPE("Thisform.Dataenvironment") = "O", "", xfcDesigner(THIS, "Resize"))), ; Name = "cntMoverMakes", ; cmdMoveOne.Top = 31, ; cmdMoveOne.Left = 264, ; cmdMoveOne.Name = "cmdMoveOne", ; cmdMoveAll.Top = 63, ; cmdMoveAll.Left = 264, ; cmdMoveAll.Name = "cmdMoveAll", ; cmdRemoveOne.Top = 105, ; cmdRemoveOne.Left = 264, ; cmdRemoveOne.Name = "cmdRemoveOne", ; cmdRemoveAll.Top = 137, ; cmdRemoveAll.Left = 264, ; cmdRemoveAll.Name = "cmdRemoveAll", ; lstSource.Height = 161, ; lstSource.Width = 250, ; lstSource.Name = "lstSource", ; lblSource.Name = "lblSource", ; lblDestination.Left = 313, ; lblDestination.Name = "lblDestination", ; lstDestination.Height = 161, ; lstDestination.Left = 310, ; lstDestination.Width = 250, ; lstDestination.Name = "lstDestination" ADD OBJECT cmdcancel AS commandbutton_ WITH ; Top = 559, ; Left = 462, ; Height = 27, ; Width = 100, ; Anchor = 768, ; Caption = "Revert", ; TabIndex = 14, ; TabStop = .F., ; ZOrderSet = 6, ; Name = "cmdCancel" PROCEDURE Activate *- Modify the list form DODEFAULT() IF THISFORM.lStartWithList *- Turn off to prevent endless loop! THISFORM.lStartWithList = .F. *- If form starts with no records, one has been added but is blank *!* IF NOT EMPTY(EVALUATE(FIELD(1))) *!* THISFORM.Onform_toolbar.cmdList.CLICK *!* ELSE *!* * ThisForm.txtDealeropt_type.Value = "AFTERMARKET" *!* ENDIF ENDIF IF NOT PEMSTATUS(THISFORM,'IsActivated',5) THISFORM.ADDPROPERTY('IsActivated', .F.) ENDIF IF NOT THISFORM.IsActivated LOCAL lnEndYear, lnBeginYear, lnI, lnSelect lnSelect = SELECT() lnEndYear = YEAR(DATE()) lnBeginYear = lnEndYear - 10 CREATE CURSOR cYears (cYear C(4)) FOR lnI = m.lnBeginYear TO m.lnEndYear INSERT INTO cYears VALUES (TRANSFORM(m.lnI)) NEXT SELECT '[' + cYear + '] ' + NAME AS cNameYear FROM Manufacturers, cYears ORDER BY cYear DESC, NAME INTO ARRAY THISFORM.arrMakes DIMENSION arrMakes[1] ACOPY(THISFORM.arrMakes, arrMakes) DIMENSION arrSelectedMakes[1] ACOPY(THISFORM.arrSelectedMakes, arrSelectedMakes) WITH THISFORM.cntMoverMakes .SetSourceLabel("Available [Year] Boat Make") .SetDestinationLabel("Assigned [Year] Boat Make") .PopulateSource(@arrMakes) .PopulateDestination(@arrSelectedMakes) *.Anchor = 10 thisform.nMakesRatio = .Width / thisform.Width ENDWITH WITH thisform.cntMoverModels .SetSourceLabel("Available models") .SetDestinationLabel("Selected model/years") *.Anchor = 10 thisform.nModelsRatio = .Width / thisform.Width ENDWITH SELECT (m.lnSelect) THISFORM.IsActivated = .T. ENDIF ENDPROC PROCEDURE Resize DODEFAULT() thisform.cntMoverMakes.Width = thisform.Width * thisform.nMakesRatio thisform.cntMoverMakes.AdjustPositions("Resize") thisform.cntMoverModels.Width = thisform.Width * thisform.nModelsRatio thisform.cntMoverModels.AdjustPositions("Resize") ENDPROC PROCEDURE Load DODEFAULT() IF NOT USED('DealerOptions') USE DealerOptions IN 0 SHARED again ENDIF IF NOT USED('DealerOpts') USE DealerOpts IN 0 SHARED again ENDIF CREATE CURSOR cOptions (OptionID int) APPEND BLANK IN cOptions ENDPROC PROCEDURE cmdsaveclose.Click With ThisForm .Onform_toolbar.cmdSave.Click() .Onform_toolbar.cmdClose.Click() Endwith ENDPROC PROCEDURE cmdsavenew.Click With ThisForm .Onform_toolbar.cmdSave.Click() .Onform_toolbar.cmdMore.Click() Endwith ENDPROC PROCEDURE cmdcancel.Click ThisForm.Onform_toolbar.cmdRestore.Click() ENDPROC ENDDEFINE * *-- EndDefine: dealeropt **************************************************