Jump to content

Recommended Posts

Posted

ok.. been looking on the net for the past hour or so looking here on the forums and other places with google. but I can't figure this out for the life of me..

I need my listbox to autoscroll to the bottom of the listbox.

pages i've found related on this:

http://www.autoitscript.com/forum/index.php?showtopic=14399

http://www.postfinder.com/post/24288574.html

it seems i need to use $LB_GETCOUNT = 0x??????

but this is exactly why i stopped learning C.. cause i kept getting lost in all this lol.

Posted (edited)

Check out _GUICtrlListSetTopIndex() in the help file. All you would need to do is pass it the index of the last item in the list and that should do the trick.

Edit: You obviously need to do this each time you write to the box. How about writing a short function that takes a text parameter, adds the text to the box and scrolls it?

Edited by LxP
Posted

no results for "_GUICtrlListSetTopIndex" in the help file.. or anything that looks close to it... :whistle:

searched in google as well. and only 2 links there. neither are helpful.

my Help file version is "v3.1.1"...

Posted

_GUICtrlListSetTopIndex is in the beta version

this should work for you

Func _GUICtrlListSetTopIndex($h_listbox, $i_index)
                Const $LB_SETTOPINDEX = 0x197
    Return GUICtrlSendMsg($h_listbox, $LB_SETTOPINDEX, $i_index, 0)
EndFunc  ;==>_GUICtrlListSetTopIndex

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Posted

still don't quite get it. i was able to make it autoscroll down but only for 9 times... then it would stop scrolling and new data would keep going beneath it.... i think this was caused because the number of lines in the list was 9.

Here is a small script that i'm gonna try to add the autoscroll to. then gonna add it to my main script. If you guys have time and i haven't found the solution could you please show me where i was making my mistakes.

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype

#include <GuiConstants.au3>
#Include <date.au3>

;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("List AutoScroll Test", 251, 170,(@DesktopWidth-251)/2, (@DesktopHeight-177)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$list = GuiCtrlCreateList("", 10, 10, 230, 136, $WS_VSCROLL)
$button = GuiCtrlCreateButton("Run", 80, 140, 90, 20)
$n = 0

do
    $n = $n +1
GUICtrlSetData($list,"ListText" & $n)
until $n = 8

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
        
    Case $msg = $button
    
    GUICtrlSetData($list,_NowTime())
    sleep(1000)
    
    ControlClick("List AutoScroll Test", "", "Button1", "left", "1")
    
    Case Else
    ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---
Posted

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype

#include <GuiConstants.au3>
#Include <date.au3>

;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GUICreate("List AutoScroll Test", 251, 170, (@DesktopWidth - 251) / 2, (@DesktopHeight - 177) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$list = GUICtrlCreateList("", 10, 10, 230, 136, $WS_VSCROLL)
$button = GUICtrlCreateButton("Run", 80, 140, 90, 20)
$n = 0

Do
   $n = $n + 1
   GUICtrlSetData($list, "ListText" & $n)
Until $n = 8

GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
         
      Case $msg = $button
         GUICtrlSetData($list, _NowTime())
         Sleep(1000)
         _GUICtrlListSetTopIndex($list, _GUICtrlListCount($list) - 1)
;~
;~   ControlClick("List AutoScroll Test", "", "Button1", "left", "1")
         
      Case Else
        ;;;
   EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

Func _GUICtrlListCount($h_listbox)
   Const $LB_GETCOUNT = 0x18B
   Return GUICtrlSendMsg($h_listbox, $LB_GETCOUNT, 0, 0)
EndFunc  ;==>_GUICtrlListCount

Func _GUICtrlListSetTopIndex($h_listbox, $i_index)
   Const $LB_SETTOPINDEX = 0x197
   Return GUICtrlSendMsg($h_listbox, $LB_SETTOPINDEX, $i_index, 0)
EndFunc  ;==>_GUICtrlListSetTopIndex

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

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
  • Recently Browsing   0 members

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