[ Pobierz całość w formacie PDF ]
.Title$ This string value is the title of the user dialog.If this isomitted, there is no title.dialogfunc The function name that implements the DialogFunc for thisUserDialog.If this is omitted, the UserDialog doesn t have adialogfunc.User Dialog Item One of: CancelButton, CheckBox, ComboBox,DropListBox, GroupBox, ListBox, OKButton, OptionButton,OptionGroup, PushButton, Text, TextBox.See also Dim As UserDialogExample Sub MainBegin Dialog UserDialog 200,120Text 10,10,180,15, Please push the OK buttonOKButton 80,90,40,20End DialogDim dlg As UserDialogDialog dlg show dialog (wait for OK)End Sub98 / Chapter 8Boolean Data TypeDescription A True or False value.Byte Data TypeDescription An eight-bit unsigned integer value.Call InstructionSyntax Call name[(arglist)]-or-name[arglist]Description Evaluates the arglist and calls subroutine or function name using thosevalues.Sub (or function) name must be previously defined by either aSub (or Function) definition.If name is a function, then the result isdiscarded.If Call is omitted, then the name must be a subroutine and thearglist is not enclosed in parens.See also Declare, SubExample Sub Show(Title$,Value)Debug.Print Title$;"=";ValueEnd SubSub MainCall Show( 2000/9",2000/9) 222.2222222222Show 10 The nth Push button was pressed.See also Begin Dialog, Dim As UserDialogExample Sub MainBegin Dialog, Dim As UserDialog 200,120Text 10,10,180,15,"Please push the OK button"OKButton 80,90,40,20End Dialog124 / Chapter 8 Dim dlg As UserDialogDialog dlg show dialog (wait for OK)End SubDialogFunc PrototypeSyntax Function dialogfunc (DlgItem$, Action%, SuppValue%) _As BooleanSelect Case Action%Case 1 Dialog box initialization.Case 2 Value changing or button pressed.Case 3 TextBox or ComboBox text changed.Case 4 Focus changed.Case 5 Idle.End SelectEnd FunctionDescription A dialogfunc implements the dynamic dialog capabilities.Parameter DescriptionDlgItem This string value is the name of the user dialog item s field.Action This numeric value indicates what action the dialog function isbeing asked to do.SuppValue This numeric value provides additional information for someactions.Action Description1 Dialog box initialization.DlgItem is a null string; SuppValue iszero.2 CheckBox, DropListBox, ListBox, or Option Group: DlgItem svalue has changed.SuppValue is the new value.3 ComboBox or TextBox: DlgItem s text changed and is losingfocus.SuppValue is the number of characters.4 Item DlgItem is gaining focus.SuppValue is the item that is losingfocus.(The first item is 0, the second is 1, etc.)5 Idle processing.DlgItem is a null string.DlgItem is a null string.SuppValue is zero.Set dialogfunc = True to continue receivingidle actions.Language Reference / 125See also Begin DialogExample Sub MainBegin Dialog UserDialog 200,120,.DialogFuncText 10,10,180,15,"Please push the OK button"TextBox 10,40,180,15,.TextOKButton 30,90,60,20PushButton 110,90,60,20,"&Hello"End DialogDim dlg As UserDialogDebug.Print Dialog(dlg)End SubFunction DialogFunc%(DlgItem$, Action%, SuppValue%)Debug.Print Action= ;Action%0 Debug.Print DlgItem$;"=""";DlgText$(DlgItem$);""""Debug.Print SuppValue= ;SuppValue%Select Case Action%Case 1BeepCase 2If DlgItem$ = Hello ThenMsgBox HelloDialogFunc% = True do not exit the dialogEnd IfCase 4Debug.Print DlgFocus= "";DlgFocus();""""End SelectEnd FunctionDim DefinitionSyntax Dim name[type] [([dim[,.]])] [As [New] type] [,.]Description Dimensions var array(s) using the dims to establish the minimum andmaximum index values for each dimension.If the dims are omitted, ascalar (single value) variable is defined.A dynamic array is declaredusing ( ), without any dims.It must be ReDimensioned before it can beused.See also Begin Dialog, Dialog, Private, Public, ReDim, Static126 / Chapter 8Example Sub DoIt(Size)Dim C0,C1(),C2(2,3)ReDim C1(Size) dynamic arrayC0 = 1C1(0) = 2C2(0,0) = 3Debug.Print C0;C1(0);C2(0,0) 1 2 3End SubSub MainDoIt 1End SubDir$ FunctionSyntax Dir[$] ([Pattern$], [AttribMask])Description Scans a directory for the first file matching Pattern$.Parameter DescriptionPattern$ This string value is the path and name of the file-search pattern.Ifthis value is omitted, the function scans for the pattern specifiedpreviously.Each macro has its own independent search.A pathrelative to the current directory can be used.AttribMask This numeric value controls which files are found, based on theattributes of the file.See also GetAttr( )Example Sub MainF$ = Dir$( *.* )While F$ Debug.Print F$F$ = Dir$()WendEnd SubDlgControlId FunctionSyntax DlgControlId(DlgItem|$)Language Reference / 127Description Returns the ID of the field s window.This instruction/function must becalled directly or indirectly from a dialogfunc.Parameter DescriptionDlgItem|$ If this is a numeric value, then it is the dialog-item number.Thefirst item is 0, the second is 1, etc.If DlgItem is a string value,then it is the dialog item s field name.Example Sub MainBegin Dialog UserDialog 200,120,
[ Pobierz całość w formacie PDF ]