Sign in to follow this  
Followers 0
insignia96

List View Control

4 posts in this topic

I am writing a Server control panel and i have used a list view to hold directives. The problem i have is i need the script to find the current item selected. The list view can only have 1 selected btw.

I have tried using _GUICtrlListView_GetSelectedIndices and a few others but thay all return either 0 or false!


Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower

Share this post


Link to post
Share on other sites



Can you post a demo script to see how you call this function and how the list view control is looks like?

Share this post


Link to post
Share on other sites

$ListView1 = GUICtrlCreateListView("Message", 24, 240, 401, 193, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_HEADERDRAGDROP))
GUICtrlSendMsg(-1, 0x101E, 0, 380)
GUICtrlSetColor( -1, $textcolor)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
GUICtrlSetBkColor( -1, $bkcolor)
Local $messages[11]
$messages[10] = InIRead( $conf, "Announcer", "message10", "" )
$messages[1] = InIRead( $conf, "Announcer", "message1", "" )
$messages[2] = InIRead( $conf, "Announcer", "message2", "" )
$messages[3] = InIRead( $conf, "Announcer", "message3", "" )
$messages[4] = InIRead( $conf, "Announcer", "message4", "" )
$messages[5] = InIRead( $conf, "Announcer", "message5", "" )
$messages[6] = InIRead( $conf, "Announcer", "message6", "" )
$messages[7] = InIRead( $conf, "Announcer", "message7", "" )
$messages[8] = InIRead( $conf, "Announcer", "message8", "" )
$messages[9] = InIRead( $conf, "Announcer", "message9", "" )
$fr = 1
While $fr<=10
    If $messages[$fr] = "" Then
    $novalue = 1
    Else
    $novalue = 0
    EndIf
    If $novalue = 1 Then
    Else
    GUICtrlCreateListViewItem($messages[$fr], $ListView1)
    EndIf
    $fr = $fr+1
WEnd

This is the list view create and this:

Case $Button16
            _GUICtrlListView_DeleteItemsSelected($ListView1)
            $selected = _GUICtrlListView_GetSelectedIndices($ListView1, True )
            $i=0
            While $i <= UBound( $selected )
            MsgBox( 0, $i, $selected[$i] )
            If $i = UBound( $selected ) Then
                $i = 0
            Else
            $i = $i +1
            EndIf
            WEnd

Is my code to call when button is pressed.

THe button deletes the selected item. Even tho thars a UDF for this, i need it to erase the right directive from an INI too.


Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower

Share this post


Link to post
Share on other sites

Holy s*it i am a f*cking idiot.

Apparently when i finally lose it and ask for help i see it.

It makes it easier to find out if an item is selected if it was not deleted before trying to do so.


Visit my website to see all my finished releases!Releases here:UDFs:GUI ResizingColor List (Web Colors)GUIFade_NearestPower

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