Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

My GUI does not scrolling


  • Please log in to reply
4 replies to this topic

#1 wpns

wpns

    Seeker

  • New Members
  • 2 posts

Posted 23 April 2012 - 01:13 PM

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?
AutoIt         
#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 by wpns, 23 April 2012 - 01:14 PM.








#2 armoros

armoros

  • Active Members
  • PipPipPipPipPipPip
  • 503 posts

Posted 23 April 2012 - 02:24 PM

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..

#3 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 23 April 2012 - 03:34 PM

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! :D

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
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#4 wpns

wpns

    Seeker

  • New Members
  • 2 posts

Posted 23 April 2012 - 05:28 PM

Melba23,
Great UDF) Thanks)

#5 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 23 April 2012 - 08:14 PM

wpns,

Glad you found it useful. ;)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users