ShadowElf Posted October 27, 2009 Posted October 27, 2009 Hy all, First of all, I'm a web programmer (php, javascript), so autoit is new for me. I try to do a text input to be added to a list It works first time, the second insert 0 and then nothing. I haven't understand how it works Thx all for help #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Opt('MustDeclareVars', 1) main() Func main() Global $Form1, $Codbar, $Cantitate, $List1, $Button1, $Button2 Opt("GUIOnEventMode", 1) $Form1 = GUICreate("ShadowPOS", 801, 601, 198, 120) $Codbar = GUICtrlCreateInput("", 62, 42, 153, 21) $Cantitate = GUICtrlCreateInput("", 62, 74, 153, 21) $List1 = GUICtrlCreateList("", 62, 112, 481, 396) GUICtrlSetData($List1, "Produs1 .12 . 20 . 440|item2|item3", "Produs1") $Button1 = GUICtrlCreateButton("Button1", 256, 40, 113, 25) GUICtrlSetOnEvent (-1, "citeste") $Button2 = GUICtrlCreateButton("Button1", 257, 73, 113, 25) GUICtrlSetOnEvent(-1, "cancel") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(10) WEnd EndFunc Func citeste() $codbar=GUICtrlRead($Codbar) GUICtrlSetData($List1, $codbar, "") EndFunc Func cancel() Exit EndFunc I like IT: php, mysql, codeingiter, css, jquery and AUTOIT
MvGulik Posted October 27, 2009 Posted October 27, 2009 In function citeste() your editing your Global $Codbar variable,affectingly erasing the link to your control.tryFunc citeste() Local $Codbar_tmp = GUICtrlRead($Codbar) & '|' GUICtrlSetData($List1, $Codbar_tmp) EndFunc "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
ShadowElf Posted October 27, 2009 Author Posted October 27, 2009 thx a lot, it works' now i have the code, and i want to focus after inseration on input $codbar. pls help? #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ListViewConstants.au3> #include <StructureConstants.au3> #include <GUIListView.au3> #Include <WinAPI.au3> #Region ### START Koda GUI section ### Form= Opt('MustDeclareVars', 1) main() Func main() Global $Form1, $Codbar, $Cantitate, $List1, $Button1, $Button2 Opt("GUIOnEventMode", 1) $Form1 = GUICreate("ShadowPOS", 801, 601, 198, 120) $Codbar = GUICtrlCreateInput("", 62, 42, 153, 21) $Cantitate = GUICtrlCreateInput("", 62, 74, 153, 21) $List1 = GUICtrlCreateListView('Produs|Cantitate', 62, 112, 481, 396) _GUICtrlListView_SetColumnWidth($List1, 0, 146) _GUICtrlListView_SetColumnWidth($List1, 1, $LVSCW_AUTOSIZE_USEHEADER) ;~ GUICtrlSetData(-1, "Edit1") GUICtrlCreateListViewItem('Row Column 1|Row Column 2', $list1) ;~ GUICtrlSetData($List1, "Produs1 .12 . 20 . 440|item2|item3", "Produs1") $Button1 = GUICtrlCreateButton("Button1", 256, 40, 113, 25) GUICtrlSetOnEvent (-1, "citeste") $Button2 = GUICtrlCreateButton("Button1", 257, 73, 113, 25) GUICtrlSetOnEvent(-1, "cancel") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(10) WEnd EndFunc Func citeste() Global $c $c=GUICtrlRead($Codbar) GUICtrlSetData ($Codbar, "") GUICtrlCreateListViewItem(''&$c&'|Row Column 2', $list1) EndFunc Func cancel() Exit EndFunc I like IT: php, mysql, codeingiter, css, jquery and AUTOIT
MvGulik Posted October 27, 2009 Posted October 27, 2009 Have you accualy tried any of the focus commands described in the MANUAL, I do't see any in your code. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
ShadowElf Posted October 27, 2009 Author Posted October 27, 2009 (edited) Like this? Func citeste() Global $c $c=GUICtrlRead($Codbar) GUICtrlSetData ($Codbar, "") GUICtrlCreateListViewItem(''&$c&'|Row Column 2', $list1) ControlFocus() ControlFocus("[CLASS:ShadowPOS]", "", $codbar) EndFunc Edited October 27, 2009 by ShadowElf I like IT: php, mysql, codeingiter, css, jquery and AUTOIT
GEOSoft Posted October 27, 2009 Posted October 27, 2009 GUICtrlSetState($codbar, $GUI_FOCUS) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
MvGulik Posted October 27, 2009 Posted October 27, 2009 (edited) Almost. Func citeste() Global $c, $List1 $c = GUICtrlRead($Codbar) GUICtrlSetData($Codbar, "") ;~ Local $hListView = $List1 ;~ GUICtrlSetState($hListView,$GUI_FOCUS) Local $hListViewItem = GUICtrlCreateListViewItem('' & $c & '|Row Column 2', $List1) GUICtrlSetState($hListViewItem,$GUI_FOCUS) EndFunc ps: please try to use a CODE or AUTOIT tag around your code, It looks so much better. (left bottom blue one) Edited October 27, 2009 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
GEOSoft Posted October 27, 2009 Posted October 27, 2009 Nice catch. As I sit here half awake. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
ShadowElf Posted October 30, 2009 Author Posted October 30, 2009 thanks all, it works I like IT: php, mysql, codeingiter, css, jquery and AUTOIT
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