buzonjl Posted July 17, 2008 Posted July 17, 2008 hello, I don know if exist one maner more easy of capture data on a list construct in base of one secuence control edit , I search on all reference of autoit and nothing what convince me, I happy of can develop one alternative, and I hope help our if these is posyble. Check my code. This leave you insert data in a edit and later push Enter one hotkey save the data in a ini file. Is a example what would be util for anything more extensive. #include <GUIConstantsEx.au3> ;~ #include <networkTransferV2.au3> #include <register.au3> ;~ #include <utilityFunction.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <Constants.au3> #include <UpDownConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> $dirFiles="m:\cyberAdmin\" global $idControl $gui001=GUICreate("my gui",400,200,100,50) GUISetState(@SW_SHOW) $number=0 $rows=100 $buttonUp=guictrlcreatebutton("<-",200,0,20,20) $buttonDown=guictrlcreatebutton("->",200,180,20,20) GUIRegisterMsg($WM_COMMAND, "getID") $label=guictrlcreateLabel("...",250,150,100,20) for $i=0 to $rows ; this part make up the control and put them in pos x,y $nameVar1="r"&$i&"c1" $nameVar2="r"&$i&"c2" $hours=int(($i*5+1)/60) $minutes=mod(($i*5+1),60) Assign($nameVar1,GUICtrlCreateInput("De "&$hours&" hrs."&$minutes&" min. a "&$hours&" hrs."&$minutes+4&" min.",0,$i*20,150,20,$ES_READONLY)) ;no perderse esta linea es solo para poner los intervalos de tiempo en los cuadritos de edicion Assign($nameVar2,GUICtrlCreateInput("",150,$i*20,50,20,$ES_NUMBER+$ES_RIGHT)) Next global $posY=0 global $clicktimes=0 ;~ opt("MouseCoordMode",0) While 1 $msg=GUIGetMsg() ;~ If $msg=Eval("r0c3") then test() ;~ if $msg=$key Then keepData() if $msg=$buttonUp then ;~ IsDeclared() ;~ $posY=$posY-10 buttonUp() endif if $msg=$buttonDown then buttonDown() endif if $msg=$GUI_EVENT_CLOSE then Exit if WinGetState("my gui","")=15 then HotKeySet("{Enter}","keepData") Else HotKeySet("{Enter}") endif WEnd Func buttonUp() if $clickTimes<>$rows then $clicktimes=$clicktimes+1 for $i=0 to $rows $posY=$i*20-20*$clicktimes $nameVar1="r"&$i&"c1" $nameVar2="r"&$i&"c2" ;~ if IsDeclared($nameVar1)=0 then test() GUICtrlSetPos(eval($nameVar1),0,$posY) GUICtrlSetPos(eval($nameVar2),150,$posY) Next endif EndFunc func buttonDown() if $clickTimes<>0 then $clickTimes=$clickTimes-1 for $i=0 to $rows $posY=$i*20-20*$clicktimes $nameVar1="r"&$i&"c1" $nameVar2="r"&$i&"c2" GUICtrlSetPos(eval($nameVar1),0,$posY) GUICtrlSetPos(eval($nameVar2),150,$posY) Next endif EndFunc func getID($hWnd, $Msg, $wParam, $lParam) $wParam=Dec(StringRight($wParam,3)) GUICtrlSetData($label,$wParam) $idControl=$wParam Return $GUI_RUNDEFMSG EndFunc Func keepData() iniwrite($dirFiles&"Config.ini","Costs",$idControl-1,GUICtrlRead($idControl)) send("{TAB}") Send("{DEL}") $pos=ControlGetPos( "my gui", "", $idControl ) if $pos[1]>180 then buttonUp() EndFunc
buzonjl Posted July 18, 2008 Author Posted July 18, 2008 I have work a little more... if you get testing dont forgot what you have change the dirfiles by one site of your choice for the changes are saved in a inifile muttley the version 0.2 je je je ;~ #include <utilityFunction.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <Constants.au3> #include <UpDownConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> global $dirFiles="e:\cyberAdmin\" $gui001=GUICreate("my gui",450,250,100,50,BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX)) GUISetState() myTable() func myTable() global $nameWindow= WinGetTitle("") global $idControl= 0 global $rows= 100 global $left= 100 Global $top= 20 global $width= 0 Global $height= 140 local $buttonUp= guictrlcreatebutton("<-",210+$left,0+$top,20,20) local $buttonDown= guictrlcreatebutton("->",210+$left,$height-20+$top,20,20) global $clicktimes= 0 global $array1[$rows+1] global $array2[$rows+1] Local $nameVar1 Local $nameVar2 for $i=0 to $rows ; this part make up the control and put them in pos x,y $nameVar1= "r"&$i&"c1" $nameVar2= "r"&$i&"c2" local $hours= int(($i*5+1)/60) local $minutes= mod(($i*5+1),60) Assign($nameVar1,GUICtrlCreateInput("De "&$hours&" hrs."&$minutes& _ " min. a "&$hours&" hrs."&$minutes+4&" min.",0+$left,$i*20+$top,160,20 _ ,$ES_READONLY)) ;no perderse esta linea es solo para poner los ;intervalos de tiempo en los cuadritos de edicion $array1[$i]= eval($nameVar1) Assign($nameVar2,GUICtrlCreateInput("",160+$left,$i*20+$top,50,20,$ES_NUMBER+$ES_RIGHT)) $array2[$i]= eval($nameVar2) if $i*20>$height-20 then GUICtrlSetState(eval($nameVar1),$gui_hide) if $i*20>$height-20 then GUICtrlSetState(eval($nameVar2),$gui_hide) Next GUIRegisterMsg($WM_COMMAND, "getID") While 1 $msg=GUIGetMsg() if $msg= $buttonUp then buttonUp($clicktimes,$rows,$top,$left,$height,$array1,$array2) if $msg= $buttonDown then buttonDown($clicktimes,$rows,$top,$left,$height,$array1,$array2) if $msg= $GUI_EVENT_CLOSE then Exit if WinGetState($nameWindow,"")= 15 then HotKeySet("{Enter}","keepData") Else HotKeySet("{Enter}") endif WEnd EndFunc Func buttonUp(byRef $clicktimes,byRef $rows,byref $top,byref $left,byref $height,Byref $array1,Byref $array2) if $clickTimes<> $rows then $clicktimes=$clicktimes+1 for $i=0 to $rows $posY= $i*20+$top-20*$clicktimes GUICtrlSetPos($array1[$i],0+$left,$posY) GUICtrlSetPos($array2[$i],160+$left,$posY) guictrlsetState($array1[$i],$gui_hide) guictrlsetState($array2[$i],$gui_hide) if $posY>= $top and $posY<$height+$top then guictrlsetState($array1[$i],$gui_show) if $posY>= $top and $posY<$height+$top then guictrlsetState($array2[$i],$gui_show) Next endif EndFunc func buttonDown(byRef $clicktimes,byRef $rows,byref $top,byref $left,byref $height,Byref $array1,Byref $array2) if $clickTimes<>0 then $clickTimes=$clickTimes-1 for $i= 0 to $rows $posY= $i*20+$top-20*$clicktimes GUICtrlSetPos($array1[$i],0+$left,$posY) GUICtrlSetPos($array2[$i],160+$left,$posY) guictrlsetState($array1[$i],$gui_hide) guictrlsetState($array2[$i],$gui_hide) if $posY>= $top and $posY<$height+$top then guictrlsetState($array1[$i],$gui_show) if $posY>= $top and $posY<$height+$top then guictrlsetState($array2[$i],$gui_show) Next endif EndFunc func getID($hWnd, $Msg, $wParam, $lParam) $wParam= Dec(StringRight($wParam,3)) $idControl= $wParam Return $GUI_RUNDEFMSG EndFunc Func keepData() iniwrite($dirFiles&"Config.ini","Costs",GUICtrlRead($idControl-1),GUICtrlRead($idControl)) $pos= ControlGetPos( $nameWindow, "", $idControl ) if $pos[1]>$height-$top then buttonUp($clicktimes,$rows,$top,$left,$height,$array1,$array2) send("{TAB}") Send("{DEL}") EndFunc
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