Sign in to follow this  
Followers 0
enaiman

How to avoid AUTOHSCROLL behaviour?

5 posts in this topic

I've created an edit box with the following code:

$Edit2 = GUICtrlCreateEdit("", 11, 72, 605, 313, BitOR($ES_MULTILINE,$ES_READONLY,$WS_VSCROLL, $WS_HSCROLL,$WS_BORDER))

the problem is - the text I "receive" for this editbox is longer than the editbox could fit in a single line and the editbox will wrap it <_<

so I've added the $WS_HSCROLL option.

The new problem is - the editbox scrolls automatically to the right when the received line is longer.

How can I avoid this?

Thanks,


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

1) Make the text box longer

2) Limit the size of the string allowed

3) Enter text box after string is received and send a {HOME}

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Just put a @CRLF at the end of the line for example:

(Extract from Beta example)

#include <GuiConstants.au3>
#include <GuiEdit.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

Global $hEdit

_Example_Internal()

Func _Example_Internal()
    Local $hGUI

    ; Create GUI
    $hGUI = GUICreate("(Internal) Edit Append Text", 400, 300)
    $hEdit = GUICtrlCreateEdit("This is a test" & @CRLF & "Another Line" & @CRLF, 2, 2, 394, 268)
    GUISetState()

    _GUICtrlEdit_AppendText ($hEdit, "AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI.  It uses a combination of" & @CRLF)
    _GUICtrlEdit_AppendText ($hEdit, "simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or" & @CRLF)
    
    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Example_Internal

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Thank you GaryFrost and Blue_Drache for your help.

All are "viable" solutions but unfortunately my case is a particular one.

I'm using this edit control to display strings sent/received over a serial connection. The string formatting is already complicated to handle and adding character number checks, new @CRLF and other things will make the script more and more complicated.

Anyway - what I did (workaround) I've made the edit wider (as much as I could, trying to keep my application "nice") enough to fit most of the text lines and I've removed the horizontal scroll bar allowing the edit control to wrap some lines.

Thanks again for help.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Thank you GaryFrost and Blue_Drache for your help.

All are "viable" solutions but unfortunately my case is a particular one.

I'm using this edit control to display strings sent/received over a serial connection. The string formatting is already complicated to handle and adding character number checks, new @CRLF and other things will make the script more and more complicated.

Anyway - what I did (workaround) I've made the edit wider (as much as I could, trying to keep my application "nice") enough to fit most of the text lines and I've removed the horizontal scroll bar allowing the edit control to wrap some lines.

Thanks again for help.

Can also set margins in the Edit control _GUICtrlEdit_SetMargins


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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