Download presentation
Presentation is loading. Please wait.
1
VB6.0 New Interaction Techniques Department of Computer Sciences University of Tampere, Finland September – December, 2003 Grigori Evreinov www.cs.uta.fi/~grse/ Software writing for NIT & usability testing
2
TAUCHI MMIG G. Evreinov p 01_23 23.09.2003 Objects (Controls) TextBox Label Frame CommandButton CheckBox Shape Image PictureBox MSFlexGrid Timer Menu Software writing for NIT Visual Basic and their general properties Top, Left, Height, Width ScaleMode ScaleTop, ScaleLeft ScaleHeight, ScaleWidth Enabled, Visible, Locked Index (array of objects), TabIndex Appearance, BackColor, BorderStyle Font, ForeColor, Alignment ToolTipText, MousePointer other properties KeyPreview (Form) MultiLine, ScrollBars, Text Caption, AutoSize, WordWrap, BackStyle Cancel (btn) Value Picture, Icon (Form) AutoRedraw (Form & PicB) Rows, Cols Interval
3
TAUCHI MMIG G. Evreinov p 02_23 23.09.2003 Software writing for NIT and their event procedures * Click, DblClick, KeyDown, KeyPress, KeyUp, MouseDown, MouseMove, MouseUp GotFocus, LostFocus Shape has no event procedures Timer Load, Activate, Initialize, Unload, Resize, Terminate Objects (Controls) TextBox Label Frame CommandButton CheckBox Shape Image PictureBox MSFlexGrid Timer Menu * a procedure is a block of code that performs some operation: Public (is available to all modules), Private (in the current module or form)
4
TAUCHI MMIG G. Evreinov p 03_23 23.09.2003 Software writing for NIT Variables and data types Boolean 2 bytes (storage size) True or False Integer (%)2 bytes -32,768 to 32,767 (256 x 256=65536) Long (& long integer) 4 bytes -2147483648 to +2147483647 (65536 x 65536=4294967296) Single (! single-precision) 4 bytes -3.402823E38 to -1.401298E-45 for “-” values; 1.401298E-45 to 3.402823E38 for “+” values. Double (# double-precision) 8 bytes -1.79769313486232E308 to -4.94065645841247E-324 for “-” values; 4.94065645841247E-324 to 1.79769313486232E308 for “+” values. String ($ fixed-length) Length of string in bytes 1 to approximately 65,400 “…” Variant (by default!) 16 bytes Any numeric value up to the range of a Double. Byte 1 byte 0 to 255
5
TAUCHI MMIG G. Evreinov p 04_23 23.09.2003 Software writing for NIT other Variables and data types String (variable-length) 10 bytes + string length 0 to approximately 2 billion characters (2Hb) Variant (with characters) 22 bytes + string length Same range as for variable- length String. Currency (@ scaled integer) 8 bytes-922,337,203,685,477.5808 to 922,337,203,685,477.5807 Date 8 bytes January 1, 100 to December 31, 9999 Object 4 bytes Any Object reference User-defined(using Type) Depends upon what elements are used The range of each element is the same as the range of its data type.
6
TAUCHI MMIG G. Evreinov p 05_23 23.09.2003 Software writing for NIT Declaration and converting functions * Dim str1 As Integer, cl1 As Integer Dim Xtmp As Integer Dim X As Single Dim nChar As Integer Dim CtrlMsk As Boolean Dim ArrWords(19) As String Dim LastFile As String, FileName As String CInt, CLng, CBool, CDate, CStr Xtmp = Cint(X) Dim a, b, c As Integer Variant to declare constant Const PI = 3.14159265 Const SND_LOOP = &H8 to declare function Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long * http://www.juicystudio.com/tutorial/vb/variables.htmlhttp://www.juicystudio.com/tutorial/vb/variables.html
7
TAUCHI MMIG G. Evreinov p 06_23 23.09.2003 Software writing for NIT Objects (Controls) Form, PictureBox TextBox, Label, Frame CommandButton CheckBox Shape Image MSFlexGrid, ListBox supports the following methods* Cls, Circle, Line, Pset, PaintPicture, PopupMenu, Hide Refresh, ZOrder, Move, Drag, SetFocus AddItem, Clear * a built-in procedure that performs an operation on a specific control or methods are actions that objects can perform
8
TAUCHI MMIG G. Evreinov p 07_23 23.09.2003 Software writing for NIT File System Object Methods CopyFile Used to copy an existing file. CopyFolder Used to copy an existing folder. CreateFolder Used to create a folder. CreateTextFile Used to create a text file. DeleteFile Used to delete a file. DeleteFolder Used to delete a folder. DriveExists Used to determine whether a drive exists. FileExists Used to determine whether a file exists. FolderExists Used to determine whether a folder exists. GetAbsolutePathName Used to return the full path name. GetDrive Used to return a specified drive. GetDriveName Used to return the drive name. GetFile Used to return a specified file. GetFileName Used to return the file name. GetFolder Used to return a specified folder. GetParentFolderName Used to return the name of the parent folder. GetTempName Used to create and return a string representing a file name. MoveFile Used to move a file. MoveFolder Used to move a folder. OpenTextFile Used to open an existing text file. Common Dialog Box Methods ShowColor Used to display the Color dialog box. ShowFont Used to display a list of fonts ShowHelp Used to display a Windows Help File ShowOpen Used to display the dialog to open files ShowPrinter Used to display the dialog to open files ShowSave similar to the ShowOpen method
9
TAUCHI MMIG G. Evreinov p 08_23 23.09.2003 Functions, most frequently used Abs(number) ‘b = Abs(-50) b = 50 Asc(string)‘b = Asc(“Apple”)b = 65 Dir(pathname,[ attributes]) returns the name of a file, directory, or folder that matches a specified pattern or file attribute FileName = App.Path & “\TWords.txt” strFile = Dir(FileName) If strFile <> “” Then… Error [(errornumber)] Integer that represents an error number Debug.Print Error(ErrorNumber) Hex (number) i = Hex(459) ‘= 1CB Rnd[(number)] returns a random number (0-1) before calling Rnd, use the Randomize statement without an argument to initialize the random-number generator based on the system timer. to produce random integers in a given range, use this formula: Int((upperbound - lowerbound + 1) * Rnd + lowerbound) here, upperbound is the highest number in the range, and lowerbound is the lowest number in the range. Software writing for NIT
10
TAUCHI MMIG G. Evreinov p 09_23 23.09.2003 Software writing for NIT Functions, most frequently used LoadPicture([stringexpression]) returns a picture object (by Commdlg or “….bmp”) imgImage.Picture = LoadPicture() Str(number) may be used to convert a non-String data type to a String data type bString = Str(-459.65) ‘ returns “-459.65” backward Val(string) InStr ([start, ]string1, string2[, compare]) returns the position of the first occurrence of one string within another Left(string, length) returns a specified number of characters from the left side of a string Len(string | varname) returns the number of chars in a string or the number of bytes required to store a variable LTrim(string), RTrim(string), Trim(string) return a copy of a string without: leading spaces (LTrim), trailing spaces (RTrim), or both (Trim). Mid(string, start[, length]) returns a specified number of chars from a string Right(string, length) returns a specified number of chars from the right side of a string StrComp(string1, string2[, compare]) performs a binary or textual comparison [ http://www.juicystudio.com/tutorial/vb/strings.html ] http://www.juicystudio.com/tutorial/vb/strings.html
11
TAUCHI MMIG G. Evreinov p 10_23 23.09.2003 Software writing for NIT Functions, most frequently used Sqr(number) returns the square root of a number Time returns a Variant of subtype Date indicating the current system time Timerreturns the number of sec that have elapsed since 12:00AM (midnight) GetTickCount retrieves the number of milliseconds that have elapsed since 12:00AM (midnight) or have elapsed since Windows CE was started MsgBox(prompt[, buttons * ] [, title] [, helpfile, context]) displays a message in a dialog box, waits for the user to click a button, and returns a value indicating which button the user clicked MsgBox “Error of opening” & FileName MsgBox “Input's error”,, “SmartStick” * (0–5) describes the number and type of buttons displayed in the dialog box; 1 – OK, 2 – Cancel, 3 – Abort, 4 – Retry, 5 – Ignore, 6 – Yes, 7 - No (16, 32, 48, 64) describes the icon style; (0, 256, 512, 768) determines which button is the default
12
TAUCHI MMIG G. Evreinov p 11_23 23.09.2003 Software writing for NIT Operators & Statements, most frequently used [Call] name [argumentlist] Call - optional keyword; name of the procedure to call; argumentlist - optional. Comma-delimited list of variables, arrays, or expressions to pass to the procedure.arraysexpressions Call PrintToDebugWindow ("Hello World") PrintToDebugWindow "Hello World" [Public | Private] Const constname [As type] = expression declares constants [Public | Private] Declare Sub name Lib "libname" [Alias "aliasname"] [([arglist])] or [Public | Private] Declare Function name Lib "libname" _ [Alias "aliasname"] [([arglist])] [As type] used at the module level to declare references to external procedures in a dynamic-link library (DLL) Public Declare Function sndPlaySound Lib “winmm.dll” Alias “sndPlaySoundA” _ (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long [ http://msdn.microsoft.com/library/en-us/vblr7/html/vastmConst.asp http://msdn.microsoft.com/library/en-us/vblr7/html/vastmConst.asp http://msdn.microsoft.com/library/en-us/vblr7/html/vastmCall.asp http://msdn.microsoft.com/library/en-us/vblr7/html/vastmDeclare.asp ]http://msdn.microsoft.com/library/en-us/vblr7/html/vastmDeclare.asp
13
TAUCHI MMIG G. Evreinov p 12_23 23.09.2003 Software writing for NIT Operators & Statements, most frequently used Dim varname[([subscripts])][, varname[([subscripts])]]... used at module, class, structure, procedure, or block level to declare and allocate storage space for variables varname - name of the variable, follows standard variable naming conventions subscripts - dimensions of an array variable ReDim [Preserve] varname(subscripts) [, varname(subscripts)]... used at procedure level to reallocate storage space for an array variable Do…Loop repeats a block of statements while a Boolean condition is True or until the condition becomes True For…Nextrepeats a group of statements a specified number of times And, Or, Not [ http://msdn.microsoft.com/library/en-us/vblr7/html/vastmDim.asp http://msdn.microsoft.com/library/en-us/vblr7/html/vastmDim.asp http://msdn.microsoft.com/library/en-us/vblr7/html/vastmReDim.asp http://msdn.microsoft.com/library/en-us/vblr7/html/vastmDo.asp http://msdn.microsoft.com/library/en-us/vblr7/html/vastmFor.asp ]http://msdn.microsoft.com/library/en-us/vblr7/html/vastmFor.asp
14
TAUCHI MMIG G. Evreinov p 13_23 23.09.2003 Software writing for NIT Operators & Statements, most frequently used Endterminates execution immediately Exit { Do | For | Function | Property | Select | Sub | Try | While } exits a procedure or block and transfers control immediately to the statement following the procedure call or the block definition Sub ExitStatementDemo() Dim I, iNum As Integer Do ' Set up infinite loop. For I = 1 To 1000 ' Loop 1000 times. iNum = Int(Rnd * 1000) ' Generate random numbers. Select Case iNum ' Evaluate random number. Case 7: Exit For ' If 7, exit For...Next. Case 29: Exit Do ' If 29, exit Do...Loop. Case 54: Exit Sub ' If 54, exit Sub procedure. End Select Next I Loop End Sub Close [number] to close the file (number) opened with the help of Open Load / Unload object [ http://msdn.microsoft.com/library/en-us/vblr7/html/vastmExit.asp http://msdn.microsoft.com/library/en-us/vblr7/html/vastmExit.asp http://msdn.microsoft.com/library/en-us/vblr7/html/vastmEnd.asphttp://msdn.microsoft.com/library/en-us/vblr7/html/vastmEnd.asp ] End End Function End If End Property End Select End Sub End Type End With Exit Do Exit For Exit Function Exit Property Exit Sub
15
TAUCHI MMIG G. Evreinov p 14_23 23.09.2003 Software writing for NIT Usability-testing software for…
16
Clear Data TAUCHI MMIG G. Evreinov p 15_23 23.09.2003 Software writing for NIT TWords.txt /phrases GridData1: test words/chars entered text /chars time per char, ms GridData2: char per word /phrase num. of entered words num. of strokes /clicks per word /phrase time per word/phrase, s lblTestSymbol txtText1 On-screen Keyboard Break test Test initialization Ctrl+K=>move keys SetSigns SetCharacters BackSp Statistics() Rtime, ms s (st.dev), ms Errors wpm TestTime, s lblSave_Click() GridData2_Click() to save column GridData1_Click() to save column txtPersonData comments… fraData WordsLoading SetTest lblOpen_Click() SetData Trial start Timer1 Timer2
17
TAUCHI MMIG G. Evreinov p 16_23 23.09.2003 Software writing for NIT TWords.txt /phrases GridData1: test words/chars entered text /chars time per char, ms lblTestSymbol txtText1 On-screen Keyboard txtPersonData comments… fraData WordsLoading Lesson1
18
TAUCHI MMIG G. Evreinov p 17_23 23.09.2003 Software writing for NIT TWords.txt /phrases GridData1: test words/chars entered text /chars time per char, ms GridData2: char per word /phrase num. of entered words num. of strokes /clicks per word /phrase time per word/phrase, s lblTestSymbol txtText1 On-screen Keyboard GridData2_Click() to save column GridData1_Click() to save column txtPersonData comments… fraData WordsLoading Lesson2
19
Clear Data TAUCHI MMIG G. Evreinov p 18_23 23.09.2003 Software writing for NIT TWords.txt /phrases GridData1: test words/chars entered text /chars time per char, ms GridData2: char per word /phrase num. of entered words num. of strokes /clicks per word /phrase time per word/phrase, s lblTestSymbol txtText1 On-screen Keyboard SetSigns SetCharacters BackSp lblSave_Click() GridData2_Click() to save column GridData1_Click() to save column txtPersonData comments… fraData WordsLoading lblOpen_Click() Lesson3
20
TAUCHI MMIG G. Evreinov p 19_23 23.09.2003 Software writing for NIT Text <> “” Lesson3 define the Length of the Text return into the TextBox play wave “Empty” an analysis of the last character the last Char = Linefeed remove two last chars in the TextBox put cursor at the end of the text play wave “Back Space” remove the last char in the TextBox put cursor at the end of the text play wave “Back Space” Yes No Yes No Exit Private Sub BackSp() * A sample of imaging for algorithm or procedure, description should be done in a separate paragraph
21
Clear Data TAUCHI MMIG G. Evreinov p 20_23 23.09.2003 Software writing for NIT TWords.txt /phrases GridData1: test words/chars entered text /chars time per char, ms GridData2: char per word /phrase num. of entered words num. of strokes /clicks per word /phrase time per word/phrase, s lblTestSymbol txtText1 On-screen Keyboard Ctrl+K=>move keys SetSigns SetCharacters BackSp lblSave_Click() GridData2_Click() to save column GridData1_Click() to save column txtPersonData comments… fraData WordsLoading lblOpen_Click() Q Lesson4
22
Clear Data TAUCHI MMIG G. Evreinov p 21_23 23.09.2003 Software writing for NIT TWords.txt /phrases GridData1: test words/chars entered text /chars time per char, ms GridData2: char per word /phrase num. of entered words num. of strokes /clicks per word /phrase time per word/phrase, s lblTestSymbol txtText1 On-screen Keyboard Break test Test initialization Ctrl+K=>move keys SetSigns SetCharacters BackSp lblSave_Click() GridData2_Click() to save column GridData1_Click() to save column txtPersonData comments… fraData WordsLoading SetTest lblOpen_Click() SetData Trial start Timer1 Timer2 Lesson5
23
Clear Data TAUCHI MMIG G. Evreinov p 22_23 23.09.2003 Software writing for NIT TWords.txt /phrases GridData1: test words/chars entered text /chars time per char, ms GridData2: char per word /phrase num. of entered words num. of strokes /clicks per word /phrase time per word/phrase, s lblTestSymbol txtText1 On-screen Keyboard Break test Test initialization Ctrl+K=>move keys SetSigns SetCharacters BackSp Statistics() Rtime, ms s (st.dev), ms Errors wpm TestTime, s lblSave_Click() GridData2_Click() to save column GridData1_Click() to save column txtPersonData comments… fraData WordsLoading SetTest lblOpen_Click() SetData Trial start Timer1 Timer2 Lesson6 SpotActivate
24
TAUCHI MMIG G. Evreinov p 23_23 23.09.2003 References http://msdn.microsoft.com/vbasic/ Visual Basic Language and Run-Time Reference http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vboriVBLangRefTopNode.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vaoriStatementsVBA.asp http://msdn.microsoft.com/vbasic/downloads/samples/default.asp VB tutorial http://www.juicystudio.com/tutorial/vb/http://www.juicystudio.com/tutorial/vb/ http://sunny.moorparkcollege.edu/~kmacone/docs/DataTypes.htm http://sunny.moorparkcollege.edu/~kmacone/docs/objProc-Prop.htm http://sunny.moorparkcollege.edu/~kmacone/docs/NamConv.htm http://www.thescarms.com/vbasic/ http://www.planetsourcecode.com Interactive Programming (COM132J2) http://www.infj.ulst.ac.uk/%7Ecnugent/teaching/com148j2/com148j2.htm http://www.fawcette.com/vsm/ http://www.devx.com/dotnet/Default.asp Usability testing http://www.tracksys.co.uk/Pages/Usability/usability.htmhttp://www.tracksys.co.uk/Pages/Usability/usability.htm Software writing for NIT
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.