home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / text_utl / parsed / select.bas < prev    next >
Encoding:
BASIC Source File  |  1994-09-25  |  2.9 KB  |  101 lines

  1. Option Explicit
  2. Dim mbResult%
  3. Dim mFuncSelected$
  4.  
  5. 'routine called by frmSelect to show the next form
  6. 'after unloading itself
  7. Sub GoNextForm (flgNextStep%)
  8.     Dim DynArray$()
  9.     Dim Temp$
  10.     Dim i%, dummy%, NumElements%
  11.  
  12.     
  13.     'assign the appropriate routine text to the appropriate
  14.     'label, removing the ampersands from the text
  15.     If flgNextStep% = FLG_PROCPARSE Then
  16.         'process the caption to remove the ampersand - another use for the
  17.         'ParseAndfillarray and ProcessArray Functions
  18.         NumElements% = ParseAndFillArray1%(mFuncSelected$, "&", DynArray$())
  19.         'ProcessArray$ will build a new string without new char(s) inserted
  20.         'if empty string is passed as the 2nd parameter
  21.         frmParse!lblCurFunc = ProcessArray$(DynArray$(), "", dummy%)
  22.         Screen.MousePointer = DEFAULT
  23.         frmParse.Show
  24.         frmParse.WindowState = NORMAL
  25.     Else 'flgNextStep% = FLG_MULTIDELIM
  26.         NumElements% = ParseAndFillArray1%(mFuncSelected$, "&", DynArray$())
  27.         frmMultiDelim!lblCurFunc = ProcessArray$(DynArray$(), "", dummy%)
  28.         Screen.MousePointer = DEFAULT
  29.         frmMultiDelim.Show
  30.         frmMultiDelim.WindowState = NORMAL
  31.     End If
  32.  
  33. End Sub
  34.  
  35. '9/25/94
  36. 'load form select, set its tag and controls, then display
  37. Sub SetfrmSelect (CurRoutine$, flgNextStep%)
  38.     Dim FuncSelected$
  39.     
  40.     Load frmSelect
  41.  
  42.     'initialize module-scope vars
  43.     mbResult% = False
  44.     mFuncSelected$ = ""
  45.  
  46.     'store next step flag in form tag
  47.     frmSelect.Tag = CStr(flgNextStep%)
  48.  
  49.     'set the value option based on CurRoutine$
  50.     If CurRoutine$ = "ParseAndFillArray1%()" Or CurRoutine$ = "" Then
  51.         frmSelect!optParse(0).Value = True
  52.     ElseIf CurRoutine$ = "ParseAndFillArray2%()" Then
  53.         frmSelect!optParse(1).Value = True
  54.     Else
  55.         frmSelect!optParse(2).Value = True
  56.     End If
  57.  
  58.     Screen.MousePointer = DEFAULT
  59.     frmSelect.Show MODAL
  60.  
  61.     If mbResult% = True Then
  62.         Screen.MousePointer = HOURGLASS
  63.         'set up next form to display based on info we now have
  64.         GoNextForm flgNextStep%
  65.     End If
  66.  
  67. End Sub
  68.  
  69. 'get the text of the option selected (the function
  70. 'name) and assign it to module-scope var.
  71. Sub SetFuncSelected (F As frmSelect, bResult%)
  72.     Dim i%
  73.  
  74.     If bResult% = True Then
  75.         'i represents index of optionbutton control array
  76.         'on frmSelect
  77.         For i = 0 To 2
  78.             If F!optParse(i).Value = True Then
  79.                 mFuncSelected$ = F!optParse(i).Caption
  80.                 Exit Sub
  81.             End If
  82.         Next i
  83.     Else
  84.     'modal dialog cancelled by user
  85.         mFuncSelected$ = ""
  86.     End If
  87. End Sub
  88.  
  89. Sub SetSelectResult (bResult%)
  90.     'based on whether user accepted a function
  91.     'from the modal form or cancelled, set module
  92.     'scope var. to true or false
  93.     If bResult% = True Then
  94.         mbResult% = True
  95.     Else
  96.         mbResult% = False
  97.     End If
  98.  
  99. End Sub
  100.  
  101.