Jump to content

List Scroll Follow


Recommended Posts

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
Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

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