faustf Posted June 15, 2015 Share Posted June 15, 2015 hi guyi have a listview with checkbox , is possible , not flag many checkbox in contemporary ?thankz at all Link to comment Share on other sites More sharing options...
MikahS Posted June 15, 2015 Share Posted June 15, 2015 You'll need to explain a little more, unless someone else can understand what you're asking. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 15, 2015 Moderators Share Posted June 15, 2015 faustf,Do you mean that you only want to allow a single item in the ListView to be checked at any one time?M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
faustf Posted June 15, 2015 Author Share Posted June 15, 2015 yea , dont want flag in the same time 2 or more checkbox only one Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 15, 2015 Moderators Share Posted June 15, 2015 faustf,This seems to work:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Global $iChecked = -1 $hGUI = GUICreate("Test", 500, 500) $cLV = GUICtrlCreateListView("Column 0", 10, 10, 300, 300, BitOr($LVS_SHOWSELALWAYS, $LVS_SINGLESEL)) _GUICtrlListView_SetExtendedListViewStyle($cLV, BitOr($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES)) For $i = 0 To 9 GUICtrlCreateListViewItem("Item " & $i, $cLV) Next $cLVClicK_Dummy = GUICtrlCreateDummy() GUISetState() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cLVClicK_Dummy ; Read index of clicked item $iIndex = GUICtrlRead($cLVClicK_Dummy) ; Determine checked state Local $bState = _GUICtrlListView_GetItemChecked($cLV, $iIndex) ; If checked and not previous checked index If $bState And $iIndex <> $iChecked Then ; Clear old checked _GUICtrlListView_SetItemChecked($cLV, $iChecked, False) $iChecked = $iIndex ; Set new checked _GUICtrlListView_SetItemChecked($cLV, $iChecked) ; If not checked and was previously checked ElseIf Not ($bState) And $iIndex = $iChecked Then ; Clear check _GUICtrlListView_SetItemChecked($cLV, $iChecked, False) ; Set "No check" flag $iChecked = -1 EndIf EndSwitch WEnd Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $iIDFrom Case $cLV ; It is our ListView Switch $iCode Case $NM_CLICK ; An item was clicked $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) $iIndex = DllStructGetData($tInfo, "Index") ; Action the dummy control and pass the row clicked GUICtrlSendToDummy($cLVClicK_Dummy, $iIndex) ; Select row if only checkbox actioned _GUICtrlListView_SetItemState($cLV, $iIndex, $LVIS_SELECTED, $LVIS_SELECTED) EndSwitch EndSwitch EndFuncM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now