Nahuel Posted September 5, 2007 Share Posted September 5, 2007 (edited) Simple. All I want is that when the user clicks on ANY item of the first list, it enables the second one.Here's my code:expandcollapse popup#include <GUIconstants.au3> GUICreate("Resistor Color-2-Ohm",450,400) GUISetOnEvent($GUI_EVENT_CLOSE,"_exit") GUISetState() Opt ("GUIOnEventMode",1) $Lista1=GUICtrlCreateListView ("Primer Color ",10,10,90,205,$LVS_SINGLESEL+$LVS_NOSORTHEADER) GUICtrlSetOnEvent(-1,"habilitar2") $Lista2=GUICtrlCreateListView ("Segundo Color",100,10,90,205,$LVS_SINGLESEL+$LVS_NOSORTHEADER) GUICtrlSetOnEvent(-1,"habilitar3") $Lista3=GUICtrlCreateListView ("Tercer Color ",190,10,90,205,$LVS_SINGLESEL+$LVS_NOSORTHEADER) GUICtrlSetOnEvent(-1,"habilitar4") $Lista4=GUICtrlCreateListView ("Cuarto Color ",280,10,90,205,$LVS_SINGLESEL+$LVS_NOSORTHEADER) GUICtrlSetState($lista2,$GUI_DISABLE) GUICtrlSetState($lista3,$GUI_DISABLE) GUICtrlSetState($lista4,$GUI_DISABLE) GUICtrlCreateListViewItem("Item",$Lista1) GUICtrlCreateListViewItem("Item",$Lista1) GUICtrlCreateListViewItem("Item",$Lista1) GUICtrlCreateListViewItem("Item",$Lista2) GUICtrlCreateListViewItem("Item",$Lista2) GUICtrlCreateListViewItem("Item",$Lista2) GUICtrlCreateListViewItem("Item",$Lista3) GUICtrlCreateListViewItem("Item",$Lista3) GUICtrlCreateListViewItem("Item",$Lista3) While 1 Sleep(50) WEnd ;Funciones: Func _exit() Exit EndFunc Func habilitar2() GUICtrlSetState($lista2,$GUI_ENABLE) EndFunc Func habilitar3() GUICtrlSetState($lista3,$GUI_ENABLE) EndFunc Func habilitar4() GUICtrlSetState($lista4,$GUI_ENABLE) EndFuncIt doesn't work like this, but if I use the CtrlSetOnEvent with some item, it works: expandcollapse popup#include <GUIconstants.au3> GUICreate("Resistor Color-2-Ohm",450,400) GUISetOnEvent($GUI_EVENT_CLOSE,"_exit") GUISetState() Opt ("GUIOnEventMode",1) $Lista1=GUICtrlCreateListView ("Primer Color ",10,10,90,205,$LVS_SINGLESEL+$LVS_NOSORTHEADER) $Lista2=GUICtrlCreateListView ("Segundo Color",100,10,90,205,$LVS_SINGLESEL+$LVS_NOSORTHEADER) $Lista3=GUICtrlCreateListView ("Tercer Color ",190,10,90,205,$LVS_SINGLESEL+$LVS_NOSORTHEADER) $Lista4=GUICtrlCreateListView ("Cuarto Color ",280,10,90,205,$LVS_SINGLESEL+$LVS_NOSORTHEADER) GUICtrlSetState($lista2,$GUI_DISABLE) GUICtrlSetState($lista3,$GUI_DISABLE) GUICtrlSetState($lista4,$GUI_DISABLE) GUICtrlCreateListViewItem("Click here",$Lista1) GUICtrlSetOnEvent(-1,"habilitar2") GUICtrlCreateListViewItem("Item",$Lista1) GUICtrlCreateListViewItem("Item",$Lista1) GUICtrlCreateListViewItem("Item",$Lista2) GUICtrlCreateListViewItem("Click here",$Lista2) GUICtrlSetOnEvent(-1,"habilitar3") GUICtrlCreateListViewItem("Item",$Lista2) GUICtrlCreateListViewItem("Item",$Lista3) GUICtrlCreateListViewItem("Item",$Lista3) GUICtrlCreateListViewItem("Item",$Lista3) While 1 Sleep(50) WEnd ;Funciones: Func _exit() Exit EndFunc Func habilitar2() GUICtrlSetState($lista2,$GUI_ENABLE) EndFunc Func habilitar3() GUICtrlSetState($lista3,$GUI_ENABLE) EndFunc Func habilitar4() GUICtrlSetState($lista4,$GUI_ENABLE) EndFuncThe problem is that I need it to enable the next list when the user clicks any item, not a specific one. Why doesn't this work? Edited September 5, 2007 by Nahuel Link to comment Share on other sites More sharing options...
ChrisL Posted September 5, 2007 Share Posted September 5, 2007 (edited) This should work expandcollapse popup#include <GUIconstants.au3> Global Const $WM_NOTIFY = 0x004E; GUICreate("Resistor Color-2-Ohm",450,400) GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") GUISetOnEvent($GUI_EVENT_CLOSE,"_exit") Opt ("GUIOnEventMode",1) Global $Lista1=GUICtrlCreateListView ("Primer Color ",10,10,90,205,$LVS_SINGLESEL+$LVS_NOSORTHEADER) Global $Lista2=GUICtrlCreateListView ("Segundo Color",100,10,90,205,$LVS_SINGLESEL+$LVS_NOSORTHEADER) Global $Lista3=GUICtrlCreateListView ("Tercer Color ",190,10,90,205,$LVS_SINGLESEL+$LVS_NOSORTHEADER) Global $Lista4=GUICtrlCreateListView ("Cuarto Color ",280,10,90,205,$LVS_SINGLESEL+$LVS_NOSORTHEADER) GUICtrlSetState($lista2,$GUI_DISABLE) GUICtrlSetState($lista3,$GUI_DISABLE) GUICtrlSetState($lista4,$GUI_DISABLE) GUICtrlCreateListViewItem("Click here",$Lista1) GUICtrlCreateListViewItem("Item",$Lista1) GUICtrlCreateListViewItem("Item",$Lista1) GUICtrlCreateListViewItem("Item",$Lista2) GUICtrlCreateListViewItem("Click here",$Lista2) GUICtrlCreateListViewItem("Item",$Lista2) GUICtrlCreateListViewItem("Item",$Lista3) GUICtrlCreateListViewItem("Item",$Lista3) GUICtrlCreateListViewItem("Item",$Lista3) GUISetState() While 1 Sleep(50) WEnd ;Funciones: Func _exit() Exit EndFunc Func habilitar2() GUICtrlSetState($lista2,$GUI_ENABLE) GUICtrlSetState($lista3,$GUI_DISABLE) GUICtrlSetState($lista4,$GUI_DISABLE) EndFunc Func habilitar3() GUICtrlSetState($lista3,$GUI_ENABLE) GUICtrlSetState($lista4,$GUI_DISABLE) EndFunc Func habilitar4() GUICtrlSetState($lista4,$GUI_ENABLE) EndFunc Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event Local Const $NM_FIRST = 0 Local Const $NM_CLICK = ($NM_FIRST - 2) Local Const $NM_DBLCLK = ($NM_FIRST - 3) Switch $wParam Case $Lista1,$Lista2,$Lista3,$Lista4 $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) If $event = $NM_CLICK or $event = $NM_DBLCLK then Switch $wParam Case $Lista1 habilitar2() Case $Lista2 habilitar3() Case $lista3 habilitar4() Case $lista4 ConsoleWrite("Additional one" & @crlf) EndSwitch EndIf EndSwitch EndFunc Edit: Added a bit which if you go backwards it disables the correct one. so for example if you had gone all the way to the end then click back on the first one it disables 3 and 4 Edited September 5, 2007 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Nahuel Posted September 5, 2007 Author Share Posted September 5, 2007 Wow, thanks a lot! that could have saved me like 100 lines of codes, haha... This is why I needed it:http://www.autoitscript.com/forum/index.php?showtopic=52687I'll keep working on it and I'll use your idea, I like that. Link to comment Share on other sites More sharing options...
ChrisL Posted September 5, 2007 Share Posted September 5, 2007 good luck with it [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire 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