wpns Posted April 23, 2012 Share Posted April 23, 2012 (edited) 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 scrollingAny idea?expandcollapse popup#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 Edited April 23, 2012 by wpns Link to comment Share on other sites More sharing options...
armoros Posted April 23, 2012 Share Posted April 23, 2012 Hello wpns i thing you should put more controls in your gui or something so the script to understand how to scroll.. By the way it reacts a bit strange to me when i close it it open more of the same gui.. [font="verdana, geneva, sans-serif"] [/font] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 23, 2012 Moderators Share Posted April 23, 2012 wpns,Welcome to the AutoIt forums. You need a bit more code in your script to make the scrollbars work - take a look at the _GUIScrollBars_Init example in the Help file! However, my GUIScrollBars_Ex UDF - the link is in my sig - makes it very easy for you to get the scrollbars working. The UDF does all the work for you with just one additional line of code. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
wpns Posted April 23, 2012 Author Share Posted April 23, 2012 Melba23, Great UDF) Thanks) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 23, 2012 Moderators Share Posted April 23, 2012 wpns, Glad you found it useful. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now