topleft1.gif (9199 bytes)

Upgrade to 7.2

topleft2.gif (7412 bytes)

Macon Systems, Inc.
PO Box 1388,  Colorado Springs, CO  80901
Phone: (719) 520-1555    Fax: (719) 576-7626
Email: msi@maconsys.com

 

sharedborder150.gif (1798 bytes)

Up

sharedborder150.gif (1798 bytes)

 

rtn = GetViewSelection(win,select$,addtablename) (6.1)

Returns in select$ the selection clause for the view whose window handle is win. if addtablename=1 the table name this view is based on is prepended to each field name contained in the selection clause. This is required if select$ will be used for the selection clause of a report that contains more than one table. Set addtablename
to 0 otherwise.

rtn$ = SqlQuote(string$) (6.1)

Returns string$ enclosed in single quotes and each single quote contained in string$ is doubled up. Use this function to create a string constant for use in a SQL query.

Example: rtn$=SqlQuote("What's going on?")
rtn$ equals 'What''s going on?'

error$ = GetError() (6.1)

Returns the error message from the most recent call to EditRecord, SaveRecord, KeepBothRecord, or DeleteRecord. The error message is returned, even if the call to the function set the DisplayMsg flag to 1 or 2 to have the program display the error message. See DisplayMsg parameter below.

RedisplayView(win) (6.1)

Redisplays the view indicated by win. This forces a reload of all on-screen browse controls so they will correctly reflect any changes that have been made to their selected records.

EditRecord SaveRecord KeepBothRecord DeleteRecord Enhancements (6.1)

rtn = EditRecord(win,DisplayMsg)
rtn = SaveRecord(win,DisplayMsg)
rtn = KeepBothRecord(win,DisplayMsg)
rtn = DeleteRecord(win,DisplayMsg)

The optional parameter DisplayMsg controls the error messages returned by the program.

The allowed values are:

0 = Suppress all error messages and prompts. This is the default value if the DisplayMsg parameter is not included.

1 = Display all error messages and prompts. The SQL error button is removed for error dialogs. This is the best option for most situations.

2 = Display all error messages and prompts. The SQL error button is included on the error dialog.

CalendarFloating (6.2)

CalendarFloating Style  [, MaxDays , Xpos , Ypos , Title  ]

The Calendar tool is a floating calendar opened by selecting from the Main Menu Tools | Calendar from any place in the program.  When opened from the Main Menu, the calendar uses the default calendar style.  The CalendarFloating... statement displays the calendar using the selected options if it is not already displayed.  If the calendar is already displayed when this call is made, the calendar is redisplayed to reflect the style and other options specified in this call.

Style       sum of any combination of the following:

                1   Day State - Selected days can be displayed in bold digits.

                2   Multi Select - Multiple days can be selected.  the MaxDays  parameter specifies the maximum days that can be selected.

                4   Week Numbers - Week numbers will display on the left side of the calendar.

                8   No Today Circle - Removes the display of a red circle around today's date.

MaxDays   Maximum days for the selection if Multi Select is enabled.

Xpos,Ypos   Coordinates of the top left corner of the Calendar control.

Title        Title of the Calendar control

A single date or a range of dates can be selected.  See GetCalendarDate for details on retrieving the date or range of dates selected in the floating calendar.

If Style  = -1, the calendar is closed.

Related functions:   CalendarModal

Example:

CalendarFloating 1+2+4+0, 5, 200, 200, "My Title"

CalendarModal (6.2)

date$  = CalendarModal (Style  [ , MaxDays , Xpos , Ypos , Title  ) ]

Opens a modal calendar tool (modal means the user must select a date and close the tool before continuing).

Returns the selected date or range of dates.  If Cancel is clicked, the return date is blank.

Style       sum of any combination of the following:

                1   Day State - Selected days can be displayed in bold digits.

                2   Multi Select - Multiple days can be selected.  the MaxDays  parameter specifies the maximum days that can be selected.

                4   Week Numbers - Week numbers will display on the left side of the calendar.

                8   No Today Circle - Removes the display of a red circle around today's date.

MaxDays   Maximum days for the selection if Multi Select is enabled.

Xpos,Ypos   Coordinates of the top left corner of the Calendar control.

Title        Title of the Calendar control

Related functions:   CalendarFloating    GetCalendarDate

Example:

dim xdate$

xdate$ = CalendarModal(1+2+4+0, 5, 20, 60, "My Title")

msgbox xdate$

xdate$ = CalendarModal(0+0+4+8, 0, 0,  0, "Some Other Title")

msgbox xdate$

xdate$ = CalendarModal(0+0+4+8, 0 ,200,200, "Best Title")

msgbox xdate$

xdate$ = CalendarModal(1+2+0+0, 14,400,400)

msgbox xdate$

FieldIsChanged (6.2)

chg = FieldIsChanged (windowID , fldName )

Returns 1if fldName  has been changed, 0 if not.  Returns -1 if windowID  is not a valid view or fldName  is not a valid field in the table the view is based on.

windowID  is the windowID of the window this statement acts on.  If windowID = 0 the statement will be sent to the current active window.

Example:

'This example lists every changed field in the view

dim fldIndex&,fname$,vtname$

vtname$=GetViewTableName(0)

fldIndex = 1

fname$ = fieldnamefromindex(vtname$,fldIndex)

while fname$ <> ""

      if (FieldIsChanged(0,fname$)=1) then msgbox fname$

      fldIndex = fldIndex+1

      fname$ = FieldNameFromIndex(vtname$,fldIndex)

wend

FieldNameFromIndex (6.2)

fldName  = FieldNameFromIndex (tableName,  fldIndex )

Returns the name of the field whose index is fldIndex.  A field's index is it's numeric position within the table tableName, and ranges from 1 for the first primary key field in the table, to the total number of fields in the table.

Returns blank if tableName  is not a table in this database or fldIndex  is < 1 or > the number of fields in the table.

This command is useful for returning the names of all the fields in the table.

Example:

'This example lists every changed field in the view

dim fldIndex&,fname$,vtname$

vtname$=GetViewTableName(0)

fldIndex = 1

fname$ = fieldnamefromindex(vtname$,fldIndex)

while fname$ <> ""

      if (FieldIsChanged(0,fname$)=1) then msgbox fname$

      fldIndex = fldIndex+1

      fname$ = FieldNameFromIndex(vtname$,fldIndex)

wend 

GetBrowseColumnName (6.2)

fldName = GetBrowseColumnName (windowID, column )

Returns the name of the field whose browse column number is column in window windowID .

windowID is the windowID of the window this statement acts on. If windowID = 0 the statement will be sent to the current active window.

If windowID is not a valid view or the view is not in TV_BROWSE mode, this returns blank.

Example:

dim fname$

fname$ = GetBrowseColumnName(0,2) 'field name of second browse column

GetCalendarDate (6.2)

dateval$  = GetCalendarDate ( )

Returns the date currently selected in the floating Calendar tool opened by choosing main menu option Tools | Calendar from any point in the program.  If a single date has been selected, dateval$  contains a date in the format "yyyy-mm-dd".  If a range of dates has been selected, dateval$  contains the beginning and ending date of the date range in the format "yyyy-mm-dd yyyy-mm-dd", where a single space separates the starting date from the ending date.

Related functions:   CalendarFloating   CalendarModal

Example:

dim xdate$

xdate$ = GetCalendarDate()

msgbox xdate$

GetFieldInfo (6.2)

value = GetFieldInfo (tableName, fieldName, what )

Returns the following information about field fieldName in table tableName :

what     returned value

"C"     Computed field: 0=no, 1=formula, 2=edit formula, 3=validation formula

"F"     Format

"L"     Label

"P"     Protections for View=1, Edit=2. value contains the sum V+E. If both protections are turned on value will equal 3. View is allowed if value = 1 or 3, Edit is allowed if value >= 2. NOTE: This only works if a view based on tableName currently has the focus. value = -1 if fieldName is not a control in this view.

"R"     Required field: 1=is required, 0=not required

"T"     Type FT_SHORTINT FT_LONGINT FT_BYTE FT_LONGREAL FT_TEXT FT_MASK FT_MEMO FT_YESNO FT_COUNTER FT_CURRENCY FT_DATE FT_TIME FT_DATETIME FT_BINARY FT_OLE FT_IMAGE

"W"     Width (or Width.DecimalPts for currency, example: 6.2)

Example:

dim label$

label$ = GetFieldInfo("customer","nosales","L")

GetTableInfo (6.2)

rtn = GetTableInfo (tableName, keyCnt, fieldCnt, recCnt, counter, protections )

Returns the following information for table tableName.

keyCnt     Count of primary key fields

fieldCntt     Number of fields

recCnt     Number of records

counter     Current value of the counter field, which is the highest value in the counter field.

protections  Table protections for View=1, Edit=2, Add=4, Delete=8, and desigN=16. protections contains the sum V+E+A+D+N. If all protections are turned on protections will equal 31. To determine if a specific value is turned on, use the formula p - p mod n - int((p - p mod n) /(n*2))*(n*2), where p is protections, and n is 1 to 16 for the value you want to test for. This returns n if protection n is allowed, 0 if not.

rtn is 1 if tableName is a valid table in this database, 0 if not.

Example:

dim rtn%,keyCnt%,fieldCnt%,recCnt&,counter&,protections&

rtn = GetTableInfo("customer",keyCnt,fieldCnt,recCnt,counter,protections)

RecordStatus (6.2)

mode = RecordStatus (winID, page, startRec, endRec, StartCol, endCol )

Returns the following status information for window winID :

mode     Record mode: TV_FIND=1, TV_RECORD=2, TV_BROWSE=3, or TV_ADD=4. If winID is not a valid window, mode = 0.

page Currently selected page of the record.

startRec     Record # within this query of the first record currently selected. -1 if mode is TV_ADD or TV_FIND, or if the query selected 0 records. In TV_BROWSE mode, startRec = 0 means that all the records in the query have been selected. This is accomplished by clicking on a column title. This variable should be a long.

endRec     Record # within this query of the last record currently selected. This is the same as startRec if mode is TV_RECORD. May be greater than startRec if mode is TV_BROWSE. -1 if mode is TV_ADD or TV_FIND. This variable should be a long.

startCol     Column # of the column that has the focus. In TV_BROWSE this is the first column selected. In TV_BROWSE mode, startCol = 0 means that all the columns in this page of the record have been selected. This is accomplished by clicking on a record #.

endCol     In TV_BROWSE this is the last column selected. In the other modes, this is the same as startCol.

winID is the windowID of the window this statement acts on. If winID = 0 the statement will be sent to the current active window.

Example:

dim mode%,page%,stRec&,endRec&,stCol%,endCol%,col%

mode = recordstatus(0,page,stRec,endRec,stCol,endCol)

msgbox mode & " " & page & " " & stRec & " " & _

endRec & " " & stCol & " " & endCol

ShowHideField (6.2)

ShowHideField windowID, fldname, show,  [ page ]

Shows or hides a field or control on a view, and sets the enabled status for the field. This command can be applied to every field and control on a page or all pages of the view by use of the optional page  parameter and using a blank fldname.

This command works on all of the view modes TV_FIND, TV_ADD, TV_RECORD and TV_BROWSE at the same time.  Show and Hide settings for the fields which are set when the view is in one of these modes, are retained when the mode is changed to any other mode.  An effective procedure to support different settings in each mode is to use the Enter Mode macro for each mode to control the desired field status settings when that mode is entered.  i.e: Enter Add Mode Macro, Enter Record Mode Macro, Enter Find Mode Macro, and  Enter Browse Mode Macro.  See View Settings: Macro.

NOTE: Only fields and controls that have been specified as Visible on the Visibility tab of the View Field Properties Wizard can be controlled by this command.  See View Field Properties: Visibility.

windowID  is the windowID of the window this statement acts on.  If windowID = 0 the statement will be sent to the current active window.

show  = 0 to hide the field or control, 1 to show the field in disabled mode, and 2 to show the field in enabled mode.  A disabled field is visible and the cursor can rest on the field, but data input is disabled.

page  = 1 to max page number, affects only fields on the page indicated by page. page =999 affects fields on every page of the view.  When page  is > 0 and fldname  is blank every field on the page (or all pages if page =999) is affected by the ShowHideField command.  It may be necessary to use this parameter if you have copies of the same field on several pages, and you only want this command to affect the field on a particular page.

Example:

dim win1 as long

win1 = LoadView("Invoice all Fields",TV_RECORD)

ShowHideField win1,"Customer",0   'hides the field "Customer"

WaitBox (6.2)

WaitBox time  [, Message,  Title,  Progress ]

Places a window on the screen for the time in thousandths of a second with your message in the box.  If no message is specified, there will be a pause for the time specified and no message box.  An optional Title can be given.

An optional Progress  can be used to allow the waitbox to be used as a progress box.  For this purpose, the WaitBox is displayed on the first call to WaitBox with Progress  = 1 and control returns immediately to the calling macro, with the WaitBox displayed on the screen.  Successive calls with Progress  = 2 can be made to update the Message  displayed.  A final call with Progress  = 3 closes the WaitBox.

Example:

WaitBox 1000,"Your Message", "Your Title"      'displays message for 1 second

WaitBox 100             'waits for 1/10 second, no message box

 

Example as a progress box:

WaitBox 0,"Initial Message","Your Title",1  'displays progress box

WaitBox 2000      'some process that takes a while

WaitBox 0,"Second Message","",2              'updates message

WaitBox 2000      'more processes

WaitBox 0,"Third Message","",2              'updates message again

WaitBox 2000      'more processes

WaitBox 0,"","",3                           'closes progress box