Jump to content

Simple Scroll-Bar problem... (RESOLVED)


 Share

Recommended Posts

I've tried

$Edit1 = GUICtrlCreateEdit("", 16, 8, 593, 385,$ES_AUTOVSCROLL + $WS_VSCROLL)

and

GUICtrlSetStyle($Edit1, $WS_VSCROLL + $ES_AUTOVSCROLL)

The scrollbar won't autoscroll... :)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiEdit.au3>
#include <StaticConstants.au3>

$Form1 = GUICreate("***", 633, 447, 282, 226)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 593, 385,$ES_AUTOVSCROLL + $WS_VSCROLL)
GUICtrlSetData($Edit1, "Test")
;sleep(3000)
$Input1 = GUICtrlCreateInput("Input1", 40, 408, 329, 21)
$Button1 = GUICtrlCreateButton("Send", 432, 408, 81, 25, 0)
GUISetState(@SW_SHOW)

TCPStartup()
$Main = TCPConnect(TCPNameToIP("*************"),23)
Global $recv2
While 1
    $recv = TCPRecv($main,8000)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Escape()

        Case $Button1
            $Input = GUICtrlRead($Input1)
            GUICtrlSetData($recv2 & @CRLF & $Edit1,$Input)
            TCPSend($main,$Input & @CRLF)
                        
        Case Else
            Recv()
    EndSwitch
WEnd



Func Recv()
    If $recv Then
        $recv2 = $recv2 & @CRLF & $recv
        GUICtrlSetData($Edit1, $recv2)
    EndIf
    
EndFunc


Func Escape()
    Exit
EndFunc

Func OnAutoItExit()
TCPShutdown()
EndFunc

EDIT: I did try BitOr as well... OH! and how do you get it to submit the Input once you hit "Enter", do you have to use hotkeyset()?

Sorry guys... Prime example of not searching for the answer... I fixed it. >.<

Edited by BinaryBrother

SIGNATURE_0X800007D NOT FOUND

Link to comment
Share on other sites

I've tried

$Edit1 = GUICtrlCreateEdit("", 16, 8, 593, 385,$ES_AUTOVSCROLL + $WS_VSCROLL)

and

GUICtrlSetStyle($Edit1, $WS_VSCROLL + $ES_AUTOVSCROLL)

The scrollbar won't autoscroll... :)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiEdit.au3>
#include <StaticConstants.au3>

$Form1 = GUICreate("***", 633, 447, 282, 226)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 593, 385,$ES_AUTOVSCROLL + $WS_VSCROLL)
GUICtrlSetData($Edit1, "Test")
;sleep(3000)
$Input1 = GUICtrlCreateInput("Input1", 40, 408, 329, 21)
$Button1 = GUICtrlCreateButton("Send", 432, 408, 81, 25, 0)
GUISetState(@SW_SHOW)

TCPStartup()
$Main = TCPConnect(TCPNameToIP("*************"),23)
Global $recv2
While 1
    $recv = TCPRecv($main,8000)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Escape()

        Case $Button1
            $Input = GUICtrlRead($Input1)
            GUICtrlSetData($recv2 & @CRLF & $Edit1,$Input)
            TCPSend($main,$Input & @CRLF)
                        
        Case Else
            Recv()
    EndSwitch
WEnd



Func Recv()
    If $recv Then
        $recv2 = $recv2 & @CRLF & $recv
        GUICtrlSetData($Edit1, $recv2)
    EndIf
    
EndFunc


Func Escape()
    Exit
EndFunc

Func OnAutoItExit()
TCPShutdown()
EndFunc

EDIT: I did try BitOr as well... OH! and how do you get it to submit the Input once you hit "Enter", do you have to use hotkeyset()?

I'm not sure what you are trying to do but this line

GUICtrlSetData($recv2 & @CRLF & $Edit1,$Input)

looks like it should be more like

GUICtrlSetData($Edit1,$recv2 & @CRLF & $Input,1)

If you want the input to be read when you press enter then you could have a case $Input1 which can be used if you change the text in the inout and then press Enter. Or you could have an accelerator for Enter and then decide what to do after finding which control has the focus.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

AutoScroll just scrolls when the use types, not when you use GUICtrlSetData.

To scroll to the end, use:

Local $lines = GUICtrlSendMsg($Edit,0xBA,0,0); EM_GETLINECOUNT
            GUICtrlSendMsg($Edit,0xB6,0,$lines+1); EM_LINESCROLL

or just use _GUICtrlEdit_AppendText then you don't have to re-set the old text, just add the new :)

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

AutoScroll just scrolls when the use types, not when you use GUICtrlSetData.

Not correct :)
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

?

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

?

Well I mean that if you keep pressing the button in the code changed as I suggested, then the vertical scrollbars will operate.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiEdit.au3>
#include <StaticConstants.au3>

$Form1 = GUICreate("***", 633, 447, 282, 226)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 593, 385,$ES_AUTOVSCROLL + $WS_VSCROLL)
GUICtrlSetData($Edit1, "Test")
;sleep(3000)
$Input1 = GUICtrlCreateInput("Input1", 40, 408, 329, 21)
$Button1 = GUICtrlCreateButton("Send", 432, 408, 81, 25, 0)
GUISetState(@SW_SHOW)

TCPStartup()
$Main = TCPConnect(TCPNameToIP("*************"),23)
Global $recv2
While 1
    $recv = TCPRecv($main,8000)
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Escape()

        Case $Button1
            $Input = GUICtrlRead($Input1)
            GUICtrlSetData($Edit1,$recv2 & @CRLF & $Input,1);<---------GuiCtrlSetData will make the the autoscroll scroll
            TCPSend($main,$Input & @CRLF)
                       
        Case Else
            Recv()
    EndSwitch
WEnd



Func Recv()
    If $recv Then
        $recv2 = $recv2 & @CRLF & $recv
        GUICtrlSetData($Edit1, $recv2)
    EndIf
   
EndFunc


Func Escape()
    Exit
EndFunc

Func OnAutoItExit()
TCPShutdown()
EndFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

OK, right, but GUICtrlSetData scrolls to the cursor, not to the end of the text.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...