home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 February / PCWorld_2006-02_cd.bin / software / vyzkuste / triky / triky.exe / autoit-v3-setup.exe / Examples / msgboxwizard.au3 < prev    next >
Text File  |  2005-01-20  |  18KB  |  374 lines

  1. ;===============================================================================
  2. ;
  3. ; Program Name:     MsgBoxWizard()
  4. ; Description:      Generate the MessageBox function code according to the user 
  5. ;                   choices
  6. ; Requirement(s):   None
  7. ; Return Value(s):  None
  8. ; Author(s):        Giuseppe Criaco <gcriaco@quipo.it>
  9. ;
  10. ;===============================================================================
  11. ;
  12. #include <GUIConstants.au3>
  13.  
  14. Global $iFlag, $Button, $msgbox, $asMsgText
  15.  
  16. GUICreate("MsgBox Wizard v.1.0", 440, 540, 100, 100)  ; will create a dialog box 
  17.  
  18. GUICtrlCreateLabel("Title", 10, 5, 30)
  19. $TITLE = GUICtrlCreateInput("", 10, 20, 420, 20)
  20. GUICtrlSetState ( -1, $GUI_FOCUS)
  21. GUICtrlSetTip(-1, "The title of the message box.")
  22. GUICtrlCreateLabel("Text", 10, 50, 30)
  23. $TEXT = GUICtrlCreateEdit("", 10, 65, 420, 100, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_WANTRETURN)
  24. GUICtrlSetTip(-1, "The text of the message box.")
  25.  
  26. GUICtrlCreateGroup("Icons", 10, 170, 200, 130)
  27. $optWarning = GUICtrlCreateRadio("Warning", 20, 190, 100, 20)
  28. GUICtrlSetState(-1, $GUI_CHECKED)
  29. $optInfo = GUICtrlCreateRadio("Informational", 20, 210, 100, 20)
  30. $optCritical = GUICtrlCreateRadio("Critical", 20, 230, 100, 20)
  31. $optQuestion = GUICtrlCreateRadio("Question", 20, 250, 100, 20)
  32. $optNoIcon = GUICtrlCreateRadio("None", 20, 270, 100, 20)
  33. GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group
  34.  
  35. GUICtrlCreateGroup("Modality", 10, 310, 200, 90)
  36. $optApplication = GUICtrlCreateRadio("Application", 20, 330, 100, 20)
  37. GUICtrlSetState(-1, $GUI_CHECKED)
  38. $optSysModal = GUICtrlCreateRadio("System Modal", 20, 350, 100, 20)
  39. $optTaskModal = GUICtrlCreateRadio("Task Modal", 20, 370, 100, 20)
  40. GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group
  41.  
  42. GUICtrlCreateGroup("Buttons", 230, 170, 200, 170)
  43. $optOK = GUICtrlCreateRadio("OK", 240, 190, 100, 20)
  44. GUICtrlSetState(-1, $GUI_CHECKED)
  45. $optOkCancel = GUICtrlCreateRadio("OK, Cancel", 240, 210, 100, 20)
  46. $optYesNo = GUICtrlCreateRadio("Yes, No", 240, 230, 100, 20)
  47. $optYesNoCancel = GUICtrlCreateRadio("Yes, No, Cancel", 240, 250, 100, 20)
  48. $optAbortRetryIgnore = GUICtrlCreateRadio("Abort, Retry, Ignore", 240, 270, 120, 20)
  49. $optRetryCancel = GUICtrlCreateRadio("Retry, Cancel", 240, 290, 100, 20)
  50. $optCancelRetryContinue = GUICtrlCreateRadio("Cancel, Retry, Continue", 240, 310, 130, 20)
  51. GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group
  52.  
  53. GUICtrlCreateGroup("Miscellaneous", 10, 410, 200, 90)
  54. $optNothing = GUICtrlCreateRadio("Nothing", 20, 430, 100, 20)
  55. GUICtrlSetState(-1, $GUI_CHECKED)
  56. $optTopMost = GUICtrlCreateRadio("Top-most attribute set", 20, 450, 130, 20)
  57. $optRightJust = GUICtrlCreateRadio("Right-justified title/text", 20, 470, 150, 20)
  58. GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group
  59.  
  60. GUICtrlCreateGroup("Default Buttons", 230, 350, 200, 90)
  61. $optFirst = GUICtrlCreateRadio("First Button", 240, 370, 130, 20)
  62. GUICtrlSetState(-1, $GUI_CHECKED)
  63. $optSecond = GUICtrlCreateRadio("Second Button", 240, 390, 130, 20)
  64. GUICtrlSetState(-1, $GUI_DISABLE)
  65. $optThird = GUICtrlCreateRadio("Third Button", 240, 410, 130, 20)
  66. GUICtrlSetState(-1, $GUI_DISABLE)
  67. GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group
  68.  
  69. GUICtrlCreateGroup("Timeout", 230, 450, 200, 50)
  70. $Timeout = GUICtrlCreateInput("", 240, 470, 100, 20, $ES_NUMBER)
  71. GUICtrlSetTip(-1, "Optional Timeout in seconds. After the timeout has elapsed the message box will be automatically closed.")
  72. GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group
  73.  
  74. $BTNPREVIEW = GUICtrlCreateButton("&Preview", 10, 510, 100)
  75. GUICtrlSetTip(-1, "Show the MessageBox")
  76. $BTNCOPY = GUICtrlCreateButton("&Copy", 120, 510, 100)
  77. GUICtrlSetTip(-1, "Copy the generated AutoIt code to the Clipboard")
  78. $BTNEXIT = GUICtrlCreateButton("&Exit", 230, 510, 100)
  79. GUICtrlSetTip(-1, "Quit the program")
  80.  
  81. $Button = $optOK
  82.  
  83. GUISetState()       ; will display an empty dialog box
  84.  
  85. ; Run the GUI until the dialog is closed
  86. While 1
  87.    $MSG = GUIGetMsg()
  88.    Select
  89.       Case $MSG = $GUI_EVENT_CLOSE Or $MSG = $BTNEXIT
  90.          Exit
  91.          
  92.       Case $MSG = $optOK
  93.          $Button = $optOK
  94.          GUICtrlSetState($optFirst, $GUI_CHECKED)
  95.          GUICtrlSetState($optFirst, $GUI_ENABLE)
  96.          GUICtrlSetState($optSecond, $GUI_DISABLE)
  97.          GUICtrlSetState($optThird, $GUI_DISABLE)
  98.          
  99.       Case $MSG = $optOkCancel
  100.          $Button = $optOkCancel
  101.          GUICtrlSetState($optFirst, $GUI_CHECKED)
  102.          GUICtrlSetState($optFirst, $GUI_ENABLE)
  103.          GUICtrlSetState($optSecond, $GUI_ENABLE)
  104.          GUICtrlSetState($optThird, $GUI_DISABLE)
  105.          
  106.       Case $MSG = $optYesNo
  107.          $Button = $optYesNo
  108.          GUICtrlSetState($optFirst, $GUI_CHECKED)
  109.          GUICtrlSetState($optFirst, $GUI_ENABLE)
  110.          GUICtrlSetState($optSecond, $GUI_ENABLE)
  111.          GUICtrlSetState($optThird, $GUI_DISABLE)
  112.          
  113.       Case $MSG = $optYesNoCancel
  114.          $Button = $optYesNoCancel
  115.          GUICtrlSetState($optFirst, $GUI_CHECKED)
  116.          GUICtrlSetState($optFirst, $GUI_ENABLE)
  117.          GUICtrlSetState($optSecond, $GUI_ENABLE)
  118.          GUICtrlSetState($optThird, $GUI_ENABLE)
  119.          
  120.       Case $MSG = $optAbortRetryIgnore
  121.          $Button = $optAbortRetryIgnore
  122.          GUICtrlSetState($optFirst, $GUI_CHECKED)
  123.          GUICtrlSetState($optFirst, $GUI_ENABLE)
  124.          GUICtrlSetState($optSecond, $GUI_ENABLE)
  125.          GUICtrlSetState($optThird, $GUI_ENABLE)
  126.          
  127.       Case $MSG = $optRetryCancel
  128.          $Button = $optRetryCancel
  129.          GUICtrlSetState($optFirst, $GUI_CHECKED)
  130.          GUICtrlSetState($optFirst, $GUI_ENABLE)
  131.          GUICtrlSetState($optSecond, $GUI_ENABLE)
  132.          GUICtrlSetState($optThird, $GUI_DISABLE)
  133.          
  134.       Case $MSG = $optCancelRetryContinue
  135.          $Button = $optCancelRetryContinue
  136.          GUICtrlSetState($optFirst, $GUI_CHECKED)
  137.          GUICtrlSetState($optFirst, $GUI_ENABLE)
  138.          GUICtrlSetState($optSecond, $GUI_ENABLE)
  139.          GUICtrlSetState($optThird, $GUI_ENABLE)
  140.          
  141.       Case $MSG = $BTNPREVIEW
  142.          MsgBox(_SetFlag($iFlag), GUICtrlRead($TITLE), GUICtrlRead($TEXT), GUICtrlRead($Timeout))
  143.          
  144.       Case $MSG = $BTNCOPY
  145.          $asMsgText = StringSplit(GUICtrlRead($TEXT), @CRLF, 1)
  146.          If $asMsgText[0] = 1 Then
  147.             $sText = GUICtrlRead($TEXT)
  148.          Else
  149.             $sText = $asMsgText[1]
  150.             
  151.             For $iCtr = 2 To $asMsgText[0]
  152.                $sText = $sText & Chr(34) & " & @CRLF & " & Chr(34) & $asMsgText[$iCtr]
  153.             Next
  154.             
  155.          EndIf
  156.          
  157.          Select
  158.             Case $Button = $optOK
  159.                If GUICtrlRead($Timeout) = "" Then
  160.                   $msgbox = "MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  161.                          & Chr(34) & $sText & Chr(34) & ")"
  162.                Else
  163.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  164.                         "$iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  165.                          & Chr(34) & $sText & Chr(34) & "," & GUICtrlRead($Timeout) & ")" & @CRLF & _
  166.                         "Select" & @CRLF & _
  167.                         "   Case $iMsgBoxAnswer = -1 ;Timeout" & @CRLF & @CRLF & _
  168.                         "   Case Else                ;OK" & @CRLF & @CRLF & _
  169.                         "EndSelect"            
  170.                EndIf
  171.                
  172.             Case $Button = $optOkCancel
  173.                If GUICtrlRead($Timeout) = "" Then
  174.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  175.                         "$iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  176.                          & Chr(34) & $sText & Chr(34) & ")" & @CRLF & _
  177.                         "Select" & @CRLF & _
  178.                         "   Case $iMsgBoxAnswer = 1 ;OK" & @CRLF & @CRLF & _
  179.                         "   Case $iMsgBoxAnswer = 2 ;Cancel" & @CRLF & @CRLF & _
  180.                         "EndSelect"            
  181.                Else
  182.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  183.                         "$iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  184.                          & Chr(34) & $sText & Chr(34) & "," & GUICtrlRead($Timeout) & ")" & @CRLF & _
  185.                         "Select" & @CRLF & _
  186.                         "   Case $iMsgBoxAnswer = 1  ;OK" & @CRLF & @CRLF & _
  187.                         "   Case $iMsgBoxAnswer = 2  ;Cancel" & @CRLF & @CRLF & _
  188.                         "   Case $iMsgBoxAnswer = -1 ;Timeout" & @CRLF & @CRLF & _
  189.                         "EndSelect"            
  190.                EndIf
  191.                
  192.             Case $Button = $optYesNo
  193.                If GUICtrlRead($Timeout) = "" Then
  194.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  195.                         "$iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  196.                          & Chr(34) & $sText & Chr(34) & ")" & @CRLF & _
  197.                         "Select" & @CRLF & _
  198.                         "   Case $iMsgBoxAnswer = 6 ;Yes" & @CRLF & @CRLF & _
  199.                         "   Case $iMsgBoxAnswer = 7 ;No" & @CRLF & @CRLF & _
  200.                         "EndSelect"
  201.                Else
  202.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  203.                         "iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  204.                          & Chr(34) & $sText & Chr(34) & "," & GUICtrlRead($Timeout) & ")" & @CRLF & _
  205.                         "Select" & @CRLF & _
  206.                         "   Case $iMsgBoxAnswer = 6  ;Yes" & @CRLF & @CRLF & _
  207.                         "   Case $iMsgBoxAnswer = 7  ;No" & @CRLF & @CRLF & _
  208.                         "   Case $iMsgBoxAnswer = -1 ;Timeout" & @CRLF & @CRLF & _
  209.                         "EndSelect"
  210.                EndIf
  211.                
  212.             Case $Button = $optYesNoCancel
  213.                If GUICtrlRead($Timeout) = "" Then
  214.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  215.                         "$iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  216.                          & Chr(34) & $sText & Chr(34) & ")" & @CRLF & _
  217.                         "Select" & @CRLF & _
  218.                         "   Case $iMsgBoxAnswer = 6 ;Yes" & @CRLF & @CRLF & _
  219.                         "   Case $iMsgBoxAnswer = 7 ;No" & @CRLF & @CRLF & _
  220.                         "   Case $iMsgBoxAnswer = 2 ;Cancel" & @CRLF & @CRLF & _
  221.                         "EndSelect"
  222.                Else
  223.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  224.                         "$iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  225.                          & Chr(34) & $sText & Chr(34) & "," & GUICtrlRead($Timeout) & ")" & @CRLF & _
  226.                         "Select" & @CRLF & _
  227.                         "   Case $iMsgBoxAnswer = 6  ;Yes" & @CRLF & @CRLF & _
  228.                         "   Case $iMsgBoxAnswer = 7  ;No" & @CRLF & @CRLF & _
  229.                         "   Case $iMsgBoxAnswer = 2  ;Cancel" & @CRLF & @CRLF & _
  230.                         "   Case $iMsgBoxAnswer = -1 ;Timeout" & @CRLF & @CRLF & _
  231.                         "EndSelect"
  232.                EndIf
  233.                
  234.             Case $Button = $optAbortRetryIgnore
  235.                If GUICtrlRead($Timeout) = "" Then
  236.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  237.                         "$iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  238.                          & Chr(34) & $sText & Chr(34) & ")" & @CRLF & _
  239.                         "Select" & @CRLF & _
  240.                         "   Case $iMsgBoxAnswer = 3 ;Abort" & @CRLF & @CRLF & _
  241.                         "   Case $iMsgBoxAnswer = 4 ;Retry" & @CRLF & @CRLF & _
  242.                         "   Case $iMsgBoxAnswer = 5 ;Ignore" & @CRLF & @CRLF & _
  243.                         "EndSelect"
  244.                Else
  245.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  246.                         "$iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  247.                          & Chr(34) & $sText & Chr(34) & "," & GUICtrlRead($Timeout) & ")" & @CRLF & _
  248.                         "Select" & @CRLF & _
  249.                         "   Case $iMsgBoxAnswer = 3  ;Abort" & @CRLF & @CRLF & _
  250.                         "   Case $iMsgBoxAnswer = 4  ;Retry" & @CRLF & @CRLF & _
  251.                         "   Case $iMsgBoxAnswer = 5  ;Ignore" & @CRLF & @CRLF & _
  252.                         "   Case $iMsgBoxAnswer = -1 ;Timeout" & @CRLF & @CRLF & _
  253.                         "EndSelect"
  254.                EndIf
  255.                
  256.             Case $Button = $optRetryCancel
  257.                If GUICtrlRead($Timeout) = "" Then
  258.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  259.                         "$iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  260.                          & Chr(34) & $sText & Chr(34) & ")" & @CRLF & _
  261.                         "Select" & @CRLF & _
  262.                         "   Case $iMsgBoxAnswer = 4 ;Retry" & @CRLF & @CRLF & _
  263.                         "   Case $iMsgBoxAnswer = 2 ;Cancel" & @CRLF & @CRLF & _
  264.                         "EndSelect"            
  265.                Else
  266.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  267.                         "$iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  268.                          & Chr(34) & $sText & Chr(34) & "," & GUICtrlRead($Timeout) & ")" & @CRLF & _
  269.                         "Select" & @CRLF & _
  270.                         "   Case $iMsgBoxAnswer = 4  ;Retry" & @CRLF & @CRLF & _
  271.                         "   Case $iMsgBoxAnswer = 2  ;Cancel" & @CRLF & @CRLF & _
  272.                         "   Case $iMsgBoxAnswer = -1 ;Timeout" & @CRLF & @CRLF & _
  273.                         "EndSelect"            
  274.                EndIf
  275.                
  276.             Case $Button = $optCancelRetryContinue
  277.                If GUICtrlRead($Timeout) = "" Then
  278.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  279.                         "$iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  280.                          & Chr(34) & $sText & Chr(34) & ")" & @CRLF & _
  281.                         "Select" & @CRLF & _
  282.                         "   Case $iMsgBoxAnswer = 2 ;Cancel" & @CRLF & @CRLF & _
  283.                         "   Case $iMsgBoxAnswer = 10 ;Try Again" & @CRLF & @CRLF & _
  284.                         "   Case $iMsgBoxAnswer = 11 ;Continue" & @CRLF & @CRLF & _
  285.                         "EndSelect"            
  286.                Else
  287.                   $msgbox = "Dim $iMsgBoxAnswer" & @CRLF & _
  288.                         "$iMsgBoxAnswer = MsgBox(" & _SetFlag($iFlag) & "," & Chr(34) & GUICtrlRead($TITLE) & Chr(34) & "," _
  289.                          & Chr(34) & $sText & Chr(34) & "," & GUICtrlRead($Timeout) & ")" & @CRLF & _
  290.                         "Select" & @CRLF & _
  291.                         "   Case $iMsgBoxAnswer = 2  ;Cancel" & @CRLF & @CRLF & _
  292.                         "   Case $iMsgBoxAnswer = 10 ;Try Again" & @CRLF & @CRLF & _
  293.                         "   Case $iMsgBoxAnswer = 11 ;Continue" & @CRLF & @CRLF & _
  294.                         "   Case $iMsgBoxAnswer = -1 ;Timeout" & @CRLF & @CRLF & _
  295.                         "EndSelect"            
  296.                EndIf
  297.          EndSelect
  298.          
  299.          ClipPut($msgbox)
  300.    EndSelect
  301.    
  302. Wend
  303.  
  304. ;===============================================================================
  305. ;
  306. ; Function Name:    _SetFlag()
  307. ; Description:      Set the flag that indicates the type of message box and the 
  308. ;                   possible button combinations.
  309. ; Parameter(s):     $iFlag        - Flag
  310. ; Requirement(s):   None
  311. ; Return Value(s):  On Success - Returns the message box flag
  312. ;                   None
  313. ; Author(s):        Giuseppe Criaco <gcriaco@quipo.it>
  314. ;
  315. ;===============================================================================
  316. ;
  317.  
  318. Func _SetFlag($iFlag)
  319.    $iFlag = 0
  320.    
  321.    ;Icons
  322.    Select
  323.       Case GUICtrlRead($optWarning) = $GUI_CHECKED
  324.          $iFlag = $iFlag + 48
  325.       Case GUICtrlRead($optInfo) = $GUI_CHECKED
  326.          $iFlag = $iFlag + 64
  327.       Case GUICtrlRead($optCritical) = $GUI_CHECKED
  328.          $iFlag = $iFlag + 16
  329.       Case GUICtrlRead($optQuestion) = $GUI_CHECKED
  330.          $iFlag = $iFlag + 32
  331.    EndSelect
  332.    
  333.    ;Modality
  334.    Select
  335.       Case GUICtrlRead($optSysModal) = $GUI_CHECKED
  336.          $iFlag = $iFlag + 4096
  337.       Case GUICtrlRead($optTaskModal) = $GUI_CHECKED
  338.          $iFlag = $iFlag + 8192
  339.    EndSelect
  340.    
  341.    ;Buttons
  342.    Select
  343.       Case GUICtrlRead($optOkCancel) = $GUI_CHECKED
  344.          $iFlag = $iFlag + 1
  345.       Case GUICtrlRead($optYesNo) = $GUI_CHECKED
  346.          $iFlag = $iFlag + 4
  347.       Case GUICtrlRead($optYesNoCancel) = $GUI_CHECKED
  348.          $iFlag = $iFlag + 3
  349.       Case GUICtrlRead($optAbortRetryIgnore) = $GUI_CHECKED
  350.          $iFlag = $iFlag + 2
  351.       Case GUICtrlRead($optRetryCancel) = $GUI_CHECKED
  352.          $iFlag = $iFlag + 5
  353.       Case GUICtrlRead($optCancelRetryContinue) = $GUI_CHECKED
  354.          $iFlag = $iFlag + 6
  355.    EndSelect
  356.    
  357.    ;Miscellaneous
  358.    Select
  359.       Case GUICtrlRead($optTopMost) = $GUI_CHECKED
  360.          $iFlag = $iFlag + 262144
  361.       Case GUICtrlRead($optRightJust) = $GUI_CHECKED
  362.          $iFlag = $iFlag + 5244288
  363.    EndSelect
  364.    
  365.    ;Default Buttons
  366.    Select
  367.       Case GUICtrlRead($optSecond) = $GUI_CHECKED
  368.          $iFlag = $iFlag + 256
  369.       Case GUICtrlRead($optThird) = $GUI_CHECKED
  370.          $iFlag = $iFlag + 512
  371.    EndSelect
  372.    
  373.    Return $iFlag
  374. EndFunc   ;==>_SetFlag