Sign in to follow this  
Followers 0

My GUI does not scrolling

5 posts in this topic

Posted (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 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
Edited by wpns

Share this post


Link to post
Share on other sites



Posted

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

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

Melba23,

Great UDF) Thanks)

Share this post


Link to post
Share on other sites

Posted

wpns,

Glad you found it useful. ;)

M23

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0




  • Recently Browsing   0 members

    No registered users viewing this page.