RìggníX Posted March 3, 2007 Share Posted March 3, 2007 hi guys! i've made a for-next loop and have to save a Control id in every run. and the loop must run 255 times. so i can't save it in a array, can i? so i thought that there must be a way to set a variables name with another variable. for example: the variable of the for-next loop is called $i. no i want to create variables in every run, which names would be $var1, $var2, $var3... someone's got an idea? greetz, RìggníXBiTrAtE.tk Link to comment Share on other sites More sharing options...
_Kurt Posted March 3, 2007 Share Posted March 3, 2007 (edited) This won't work. The best way to accomplish this is to create an array & store data within it. It should look something like this:#include <Array.au3> ;This is for _ArrayDisplay function Local $array[254] ;Create array For $i = 1 To UBound($array)-1 ;For-Next loop $array[$i-1] = "This is $array[" & $i-1 & "]" ;For each array, store text Next _ArrayDisplay($array, "") ;Display the whole Array (Mainly for testing purposes)[untested] Good luck,KurtEDIT: Small correction Edited March 3, 2007 by _Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
RìggníX Posted March 3, 2007 Author Share Posted March 3, 2007 k, that works. there are controlIDs of listviewitems saved in this array. How can i use them by clicking on it? btw: i use the MessegaLoop mode greetz, RìggníXBiTrAtE.tk Link to comment Share on other sites More sharing options...
_Kurt Posted March 3, 2007 Share Posted March 3, 2007 there are controlIDs of listviewitems saved in this array.How can i use them by clicking on it?I'm having trouble trying to understand what you are trying to do. What exactly are you trying to say? Mind elaborating on that? Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
RìggníX Posted March 3, 2007 Author Share Posted March 3, 2007 k: i've made a CtrlListView. in that for-next loop there are CtrlListViewItem's created, and their ControlID's are saved in this array. Now, i want the program to react, if the user double clicks an item. greetz, RìggníXBiTrAtE.tk Link to comment Share on other sites More sharing options...
_Kurt Posted March 3, 2007 Share Posted March 3, 2007 Not too sure what you want to do, but I think this will help: expandcollapse popup;THIS SCRIPT WAS CREATE BY GAFROST ; Events - ListView #include <GuiConstants.au3>;Inclusion file for the GUI interface controls #include <GuiListView.au3> #region Global variables Global $ListView Global Const $WM_NOTIFY = 0x004E Global Const $DebugIt = 1 ;ListView Events Global Const $NM_FIRST = 0 Global Const $NM_CLICK = ($NM_FIRST - 2) Global Const $NM_DBLCLK = ($NM_FIRST - 3) #endregion End Global variables Opt("WinTitleMatchMode", 2) $main_GUI = GUICreate("GuiRegisterMsg Test", 225, 400, 300, 10, BitOR($WS_THICKFRAME, $WS_SIZEBOX)) $ListView = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280, BitOR($LVS_SORTASCENDING, $LVS_SINGLESEL)) _GUICtrlListViewSetColumnWidth ($ListView, 0, 100) _GUICtrlListViewSetColumnWidth ($ListView, 1, 100) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlCreateListViewItem("Name 1|Category 1", $ListView) GUICtrlCreateListViewItem("Name 2|Category 2", $ListView) GUISetState() ;Register WM_NOTIFY events GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 $msg = GUIGetMsg() Switch $msg ;----------------------------------------------------------------------------------------- ;This case statement exits and updates code if needed Case $GUI_EVENT_CLOSE Exit ;----------------------------------------------------------------------------------------- ;put all the misc. stuff here Case Else ;;; EndSwitch WEnd Func ListView_Click() ;Use this if you want to detect SINGLE clicks EndFunc ;==>ListView_Click Func ListView_DoubleClick() MsgBox(0,"Double Clicked", _GUICtrlListViewGetItemText ($ListView, _GUICtrlListViewGetSelectedIndices($ListView))) EndFunc ;==>ListView_DoubleClick ; ; WM_NOTIFY event handler Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) ;NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $ListView Select Case $event = $NM_CLICK ListView_Click () Case $event = $NM_DBLCLK ListView_DoubleClick () EndSelect EndSelect $tagNMHDR = 0 $event = 0 $lParam = 0 EndFunc ;==>WM_Notify_Events Script taken from a post from GaFrost Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
RìggníX Posted March 3, 2007 Author Share Posted March 3, 2007 thx, it works!! /signed greetz, RìggníXBiTrAtE.tk 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