xarax Posted December 6, 2013 Share Posted December 6, 2013 GUI üzerinde; $hListView = GUICtrlCreateListView("", 2, 50, 430, 268,$LVS_ICON,BitOR($LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT)) şeklinde bir Listview nesnesi oluşturdum. Görüldüğü üzere Checkboxlarda var. Sorum Listviewden seçtiğim checkbox sayısını statusbar da nasıl gösterebilirim. Aslında birşeyler yazdım, çalışıyor ama bir sorun var. İşlemi geriden takip ediyor. 3 tane checkbox işaretliyse statusbarda 2 tane görünüyor ama listview üzerinde başka bir yere tıklayınca doğru değer geliyor. Yeni yeni öğrenmeye çalışıyorum. Bu sorunu nasıl çözebilirim. Checkbox sayısını almak için yazdığım kod; $checkeditemcount = 0 For $index = 0 To _GUICtrlListView_GetItemCount($hListView)-1 If _GUICtrlListView_GetItemChecked($hListView, $index) Then $checkeditemcount += 1 Next _GUICtrlStatusBar_SetText($StatusBar1, $checkeditemcount&" Seçilen", 1) Buda durumun görüntüsü; Quote Link to comment Share on other sites More sharing options...
blue_life Posted December 7, 2013 Share Posted December 7, 2013 @xarax GUICtrlSendMsg($hwnd, 4146, 0, 0) şeklinde bir komtu ile seçilenlerin sayısını alman mümkün. Senin yazdığın şekilde de olabilir lakin sistem çok yük getirip takılma yapar... Example() Func Example() GUICreate("listview items", 220, 250, 100, 200) GUISetBkColor(0x00E0FFFF) ; will change background color Local $listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150, 0x0008) Local $item1 = GUICtrlCreateListViewItem("item2|col22|col23", $listview) Local $item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview) Local $item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview) Local $item4 = GUICtrlCreateListViewItem("item2|col22|col23", $listview) Local $item5 = GUICtrlCreateListViewItem("item1|col12|col13", $listview) GUISetState() Local $msg While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 Exit EndSwitch ToolTip("Total Select:" & GUICtrlSendMsg($listview, 4146, 0, 0)) WEnd EndFunc ;==>Example Quote Link to comment Share on other sites More sharing options...
KintaRo Posted December 7, 2013 Share Posted December 7, 2013 bizi AutoIT ile aldatan eski AMS'ciler, hepinizi tek tek not ediyorum Quote Link to comment Share on other sites More sharing options...
blue_life Posted December 7, 2013 Share Posted December 7, 2013 (edited) Mesajda seçim yazdığı için konuyu yanlış anlamışım malesef. Ben önceki örnekte listeden seçilen nesne sayısı için örnek vermiştim. Listeden işaretlenmiş nesne sayısını almak için basit bir kod yoktu bildiğim kadarıyla. Lakin aşağıdaki gibi bir kodlama kullanılabilir. _WM_Notify_Events ile nenedeki değişiklikleri izlediğimiz için sisteme fazla yüklenme olmayacaktır. Kısaca kodlamada nesnelere hakim olabilmek için bir array oluşturup nesnelerin idlerini bu arraya atadık. Bu sayede nesnelerle işlem yapmak daha kolay olacaktır. Neyse örnek zaten çok karışık değil... Global $ListItemCount[11][1] = [[10]] ;Item Id Global $I GUICreate("listview items", 220, 250, 100, 200) Global $listview = GUICtrlCreateListView("col1|col2|col3", 10, 10, 200, 150, BitOR(0x0008, 0x0000, 1), BitOR(4, 32)) For $I = 1 to $ListItemCount[0][0] $ListItemCount[$I][0] = GUICtrlCreateListViewItem($I & "|Test|Test", $listview) GUICtrlSetState($ListItemCount[$I][0],1) Next Global $Checked_Total = _Checked_Total() GUIRegisterMsg(78, "_WM_Notify_Events") GUISetState() Local $msg While 1 $nMsg = GUIGetMsg() Switch $nMsg Case -3 Exit EndSwitch ToolTip("İşaretli olan nesne sayısı; " & $Checked_Total) WEnd Func _Checked_Total() Local $Return = 0 For $I = 1 to $ListItemCount[0][0] $Return += BitAND(GUICtrlRead($ListItemCount[$I][0],1), 1) Next Return $Return EndFunc Func _WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) Local $tagNMHDR = DllStructCreate("int;int;int;int Item;int SubItem;int NewState;int OldState;int Changed;int ActionX;int ActionY;int Param", $lParam) If @error Then Return 0 Local $event = DllStructGetData($tagNMHDR, 3) Switch $wParam Case $listview Switch $event Case -101 ;$LVN_ITEMCHANGED Local $NewState = DllStructGetData($tagNMHDR, "NewState") If $NewState = 0 Then ContinueCase If BitAND($NewState, 4096) = 4096 Or BitAND($NewState, 8192) = 8192 Then $Checked_Total = _Checked_Total() ;~ ConsoleWrite(DllStructGetData($tagNMHDR, "Item") & @TAB & DllStructGetData($tagNMHDR, "SubItem") & @TAB & _ ;~ DllStructGetData($tagNMHDR, "Changed") & @TAB & DllStructGetData($tagNMHDR, "NewState") & @TAB & DllStructGetData($tagNMHDR, "OldState") & @CRLF) EndSwitch EndSwitch $tagNMHDR = 0 Return "GUI_RUNDEFMSG" EndFunc ;==>_WM_Notify_Events Edited December 7, 2013 by blue_life Foruma ekleyince kodlar bozulduğu için düzenlendi. Quote Link to comment Share on other sites More sharing options...
xarax Posted December 7, 2013 Author Share Posted December 7, 2013 bizi AutoIT ile aldatan eski AMS'ciler, hepinizi tek tek not ediyorum KintaRo abi, Eski AMS'ci değilim hala AMS ile aram iyi, Yapacağım uygulamayı AMS de de yapabilirim ama dosya boyutu biraz yüksek olacaktı. Birde ilgili nesnelerde Grup görünümünü AMS de göremedim. Ayrıca Tab için ekstra bir plugin yada tasarımsal çalışmaya gitmek gerekmiyor. Hem autoit öğrenmek iyi oluyor. AMS bazı konularda yetersiz kalabiliyor.O zaman hibrit çalışıyorum (AMS-Autoit) Herşeye rağmen AutoIT'te AMS de ki kadar rahat kod yazamıyorum şimdilik. AMS, İlk aşkım bırakamam :) Quote Link to comment Share on other sites More sharing options...
KintaRo Posted December 7, 2013 Share Posted December 7, 2013 1- TreeList plugini ile grup görünümü yapabiliyosun 2- Tab işi çok kolay 3- AutoIt aynı HTML gibi her şey kodla 4- tabi autoit'in artıları çok. şaka yapıyorum ben :D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.