Jester009 Posted February 3, 2008 Posted February 3, 2008 (edited) Hi guys, Can somebody please explain whats wrong with this piece of code? I tried hours without success #include <GUIConstants.au3> #Include <GuiListView.au3> $GUI = GUICreate("FORM", 611, 371, 217, 195) $tab = GUICtrlCreateTab(10, 10, 590, 350, $GUI_ONTOP) $tab1 = GUICtrlCreateTabItem("Tab1") GUICtrlCreateTabItem("") $tab2 = GUICtrlCreateTabItem("Tab2") GUICtrlCreateTabItem("") $tab3=GUICtrlCreateTabitem ("Tab3") $hListView = _GUICtrlListView_Create ($GUI,"FIELD1|FIELD2|FIELD3|FIELD4|FIELD5", 20, 50, 570, 250, BitOR($LVS_SINGLESEL, $LVS_REPORT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES)) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW, $GUI) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Thanks, Jester009 Edited February 3, 2008 by Jester009
picaxe Posted February 3, 2008 Posted February 3, 2008 Try this #include <GUIConstants.au3> #Include <GuiListView.au3> $GUI = GUICreate("FORM", 611, 371, 217, 195) $tab = GUICtrlCreateTab(10, 10, 590, 350, $GUI_ONTOP) $tab1 = GUICtrlCreateTabItem("Tab1") GUICtrlCreateTabItem("") $tab2 = GUICtrlCreateTabItem("Tab2") GUICtrlCreateTabItem("") $tab3=GUICtrlCreateTabitem ("Tab3") $hTab3 = GUICtrlGetHandle($tab3) $hListView = GUICtrlCreateListView ("FIELD1|FIELD2|FIELD3|FIELD4|FIELD5", 20, 50, 570, 250, BitOR($LVS_SINGLESEL, $LVS_REPORT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES)) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW, $GUI) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd _GUICtrlListView_SetExtendedListViewStyle requires a handle, but GUICtrlCreateListView returns a controlid, however it works and the help file example for _GUICtrlListView_SetExtendedListViewStyle shows the same usage.
rasim Posted February 3, 2008 Posted February 3, 2008 Jester009Hmm... interesting problem. But i don`t understand where allow error.#include <GUIConstants.au3> #Include <GuiListView.au3> $GUI = GUICreate("FORM", 611, 371, 217, 195) $tab = GUICtrlCreateTab(10, 10, 590, 350, $TCS_FIXEDWIDTH) $tab1 = GUICtrlCreateTabItem("Tab1") $tab2 = GUICtrlCreateTabItem("Tab2") $tab3=GUICtrlCreateTabitem ("Tab3") $iListView = GUICtrlCreateListView("FIELD1|FIELD2|FIELD3|FIELD4|FIELD5", 20, 50, 570, 250, BitOR($LVS_SINGLESEL, $LVS_REPORT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($iListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES)) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW, $GUI) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEndSo this work, but i`m be curious, why your example don`t work. What say a GarryFrost?
Jester009 Posted February 3, 2008 Author Posted February 3, 2008 (edited) Thanks a lot for rasim and picaxe for replying. I used GUICtrlCreateListView at first. But when I tried to delete an entry I got and error. Thats why I used _GUICtrlListView_Create. When I use this code the delete function does not work... (with GUICtrlCreateListView) expandcollapse popup#include <GUIConstants.au3> #Include <GuiListView.au3> $GUI = GUICreate("FORM1", 611, 371, 217, 195) $tab = GUICtrlCreateTab(10, 10, 590, 350, $GUI_ONTOP) $tab1 = GUICtrlCreateTabItem("Tab1") GUICtrlCreateTabItem("") $tab2 = GUICtrlCreateTabItem("Tab2") GUICtrlCreateTabItem("") $tab3=GUICtrlCreateTabitem ("Tab3") $hListView = GUICtrlCreateListView ("FIELD1|FIELD2|FIELD3|FIELD4|FIELD5", 20, 50, 570, 250, BitOR($LVS_SINGLESEL, $LVS_REPORT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES)) Dim $aItems[10][5] For $iI = 0 To UBound($aItems) - 1 $aItems[$iI][0] = "Item " & $iI $aItems[$iI][1] = "Item " & $iI & "-1" $aItems[$iI][2] = "Item " & $iI & "-2" $aItems[$iI][3] = "Item " & $iI & "-3" $aItems[$iI][4] = "Item " & $iI & "-4" Next _GUICtrlListView_AddArray ($hListView, $aItems) $Button1 = GUICtrlCreateButton("Button1", 340, 320, 50, 20) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW, $GUI) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button1 $i = _GUICtrlListView_GetSelectedIndices($hListView, 1) _GUICtrlListView_DeleteItem($hListView, $i[1]) EndSelect WEnd When I use this code the delete function works. But the listview appears on all the tabs. (With _GUICtrlListView_Create) expandcollapse popup#include <GUIConstants.au3> #Include <GuiListView.au3> $GUI = GUICreate("FORM1", 611, 371, 217, 195) $tab = GUICtrlCreateTab(10, 10, 590, 350, $GUI_ONTOP) $tab1 = GUICtrlCreateTabItem("Tab1") GUICtrlCreateTabItem("") $tab2 = GUICtrlCreateTabItem("Tab2") GUICtrlCreateTabItem("") $tab3=GUICtrlCreateTabitem ("Tab3") $hListView = _GUICtrlListView_Create ($GUI,"FIELD1|FIELD2|FIELD3|FIELD4|FIELD5", 20, 50, 570, 250, BitOR($LVS_SINGLESEL, $LVS_REPORT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES)) Dim $aItems[10][5] For $iI = 0 To UBound($aItems) - 1 $aItems[$iI][0] = "Item " & $iI $aItems[$iI][1] = "Item " & $iI & "-1" $aItems[$iI][2] = "Item " & $iI & "-2" $aItems[$iI][3] = "Item " & $iI & "-3" $aItems[$iI][4] = "Item " & $iI & "-4" Next _GUICtrlListView_AddArray ($hListView, $aItems) $Button1 = GUICtrlCreateButton("Button1", 340, 320, 50, 20) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW, $GUI) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button1 $i = _GUICtrlListView_GetSelectedIndices($hListView, 1) _GUICtrlListView_DeleteItem($hListView, $i[1]) EndSelect WEnd Any idea why its happening?? Edited February 3, 2008 by Jester009
Danny35d Posted February 3, 2008 Posted February 3, 2008 When I use this code the delete function does not work... (with GUICtrlCreateListView) expandcollapse popup#include <GUIConstants.au3> #Include <GuiListView.au3> $GUI = GUICreate("FORM1", 611, 371, 217, 195) $tab = GUICtrlCreateTab(10, 10, 590, 350, $GUI_ONTOP) $tab1 = GUICtrlCreateTabItem("Tab1") GUICtrlCreateTabItem("") $tab2 = GUICtrlCreateTabItem("Tab2") GUICtrlCreateTabItem("") $tab3=GUICtrlCreateTabitem ("Tab3") $hListView = GUICtrlCreateListView ("FIELD1|FIELD2|FIELD3|FIELD4|FIELD5", 20, 50, 570, 250, BitOR($LVS_SINGLESEL, $LVS_REPORT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES)) Dim $aItems[10][5] For $iI = 0 To UBound($aItems) - 1 $aItems[$iI][0] = "Item " & $iI $aItems[$iI][1] = "Item " & $iI & "-1" $aItems[$iI][2] = "Item " & $iI & "-2" $aItems[$iI][3] = "Item " & $iI & "-3" $aItems[$iI][4] = "Item " & $iI & "-4" Next _GUICtrlListView_AddArray ($hListView, $aItems) $Button1 = GUICtrlCreateButton("Button1", 340, 320, 50, 20) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW, $GUI) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button1 $i = _GUICtrlListView_GetSelectedIndices($hListView, 1) _GUICtrlListView_DeleteItem($hListView, $i[1]) EndSelect WEndoÝ÷ Ø ò×¢¶ÈZ¦§x?ªê-x]¡ë'ßÛp¢¹yÆ®±á +k*Þj×ËUìºw-ëzÛ«Ëaz'^ØêÜ¢{k¢RÂ¥xe Úå.+-V'°ëRzWµçHØzƧte Úå.+-V'° é^µâ-zgîËb¢{'yçmì"Ú0²§vW¢Ø^rí®ZºÚ"µÍØÙH ÌÍÛÙÈH ÌÍÐ]ÛBBBIÌÍÚÛHÕRPÝÙ][J ÌÍÚÝY]ÊB ÌÍÚHHÑÕRPÝÝY]×ÑÙ]Ù[XÝY[XÙÊ ÌÍÚÛJBY ÌÍÚVÌH ÝÈ[ÑÕRPÝÝY]×Ñ[]R][J ÌÍÚÛ ÌÍÚVÌWJ AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Jester009 Posted February 3, 2008 Author Posted February 3, 2008 Thanks a lot Danny35d. You do not know how many hours I wasted trying to figure this out... Thanks a million
GaryFrost Posted February 3, 2008 Posted February 3, 2008 There is no GarryFrost. The even if the UDF created listview returned a control id Autoit wouldn't treat it the same as the Built-in Listview. There is a lot of internal code used to make the built-in controls behave as they do. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
laurent68 Posted February 7, 2008 Posted February 7, 2008 I have the same problem : But the listview appears on all the tabs. (With _GUICtrlListView_Create) any idea ?
GaryFrost Posted February 7, 2008 Posted February 7, 2008 I have the same problem : But the listview appears on all the tabs. (With _GUICtrlListView_Create)any idea ?Use GuiCtrlCreateListView SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
ReFran Posted February 7, 2008 Posted February 7, 2008 http://www.autoitscript.com/forum/index.ph...amp;hl=ReinhardHTH, Reinhard
rasim Posted February 7, 2008 Posted February 7, 2008 GaryFrostThere is no GarryFrost Sorry, i don`t want offend you.
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