Sign in to follow this  
Followers 0
bordomavi

Listview read error

4 posts in this topic

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

$Form1 = GUICreate("Form1", 320, 259, 192, 124)
Global $Checkbox1 = GUICtrlCreateCheckbox("Select All Items", 8, 24, 97, 17, BitOR($BS_3STATE,$WS_TABSTOP))
$test = GuiCtrlCreateButton("test all checked", 200, 24, 97, 17)
$ListView1 = GUICtrlCreateListView("Items", 8, 48, 297, 201)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))

$ListView1_0 = _GUICtrlListView_AddItem($ListView1,"one")
$ListView1_1 = _GUICtrlListView_AddItem($ListView1,"two")
$ListView1_2 = _GUICtrlListView_AddItem($ListView1,"three")
$ListView1_3 = _GUICtrlListView_AddItem($ListView1,"four")
$ListView1_4 = _GUICtrlListView_AddItem($ListView1,"five")

GUISetState(@SW_SHOW)

Global $allchecked = 0

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $test
            If GUICtrlRead($ListView1_0) = $GUI_CHECKED Then
               Msgbox(0,"", "")
            EndIf
        Case $Checkbox1
            If GUICtrlRead($Checkbox1) = $GUI_UNCHECKED Then
                GUICtrlSetState($Checkbox1, $GUI_CHECKED)
                For $C = 1 To _GUICtrlListView_GetItemCount($ListView1)
                    _GUICtrlListView_SetItemChecked($ListView1, $C - 1)
                Next
                $allchecked = 1
            ElseIf GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
                GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
                For $C = 1 To _GUICtrlListView_GetItemCount($ListView1)
                    _GUICtrlListView_SetItemChecked($ListView1, $C - 1, False)
                Next
                $allchecked = 0
            EndIf
    EndSwitch
WEnd

why case $test doesn't work

Share this post


Link to post
Share on other sites



?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

$Form1 = GUICreate("Form1", 320, 259, 192, 124)
Global $Checkbox1 = GUICtrlCreateCheckbox("Select All Items", 8, 24, 97, 17, BitOR($BS_3STATE, $WS_TABSTOP))
$test = GUICtrlCreateButton("test all checked", 200, 24, 97, 17)
$ListView1 = GUICtrlCreateListView("Items", 8, 48, 297, 201)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))

$ListView1_0 = _GUICtrlListView_AddItem($ListView1, "one")
$ListView1_1 = _GUICtrlListView_AddItem($ListView1, "two")
$ListView1_2 = _GUICtrlListView_AddItem($ListView1, "three")
$ListView1_3 = _GUICtrlListView_AddItem($ListView1, "four")
$ListView1_4 = _GUICtrlListView_AddItem($ListView1, "five")

GUISetState(@SW_SHOW)

Global $allchecked = 0

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $test
            If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                MsgBox(0, "", "")
            EndIf
        Case $Checkbox1
            If BitAND(GUICtrlRead($Checkbox1), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
                GUICtrlSetState($Checkbox1, $GUI_CHECKED)
                For $C = 1 To _GUICtrlListView_GetItemCount($ListView1)
                    _GUICtrlListView_SetItemChecked($ListView1, $C - 1)
                Next
                $allchecked = 1
            ElseIf BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
                For $C = 1 To _GUICtrlListView_GetItemCount($ListView1)
                    _GUICtrlListView_SetItemChecked($ListView1, $C - 1, False)
                Next
                $allchecked = 0
            EndIf
    EndSwitch
WEnd

Visit my repository

Share this post


Link to post
Share on other sites

 

?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

$Form1 = GUICreate("Form1", 320, 259, 192, 124)
Global $Checkbox1 = GUICtrlCreateCheckbox("Select All Items", 8, 24, 97, 17, BitOR($BS_3STATE, $WS_TABSTOP))
$test = GUICtrlCreateButton("test all checked", 200, 24, 97, 17)
$ListView1 = GUICtrlCreateListView("Items", 8, 48, 297, 201)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))

$ListView1_0 = _GUICtrlListView_AddItem($ListView1, "one")
$ListView1_1 = _GUICtrlListView_AddItem($ListView1, "two")
$ListView1_2 = _GUICtrlListView_AddItem($ListView1, "three")
$ListView1_3 = _GUICtrlListView_AddItem($ListView1, "four")
$ListView1_4 = _GUICtrlListView_AddItem($ListView1, "five")

GUISetState(@SW_SHOW)

Global $allchecked = 0

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $test
            If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                MsgBox(0, "", "")
            EndIf
        Case $Checkbox1
            If BitAND(GUICtrlRead($Checkbox1), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
                GUICtrlSetState($Checkbox1, $GUI_CHECKED)
                For $C = 1 To _GUICtrlListView_GetItemCount($ListView1)
                    _GUICtrlListView_SetItemChecked($ListView1, $C - 1)
                Next
                $allchecked = 1
            ElseIf BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
                For $C = 1 To _GUICtrlListView_GetItemCount($ListView1)
                    _GUICtrlListView_SetItemChecked($ListView1, $C - 1, False)
                Next
                $allchecked = 0
            EndIf
    EndSwitch
WEnd

i want it for $ListView1_0 not for  $Checkbox1 and i tried this $ListView1_0 it doesnt work

Share this post


Link to post
Share on other sites

Hi.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

$Form1 = GUICreate("Form1", 320, 259, 192, 124)
Global $Checkbox1 = GUICtrlCreateCheckbox("Select All Items", 8, 24, 97, 17, BitOR($BS_3STATE,$WS_TABSTOP))
$test = GuiCtrlCreateButton("test all checked", 200, 24, 97, 17)
$ListView1 = GUICtrlCreateListView("Items", 8, 48, 297, 201)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))

$ListView1_0 = _GUICtrlListView_AddItem($ListView1,"one")
$ListView1_1 = _GUICtrlListView_AddItem($ListView1,"two")
$ListView1_2 = _GUICtrlListView_AddItem($ListView1,"three")
$ListView1_3 = _GUICtrlListView_AddItem($ListView1,"four")
$ListView1_4 = _GUICtrlListView_AddItem($ListView1,"five")

GUISetState(@SW_SHOW)

Global $allchecked = 0

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $test
            If _GUICtrlListView_GetItemChecked($ListView1,0) Then
               Msgbox(0,"", "")
            EndIf
        Case $Checkbox1
            If GUICtrlRead($Checkbox1) = $GUI_UNCHECKED Then
                GUICtrlSetState($Checkbox1, $GUI_CHECKED)
                For $C = 1 To _GUICtrlListView_GetItemCount($ListView1)
                    _GUICtrlListView_SetItemChecked($ListView1, $C - 1)
                Next
                $allchecked = 1
            ElseIf GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
                GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
                For $C = 1 To _GUICtrlListView_GetItemCount($ListView1)
                    _GUICtrlListView_SetItemChecked($ListView1, $C - 1, False)
                Next
                $allchecked = 0
            EndIf
    EndSwitch
WEnd

Saludos

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