/* CUSTLABL.WFM -- a quick'n'dirty form designed to allow the developer to add label definitions to those already in the table ... NOTE: If you bring this into the designer, the following is what the query should look like -- if the path gets changed you may get an error: this.LABE00091 = new QUERY() this.LABE00091.parent = this with (this.LABE00091) left = 46.5714 top = 0.2273 sql = 'select * from "'+LABELTABLE+'"' active = true endwith Note the SQL statement specifically ... The only changes you should have to make are noted directly below these comments ... ** This form uses the :classes: source alias generated ** by dB2K when installed to reference the location ** of the databuttons.cc file. // special note -- in dBASE Plus, the :classes: source // alias is redefined as :formcontrols: the following // code has been added to the constructor code of the // form, but if you load this in the form designer and change // anything, saving the form will probably cause the following // code to be stripped out. You may want to check and see. // In addition, running using or compiling this custom form in // dB2K or in dBASE Plus, you will want to re-compile it in the // other or it won't run ... #if __version__ < 2 set procedure to :classes:DataButtons.cc additive #else set procedure to :formcontrols:DataButtons.cc additive #endif May, 2015 Updated to deal with the fact that dBASE Plus 2.8 and later puts the modifiable version of the table used for this in the users folder ... */ // Check the path ... _dbwinhome on a default installation // will be: C:\PROGRAM FILES\DBASE\DB2K 01\ #IF __version__ < 2.80 #define TABLEPATH _dbwinhome+"DESIGNER\LABEL\" #ELSE #DEFINE TABLEPATH left(_app.currentUserPath, len( _app.currentUserPath ) - 4 )+ "\Designer\label\" #ENDIF // If using a language other than American English, check // to see if this is the correct table name ...: #define TABLENAME "labe0009.db" #define LABELTABLE TABLEPATH+TABLENAME local fMyFile, t, bFound, i fMyFile = new File() if not fMyFile.exists( LABELTABLE ) msgbox( "File: '"+TABLENAME+"' doesn't exist! "+; " Check your installation for the location "+; "of the '"+TABLEPATH+"' directory and the table '"+; TABLENAME+"'","Error!", 16 ) else local f f = new custlablForm() f.open() endif RETURN ** END HEADER -- do not remove this line // // Generated on 02/13/2007 // parameter bModal local f f = new custlablForm() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif class custlablForm of FORM set procedure to :FormControls:DATABUTTONS.CC additive with (this) onNavigate = class::UPDATECOMBO onOpen = class::FORM_ONOPEN metric = 6 // Pixels height = 450.0 left = 253.0 top = 186.0 width = 581.0 text = "Label Definitions for Label Designer" autoCenter = true scrollBar = 2 // Auto endwith this.LABE00091 = new QUERY() this.LABE00091.parent = this with (this.LABE00091) left = 324.0 top = -1.0 sql = 'select * from "'+LABELTABLE+'"' active = true endwith with (this.LABE00091.rowset) autoEdit = false endwith this.TITLE1 = new TEXT(this) with (this.TITLE1) height = 29.0 left = 71.0 top = 9.0 width = 176.0 variableHeight = true colorNormal = "Highlight/BtnFace" fontSize = 18.0 fontBold = true text = "Design Labels" endwith this.TEXTDESCRIPTION1 = new TEXT(this) with (this.TEXTDESCRIPTION1) height = 22.0 left = 25.0 top = 66.0 width = 70.0 wrap = false alignVertical = 1 // Middle alignHorizontal = 2 // Right text = "Description:" endwith this.ENTRYFIELDDESCRIPTION1 = new ENTRYFIELD(this) with (this.ENTRYFIELDDESCRIPTION1) dataLink = form.labe00091.rowset.fields["description"] height = 22.0 left = 98.0 top = 66.0 width = 380.0 borderStyle = 7 // Client endwith this.TEXTTOPMARGIN1 = new TEXT(this) with (this.TEXTTOPMARGIN1) height = 22.0 left = 0.0 top = 88.0 width = 98.0 wrap = false alignVertical = 1 // Middle alignHorizontal = 2 // Right text = "Topmargin:" endwith this.SPINBOXTOPMARGIN1 = new SPINBOX(this) with (this.SPINBOXTOPMARGIN1) dataLink = form.labe00091.rowset.fields["topmargin"] height = 22.0 left = 98.0 top = 88.0 width = 105.0 picture = "9999.9999" rangeMax = 100 rangeMin = 1 borderStyle = 7 // Client endwith this.TEXTBOTTOMMARGIN1 = new TEXT(this) with (this.TEXTBOTTOMMARGIN1) height = 22.0 left = 0.0 top = 110.0 width = 98.0 wrap = false alignVertical = 1 // Middle alignHorizontal = 2 // Right text = "Bottommargin:" endwith this.SPINBOXBOTTOMMARGIN1 = new SPINBOX(this) with (this.SPINBOXBOTTOMMARGIN1) dataLink = form.labe00091.rowset.fields["bottommargin"] height = 22.0 left = 98.0 top = 110.0 width = 105.0 picture = "9999.9999" colorHighLight = "" rangeMax = 100 endwith this.TEXTLEFTMARGIN1 = new TEXT(this) with (this.TEXTLEFTMARGIN1) height = 22.0 left = 0.0 top = 132.0 width = 98.0 wrap = false alignVertical = 1 // Middle alignHorizontal = 2 // Right text = "Leftmargin:" endwith this.SPINBOXLEFTMARGIN1 = new SPINBOX(this) with (this.SPINBOXLEFTMARGIN1) dataLink = form.labe00091.rowset.fields["leftmargin"] height = 22.0 left = 98.0 top = 132.0 width = 105.0 picture = "9999.9999" colorHighLight = "" rangeMax = 100 endwith this.TEXTRIGHTMARGIN1 = new TEXT(this) with (this.TEXTRIGHTMARGIN1) height = 22.0 left = 0.0 top = 154.0 width = 98.0 wrap = false alignVertical = 1 // Middle alignHorizontal = 2 // Right text = "Rightmargin:" endwith this.SPINBOXRIGHTMARGIN1 = new SPINBOX(this) with (this.SPINBOXRIGHTMARGIN1) dataLink = form.labe00091.rowset.fields["rightmargin"] height = 22.0 left = 98.0 top = 154.0 width = 105.0 picture = "9999.9999" colorHighLight = "" rangeMax = 100 endwith this.TEXTLABELWIDTH1 = new TEXT(this) with (this.TEXTLABELWIDTH1) height = 22.0 left = 0.0 top = 176.0 width = 98.0 wrap = false alignVertical = 1 // Middle alignHorizontal = 2 // Right text = "Labelwidth:" endwith this.SPINBOXLABELWIDTH1 = new SPINBOX(this) with (this.SPINBOXLABELWIDTH1) dataLink = form.labe00091.rowset.fields["labelwidth"] height = 22.0 left = 98.0 top = 176.0 width = 105.0 picture = "9999.9999" colorHighLight = "" rangeMax = 100 endwith this.TEXTLABELHEIGHT1 = new TEXT(this) with (this.TEXTLABELHEIGHT1) height = 22.0 left = 0.0 top = 198.0 width = 98.0 wrap = false alignVertical = 1 // Middle alignHorizontal = 2 // Right text = "Labelheight:" endwith this.SPINBOXLABELHEIGHT1 = new SPINBOX(this) with (this.SPINBOXLABELHEIGHT1) dataLink = form.labe00091.rowset.fields["labelheight"] height = 22.0 left = 98.0 top = 198.0 width = 105.0 picture = "9999.9999" colorHighLight = "" rangeMax = 100 endwith this.TEXTHORIZONTALGAP1 = new TEXT(this) with (this.TEXTHORIZONTALGAP1) height = 22.0 left = 0.0 top = 220.0 width = 98.0 wrap = false alignVertical = 1 // Middle alignHorizontal = 2 // Right text = "Horizontalgap:" endwith this.SPINBOXHORIZONTALGAP1 = new SPINBOX(this) with (this.SPINBOXHORIZONTALGAP1) dataLink = form.labe00091.rowset.fields["horizontalgap"] height = 22.0 left = 98.0 top = 220.0 width = 105.0 picture = "9999.9999" colorHighLight = "" rangeMax = 100 endwith this.TEXTVERTICALGAP1 = new TEXT(this) with (this.TEXTVERTICALGAP1) height = 22.0 left = 0.0 top = 245.0 width = 98.0 wrap = false alignVertical = 1 // Middle alignHorizontal = 2 // Right text = "Verticalgap:" endwith this.SPINBOXVERTICALGAP1 = new SPINBOX(this) with (this.SPINBOXVERTICALGAP1) dataLink = form.labe00091.rowset.fields["verticalgap"] height = 22.0 left = 98.0 top = 245.0 width = 105.0 picture = "9999.9999" colorHighLight = "" rangeMax = 100 endwith this.TEXTPAPERWIDTH1 = new TEXT(this) with (this.TEXTPAPERWIDTH1) height = 22.0 left = 0.0 top = 280.0 width = 98.0 wrap = false alignVertical = 1 // Middle alignHorizontal = 2 // Right text = "Paperwidth:" endwith this.SPINBOXPAPERWIDTH1 = new SPINBOX(this) with (this.SPINBOXPAPERWIDTH1) dataLink = form.labe00091.rowset.fields["paperwidth"] height = 22.0 left = 98.0 top = 280.0 width = 105.0 picture = "9999.9999" colorHighLight = "" rangeMax = 100 endwith this.TEXTPAPERHEIGHT1 = new TEXT(this) with (this.TEXTPAPERHEIGHT1) height = 22.0 left = 0.0 top = 313.0 width = 98.0 wrap = false alignVertical = 1 // Middle alignHorizontal = 2 // Right text = "Paperheight:" endwith this.SPINBOXPAPERHEIGHT1 = new SPINBOX(this) with (this.SPINBOXPAPERHEIGHT1) dataLink = form.labe00091.rowset.fields["paperheight"] height = 22.0 left = 98.0 top = 313.0 width = 105.0 picture = "9999.9999" colorHighLight = "" rangeMax = 100 endwith this.TEXTMETRIC1 = new TEXT(this) with (this.TEXTMETRIC1) height = 22.0 left = 0.0 top = 337.0 width = 98.0 wrap = false alignVertical = 1 // Middle alignHorizontal = 2 // Right text = "Metric:" endwith this.METRICCOMBOBOX = new COMBOBOX(this) with (this.METRICCOMBOBOX) height = 24.0 left = 98.0 top = 337.0 width = 159.0 style = 2 // DropDownList dropDownHeight = 132.0 endwith this.BUTTONFIRST1 = new BUTTONFIRST(this) with (this.BUTTONFIRST1) height = 26.0 left = 494.0 top = 74.0 width = 70.0 endwith this.BUTTONPREVIOUS1 = new BUTTONPREVIOUS(this) with (this.BUTTONPREVIOUS1) height = 26.0 left = 494.0 top = 100.0 width = 70.0 endwith this.BUTTONNEXT1 = new BUTTONNEXT(this) with (this.BUTTONNEXT1) height = 26.0 left = 494.0 top = 126.0 width = 70.0 endwith this.BUTTONLAST1 = new BUTTONLAST(this) with (this.BUTTONLAST1) height = 26.0 left = 494.0 top = 152.0 width = 70.0 endwith this.BUTTONAPPEND1 = new BUTTONAPPEND(this) with (this.BUTTONAPPEND1) height = 26.0 left = 494.0 top = 185.0 width = 70.0 endwith this.BUTTONDELETE1 = new BUTTONDELETE(this) with (this.BUTTONDELETE1) height = 26.0 left = 494.0 top = 237.0 width = 70.0 endwith this.BUTTONSAVE1 = new BUTTONSAVE(this) with (this.BUTTONSAVE1) onClick = class::SAVE_ONCLICK height = 26.0 left = 494.0 top = 263.0 width = 70.0 endwith this.BUTTONABANDON1 = new BUTTONABANDON(this) with (this.BUTTONABANDON1) height = 26.0 left = 494.0 top = 289.0 width = 70.0 endwith this.BUTTONEDIT1 = new BUTTONEDIT(this) with (this.BUTTONEDIT1) height = 26.0 left = 494.0 top = 211.0 width = 70.0 endwith this.PUSHBUTTON1 = new PUSHBUTTON(this) with (this.PUSHBUTTON1) onClick = {; form.close()} height = 26.0 left = 494.0 top = 332.0 width = 70.0 text = "Exit" endwith this.TEXT1 = new TEXT(this) with (this.TEXT1) height = 75.0 left = 118.0 top = 368.0 width = 343.0 border = true fontSize = 8.0 fontItalic = true l0 = "This is a quick'n'dirty form aimed at allowing the developer to add new labels to the table used by dBASE (32-bit) to generate labels. The field names describe the details. If you are using a language other than English (US) you may wish to check the name " l0 += "of the table -- defined in the header." text = l0 borderStyle = 10 // Etched Out endwith this.TEXT2 = new TEXT(this) with (this.TEXT2) height = 19.0 left = 208.0 top = 89.0 width = 279.0 fontSize = 8.0 fontItalic = true text = "Distance from top of page to top of first label" borderStyle = 10 // Etched Out endwith this.TEXT3 = new TEXT(this) with (this.TEXT3) height = 19.0 left = 208.0 top = 111.0 width = 279.0 fontSize = 8.0 fontItalic = true text = "Distance from bottom of page to bottom of last label" borderStyle = 10 // Etched Out endwith this.TEXT4 = new TEXT(this) with (this.TEXT4) height = 19.0 left = 208.0 top = 134.0 width = 279.0 fontSize = 8.0 fontItalic = true text = "Distance from left of page to left of first column" borderStyle = 10 // Etched Out endwith this.TEXT5 = new TEXT(this) with (this.TEXT5) height = 19.0 left = 208.0 top = 155.0 width = 279.0 fontSize = 8.0 fontItalic = true text = "Distance from right of page to right of last column" borderStyle = 10 // Etched Out endwith this.TEXT6 = new TEXT(this) with (this.TEXT6) height = 19.0 left = 208.0 top = 178.0 width = 279.0 fontSize = 8.0 fontItalic = true text = "Width of label (left to right)" borderStyle = 10 // Etched Out endwith this.TEXT7 = new TEXT(this) with (this.TEXT7) height = 19.0 left = 208.0 top = 200.0 width = 279.0 fontSize = 8.0 fontItalic = true text = "Height of label (top to bottom)" borderStyle = 10 // Etched Out endwith this.TEXT8 = new TEXT(this) with (this.TEXT8) height = 19.0 left = 208.0 top = 222.0 width = 279.0 fontSize = 8.0 fontItalic = true text = "Distance (left to right) between two labels" borderStyle = 10 // Etched Out endwith this.TEXT9 = new TEXT(this) with (this.TEXT9) height = 34.0 left = 208.0 top = 243.0 width = 279.0 fontSize = 8.0 fontItalic = true text = "Distance (bottom of one label to top of next) between two labels" borderStyle = 10 // Etched Out endwith this.TEXT10 = new TEXT(this) with (this.TEXT10) height = 32.0 left = 208.0 top = 280.0 width = 279.0 fontSize = 8.0 fontItalic = true text = "Width of page (left to right) -- if using tractor feed, distance after tear-off ..." borderStyle = 10 // Etched Out endwith this.TEXT11 = new TEXT(this) with (this.TEXT11) height = 19.0 left = 208.0 top = 315.0 width = 279.0 fontSize = 8.0 fontItalic = true text = "Height of page (top to bottom)" borderStyle = 10 // Etched Out endwith this.FINDEF = new ENTRYFIELD(this) with (this.FINDEF) height = 22.0 left = 98.0 top = 40.0 width = 194.0 value = "" endwith this.TEXT12 = new TEXT(this) with (this.TEXT12) height = 16.0 left = 60.0 top = 42.0 width = 31.0 alignHorizontal = 2 // Right text = "Find: " endwith this.FINDBTN = new PUSHBUTTON(this) with (this.FINDBTN) onClick = class::FINDBTN_ONCLICK height = 30.0 left = 293.0 top = 36.0 width = 107.0 text = "Find Label" upBitmap = "RESOURCE #858" endwith this.rowset = this.labe00091.rowset function FINDBTN_onClick if empty( form.FindEF.value ) form.FindEF.setFocus() return endif local cFind cFind = form.FindEF.value.rightTrim() form.rowset.locateOptions := 3 // ignore case/length if not form.rowset.applyLocate( [description=']+cFind+['] ) msgbox( "Label not found!",; "Not found!", 16 ) endif return function Form_OnOpen form.MetricArray = new Array() form.MetricArray.add( "Twips" ) form.MetricArray.add( "Points" ) form.MetricArray.add( "Inches" ) form.MetricArray.add( "Centimeters" ) form.MetricArray.add( "Millimeters" ) form.MetricArray.add( "Pixels" ) form.MetricCombobox.dataSource = "ARRAY form.MetricArray" class::UpdateCombo() form.FINDEF.setFocus() return function UpdateCombo // make sure that the value in the rowset // is what's appearing in the combobox (morph!): n = form.rowset.fields["metric"].value form.MetricCombobox.value := form.metricArray[ n ] return function updateMetric // called from save // find it: n = form.MetricArray.scan( form.MetricCombobox.value ) form.rowset.fields["metric"].value = n return function Save_OnClick CLASS::UpdateMetric() this.form.rowset.save() return endclass