Sign in to follow this  
Followers 0
step887

ctrl edit and scroll bar

4 posts in this topic

So I am trying to create a ctrl data and I want the scrollbar to default to the bottom..

I have try searching, so if there is something I am not searching for the right tems.

I also try to use _GUIScrollBars, but I could not figure it ou..

so any help would be appreciated

example script:

#include <GUIConstantsEx.au3>

local $data
for $i = 1 to 100
$data &= _random_() & @CRLF
Next
$GUI = GUICreate(" My GUI");, 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45)
$edit = GUICtrlCreateEdit($data, 2, 2, 380, 380)
GUISetState()
While 1
If GUIGetMsg() = $GUI_EVENT_CLOSE then ExitLoop
WEnd
GUIDelete ($gui)
Func _random_($min = 8, $max = 15)
Local $STR = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", $ranChars = StringSplit($STR, ""), $tmpname
For $b = 1 To Random($min, $max, 1)
SRandom(Random(1,1000000))
$tmpname &= $ranChars[Random(1, $ranChars[0], 1)]
Next
Return $tmpname
EndFunc ;==>_get_random_name

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This should help

_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit))

to deselect you could simply add this line after creating the Edit Control or after setting/altering the data of the control

_GUICtrlEdit_AppendText($hEdit,"")

Regards

Phoenix XL

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

Herez an Example

#include <GuiEdit.au3>
#include <GUIConstantsEx.au3>
$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit

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

_GUICtrlEdit_AppendText($hEdit,"")
_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

thanks for the quick reply

that definitely works.. not sure why I could not find that

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