Jump to content

wpns

Members
  • Posts

    2
  • Joined

  • Last visited

wpns's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Melba23, Great UDF) Thanks)
  2. My first post here) I create some script (simple survey tool) and, if the control elements do not fit in the window,scrolling is required. I see scrollbars, vertical and horizontal, but it does not scrolling Any idea? #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Run_Obfuscator=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "Terminate") Global $type, $filew, $top, $end, $other, $id $file = FileOpen("анкета.txt", 0) $filer = FileOpen ("result.txt", 1) $line = 1 $title = FileReadLine($file, $line) $line = $line + 1 $width = 600 $height = 300 $n = 0 Local $msg Dim $cc MsgBox (0, "", "Конструктор анкет v 1.0, автор - Валерий Родькин, e-mail: 4671992@gmail.com") While 1 If $end = 1 Then FileWrite ($filer, @CRLF) MsgBox (0, "", " Анкетирование завершено,спасибо за участие!", 3) Exit 0 EndIf Init() Setquestions() WEnd Func Terminate() Exit 0 EndFunc ;==>Terminate Func Init() $top = 10 GUICreate($title, $width, $height, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_HSCROLL, $WS_VSCROLL)) GUISetState(@SW_SHOW) $label = FileReadLine($file, $line) GUICtrlCreateLabel($label, 10, $top) $line = $line + 1 $top = $top + 23 $other = 0 EndFunc ;==>Init Func Setquestions() $filew = FileOpen("tech.txt", 2) $type = FileReadLine($file, $line) $line = $line + 1 If $type = "одинответ" Then While 1 $qtext = FileReadLine($file, $line) If $qtext = "" Then $line = $line + 1 ExitLoop ElseIf $qtext = "другое" Then $line = $line + 2 ExitLoop ElseIf $qtext = "конец" Then $end = 1 ExitLoop EndIf $cc = GUICtrlCreateRadio($qtext, 10, $top) FileWrite($filew, $cc & @CRLF) $n = $n + 1 $line = $line + 1 $top = $top + 23 WEnd If $qtext = "другое" Then $cc = GUICtrlCreateInput("Другое (напишите)", 10, $top, 300) FileWrite($filew, $cc & @CRLF) $other = 1 $top = $top + 23 EndIf ElseIf $type = "многоответ" Then While 1 $qtext = FileReadLine($file, $line) If $qtext = "" Then $line = $line + 1 ExitLoop ElseIf $qtext = "другое" Then $line = $line + 2 ExitLoop ElseIf $qtext = "конец" Then $end = 1 ExitLoop EndIf $cc = GUICtrlCreateCheckbox($qtext, 10, $top) FileWrite($filew, $cc & @CRLF) $n = $n + 1 $line = $line + 1 $top = $top + 23 WEnd If $qtext = "другое" Then $cc = GUICtrlCreateInput("Другое (напишите)", 10, $top, 300) FileWrite($filew, $cc & @CRLF) $top = $top + 23 $other = 1 EndIf ElseIf $type = "полеввода" Then $qtext = FileReadLine($file, $line) If $qtext = "конец" Then $end = 1 EndIf If $qtext = "" Then $line = $line + 1 EndIf $cc = GUICtrlCreateInput("", 10, $top, 300) $top = $top + 23 FileWrite($filew, $cc & @CRLF) EndIf FileClose($filew) $btngo = GUICtrlCreateButton("Далее", 10, $top, 150) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $btngo Then GetAnswers() ExitLoop EndIf WEnd EndFunc ;==>Setquestions Func GetAnswers() $file1 = FileOpen ("tech.txt", 0) If $type = "одинответ" Then $line1 = 1 $checked = 0 For $i = 1 To $n Step 1 $id = FileReadLine ($file1, $line1) $cr = GUICtrlRead ($id) If $cr = $GUI_CHECKED Then $checked = 1 FileWrite ($filer, $i & ";") EndIf $line1 = $line1 + 1 Next If $other = 1 Then $id = FileReadLine ($file1, $line1) $cr = GuiCtrlRead ($id) FileWrite ($filer, $cr & ";") EndIf If $checked = 0 Then FileWrite ($filer, "0" & ";") EndIf If $type = "многоответ" Then $line1 = 1 For $i = 1 To $n $id = FileReadLine ($file1, $line1) $cr = GUICtrlRead ($id) If $cr = $GUI_CHECKED Then FileWrite ($filer, "1" & ";") Else FileWrite ($filer, "0" & ";") EndIf $line1 = $line1 + 1 $i = $i + 1 Next If $other = 1 Then $id = FileReadLine ($file1, $line1) $cr = GuiCtrlRead ($id) FileWrite ($filer, $cr & ";") EndIf EndIf If $type = "полеввода" Then $line1 = 1 $id = FileReadLine ($file1, $line1) $cr = GUICtrlRead ($id) FileWrite ($filer, $cr & ";") EndIf FileClose ($file1) EndFunc ;==>GetAnswers
×
×
  • Create New...