Article ID: 138616
Article Last Modified on 2/11/2000
*-- Begin Program
*-- Create an array from which to load records in a table.
LOCAL ARRAY aBunchONums[3,1]
*-- Create a table
CREATE TABLE testtube FREE (number n(14,4))
*-- Load three records in the table with random numbers.
=RAND(-1)
FOR i = 1 to 3
aBunchONums[i] = RAND()*SECONDS()*VAL(sys(11, date()))/100
ENDFOR
APPEND FROM ARRAY aBunchONums
GO TOP
*-- Instantiate a form based on custom form class, TestForm.
frmMyForm = CREATEOBJECT("TestForm")
*-- Add a text box to the form with format and picture clause.
frmMyForm.addobject("txbFooBox", "TEXTBOX")
WITH frmMyForm.txbFooBox
.ControlSource = "testtube.number"
.Format = "KZ^"
.InputMask = "999999999.9999"
.Top = 5
.Left = 15
.Visible = .T.
.Width = 100 && <== change this value
ENDWITH
*-- Display the form.
frmMyForm.show
READ EVENTS
*-- Define a custom class based on the FORM baseclass.
DEFINE CLASS TestForm AS FORM
CAPTION = "SciNot Test"
AUTOCENTER = .T.
HEIGHT = 120
WIDTH = 140
*-- Add command button to move between records.
ADD OBJECT cmdNext AS COMMANDBUTTON ;
WITH ;
TOP = 50, ;
LEFT = 20, ;
HEIGHT = 24, ;
CAPTION = "Next"
*-- Add command button to exit the program (form).
ADD OBJECT cmdQuit AS COMMANDBUTTON ;
WITH ;
TOP = 80, ;
LEFT = 20, ;
HEIGHT = 24, ;
CAPTION = "Quit"
*-- Add custom code to the Click event of cmdNext.
PROCEDURE cmdNext.click
SKIP
IF EOF()
GO TOP
ENDIF
THISFORM.REFRESH
ENDPROC
*-- Add custom code to the Click event of cmdQuit.
PROCEDURE cmdQuit.click
THISFORM.Release
CLEAR EVENTS
ENDPROC
ENDDEFINE
*-- End custom class definition.
*-- End program.
Run this program. Press the TAB key until the text box has focus. Note the
displayed value changes when you move into the text box.
.Width = 120
Run the changed program. Press the TAB key until the text box has the
focus. Now the displayed value does not change when you move into the text
box.
Additional query words: VFoxWin
Keywords: KB138616