Sign in to follow this  
Followers 0
malu05

List Scroll Follow

5 posts in this topic

Is there a easy way to get the sliders from GUIctrlcreateList to follow (go downwards) when new data is added like CMD?


[center][u]WoW Machinima Tool[/u] (Tool for Machinima Artists) [/center]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

When you add an item just set focus to the new item..

#include <GUIListBox.au3>

$GUI = GUICreate(":-)", 200, 300)
$List = GUICtrlCreateList("", 2, 2, 196, 266)
For $i = 1 To 100
    GUICtrlSetData(-1, StringFormat("%03d", $i) & ": List Item")
Next
$Input = GUICtrlCreateInput("101: New List Item", 2, 273, 126, 20, $ES_READONLY)
$Button = GUICtrlCreateButton("Add Item", 133, 273, 63, 20)
GUISetState()


While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
        Case $Button
            Local $Cnt = _GUICtrlListBox_GetCount($List)
            GUICtrlSetData($List, GUICtrlRead($Input))
            GUICtrlSetData($Input, StringFormat("%03d", $Cnt + 2) & ": New List Item")
            _GUICtrlListBox_SetCurSel($List, $Cnt) 
            _GUICtrlListBox_SetCurSel($List, -1)
    EndSwitch
WEnd

Cheers

Edited by smashly

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

When you add an item just set focus to the new item..

#include <GUIListBox.au3>

$GUI = GUICreate(":-)", 200, 300)
$List = GUICtrlCreateList("", 2, 2, 196, 266)
For $i = 1 To 100
    GUICtrlSetData(-1, StringFormat("%03d", $i) & ": List Item")
Next
$Input = GUICtrlCreateInput("101: New List Item", 2, 273, 126, 20, $ES_READONLY)
$Button = GUICtrlCreateButton("Add Item", 133, 273, 63, 20)
GUISetState()


While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
        Case $Button
            Local $Cnt = _GUICtrlListBox_GetCount($List)
            GUICtrlSetData($List, GUICtrlRead($Input))
            GUICtrlSetData($Input, StringFormat("%03d", $Cnt + 2) & ": New List Item")
            _GUICtrlListBox_SetCurSel($List, $Cnt) 
            _GUICtrlListBox_SetCurSel($List, -1)
    EndSwitch
WEnd

Cheers

Collers.. thanks

Is it possible to add the same value 2 times?

Im making a "console" and need to be able to add the same data multiple times.

Like here;

Posted Image

My _report function splits up the data input if it is too long but as you can see this is not unique (no ID and No Time) so if the same text comes up again, then it won't print.

Edited by malu05

[center][u]WoW Machinima Tool[/u] (Tool for Machinima Artists) [/center]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi, yep you can

#include <GUIListBox.au3>

$GUI = GUICreate(":-)", 200, 300)
$List = GUICtrlCreateList("", 2, 2, 196, 266)
For $i = 1 To 100
    GUICtrlSetData(-1, "List Item|")
Next

$Input = GUICtrlCreateInput("New List Item", 2, 273, 126, 20, $ES_READONLY)
$Button = GUICtrlCreateButton("Add Item", 133, 273, 63, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
        Case $Button
            GUICtrlSetData($List, GUICtrlRead($Input) & "|")
            _GUICtrlListBox_SetCurSel($List, _GUICtrlListBox_GetCount($List)-1)
            _GUICtrlListBox_SetCurSel($List, -1)
    EndSwitch
WEnd

Cheers

Edited by smashly

Share this post


Link to post
Share on other sites

Thanks.

Works perfectly.


[center][u]WoW Machinima Tool[/u] (Tool for Machinima Artists) [/center]

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