Jump to content
Sign in to follow this  
avery

[solved]GUICtrlCreateEdit[/solved]

Recommended Posts

avery

Does anyone know how to make an Edit control scroll to the bottom on new text. I tried all the combinations I could think of documented here: http://www.autoitscript.com/autoit3/docs/a...x/GUIStyles.htm.

Currently the only way I can keep the latest status message at top and viewable to the user is to reverse the lines I write so the new ones stay at the top. This looks pretty silly though. Can someone please help me.

$status = GUICtrlCreateEdit("", 8, 104, 609, 169, BitOR($ES_AUTOVSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL))

...

Func _s($line)
    $_ln += 1
    $set_status = GUICtrlRead($status)
    $line = $line & @CRLF & $set_status
    ;$line = $set_status & $line
    GUICtrlSetData($status, "[" & $_ln & "] " & $time & $line & @CRLF)
EndFunc   ;==>_s

Example of my reverse output. I'd like to make the window scroll down on new data and the numbers to be 1, 2, 3, etc not 6, 5, 4, 3 etc.

[6] 2009/02/04@22:07:(29) secedit command documented in secedit_cmd.bat

[5] 2009/02/04@22:07:(29) _LOGFILE: C:\Program Files\NISP_Utilities\logs\Abox.txt

[4] 2009/02/04@22:07:(29) DATABASE: C:\Program Files\NISP_Utilities\config\Abox.sdb

[3] 2009/02/04@22:07:(29) TEMPLATE: C:\Program Files\NISP_Utilities\config\Abox.inf

[2] 2009/02/04@22:07:(29) Moved template from inf\ to config\

I can post a screen shot or all the code, or email, post / link. Anything. Please. *bangs head here* Edited by avery

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites
enaiman

Here you go ...

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

Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 398, 167, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Edit1 = GUICtrlCreateEdit("", 16, 16, 361, 105)
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("Button1", 144, 136, 75, 25, 0)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$text = "line "
$counter = 0

While 1
    Sleep(100)
WEnd

Func Button1Click()
    $end_rcv = StringLen(GUICtrlRead($Edit1))
    _GUICtrlEdit_SetSel($Edit1, $end_rcv, $end_rcv) 
    _GUICtrlEdit_ReplaceSel($Edit1, $text&$counter&@CRLF, False)
    $counter +=1
EndFunc
Func Form1Close()
    Exit
EndFunc

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
avery

Edit: I tried your example and it doesn't work but i am still trying to figure it out toooooooo. But thanks for trying. I'll keep messing with it.

Edited by avery

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites
enaiman

What doesn't work ?? :)

It does exactly what you want: it scrolls down on new text entered so the new text will always be visible.

Please keep in mind: when somebody tries to help you, saying only that "I tried your example and it doesn't work" it's ... hmm ... "not the best answer" you can give. You need usually to say what didn't work and explain (again ...) what are you trying to achieve so the one trying to help you can understand better what your problem is.

Saying only "it doesn't work" can be seen as a demanding atitude ... and the help here is "offered" not "requested".

Good luck in figuring it out.


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
avery

What doesn't work ?? :)

It does exactly what you want: it scrolls down on new text entered so the new text will always be visible.

Please keep in mind: when somebody tries to help you, saying only that "I tried your example and it doesn't work" it's ... hmm ... "not the best answer" you can give. You need usually to say what didn't work and explain (again ...) what are you trying to achieve so the one trying to help you can understand better what your problem is.

Saying only "it doesn't work" can be seen as a demanding atitude ... and the help here is "offered" not "requested".

Good luck in figuring it out.

It's just your help made me even more confused on the topic. I'm still learning and appreciate your time but I think I need to start with some more basic stuff and work my way up or find someone who is willing to help me understand how it works rather then toss out cryptic lines with no explanation. Maybe someone more my level will see my post and be willing to help. Thanks for all your advice on how to make good posts though it was really helpful.


www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites
enaiman

You had only 3 "cryptic lines" ... let's see ...

$end_rcv = StringLen(GUICtrlRead($Edit1))

... the length of the string read from editbox $Edit1 = how many characters are written in the editbox

_GUICtrlEdit_SetSel($Edit1, $end_rcv, $end_rcv)

... select "anything" after the last character = place the cursor at the end of the text

_GUICtrlEdit_ReplaceSel($Edit1, $text&$counter&@CRLF, False)

... replace that selection with your text

hope this explanation makes everything clear to you ...


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
CodyBarrett

wow ummm i am interested i am checking @Enaiman i am checking your script out... BTW have you guys notcied that uhh the only DISpics (besides mine now that i have ruined it) are CATS!!! one animated and one Supposedly real... WOW FREAKY :)

[EDIT]

Sorry guys my bad for hijacking topic *Slaps forehead * gotta quit making statements like that

Really lol its funny about the cats but yeah sorry..... and uhhh if you want the edit to be at the bottom and if it still didnt work (mine doesnt although it might be a different style) try using

_GUICtrlEdit_Scroll
Edited by CodyBarrett

Share this post


Link to post
Share on other sites
avery

wow ummm i am interested i am checking @Enaiman i am checking your script out... BTW have you guys notcied that uhh the only DISpics (besides mine now that i have ruined it) are CATS!!! one animated and one Supposedly real... WOW FREAKY :)

[EDIT]

Sorry guys my bad for hijacking topic *Slaps forehead * gotta quit making statements like that

Really lol its funny about the cats but yeah sorry..... and uhhh if you want the edit to be at the bottom and if it still didnt work (mine doesnt although it might be a different style) try using

_GUICtrlEdit_Scroll
Sir. I thank you very much for that post.

I had to add these two includes to my ever growing list.

#include <ScrollBarConstants.au3>
#include <GUIEdit.au3>

... ; and your line fixed it right up

_GUICtrlEdit_Scroll($status, $SB_SCROLLCARET)

@enaiman

I really do appreciate you taking the time to explain your example too. Yours does not need these extra includes so does that mean it would be a smaller compiled script in the end?

Respectfully,

avery

Edited by avery

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites
CodyBarrett

Share this post


Link to post
Share on other sites
enaiman

@ CodyBarrett

:) _GUICtrlEdit_Scroll is a good one ...

I was not aware that this function exists (actually the code I posted was taken fom an "old" script) ... of course is a much simpler solution.

@ avery

#include <ScrollBarConstants.au3> wouldn't add too much to your script; if you are concerned with this you can copy-paste the constant you need to your script and this way you don't need to include the whole file.


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
CodyBarrett

i just recently found the _GUIctrledit_scroll like a few days ago when i was updating my TCP chat room.. so dont feel bad the helpfile has a seemingly endless amount of goodies YOU GUYS HEAR THAT!!! ANYONE WHO ASKS FIRST THEN CHECKS!!! ALL HAIL THE HELPFILE!!!!!!

but seriously i just found it so dont feel bad

Share this post


Link to post
Share on other sites
avery

i just recently found the _GUIctrledit_scroll like a few days ago when i was updating my TCP chat room.. so dont feel bad the helpfile has a seemingly endless amount of goodies YOU GUYS HEAR THAT!!! ANYONE WHO ASKS FIRST THEN CHECKS!!! ALL HAIL THE HELPFILE!!!!!!

but seriously i just found it so dont feel bad

I must be blind because I didn't find those in the help file anywhere. I even googled it after you make your post. I'd sure like to see the rest of the options.

*meow*

-avery

Edited by avery

www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

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  

×