How can I loop this?
Best Answer arizonabuckeye , 22 October 2014 - 10:41 PM
How can I loop this?
What do you mean loop? What are you trying to accomplish? What error are you getting?
the %....% part shouldn't be needed because 'Checked' is already passing that value to the variable.
How can I loop this?
Loop, 5 { ; set some random values for the vars Random, n, 0, 1 Var%A_Index% := n } Loop, 5 Gui, Add, Checkbox, % "x10 y+10 checked" Var%A_Index% " vVar" A_Index, Checkbox %A_Index% Gui, Add, Button, gButton1, Submit Gui, Show return Button1: Gui, Submit, NoHide Output := "" Loop, 5 Output .= Var%A_Index% "`r`n" MsgBox, %Output% return GuiClose: ExitApp
Yes, this works
One more question, how can I change the starting pos y
(I am terrible understanding when to use %.. " dots and combinations of everything... and I read the files many times )
The y position must be something like y%PosY%, because sometimes I am looping several columns of checkboxes.
Example:
Look at the documentation on Gui's http://www.autohotke...ommands/Gui.htm I think you are missing some commas and have quotes misplaced. I "think" it should be like
Gui, Add, Checkbox,X150 Y+5, Checked NameABC%A_Index%, vNameAbc%A_Index%, SomeText%A_Index%
In this case the % is used to indicate a variable is being called rather than explicit text/data.
If you are having trouble getting the GUI to populate try doing it without the index then integrate the index after you know the GUI functions.
It should look ending like a square of checkboxes
Loop, 5 { ; set some random values for the NameABC vars Random, n, 0, 1 NameABC%A_Index% := n } Loop 5 { PosY := 100 + (A_Index-1) * 20 MsgBox, % "x150 y" PosY " checked" NameABC%A_Index% " vNameABC" A_Index ; Shows the result of this expression Gui, Add, Checkbox, % "x150 y" PosY " checked" NameABC%A_Index% " vNameABC" A_Index, % SomeText%A_Index% Gui, Add, Checkbox, % "x200 y" PosY " checked" NameXYZ%A_Index% " vNameXYZ" A_Index Gui, Add, Checkbox, % "x250 y" PosY " checked" NameFFF%A_Index% " vNameFFF" A_Index Gui, Add, Checkbox, % "x300 y" PosY " checked" NameDDD%A_Index% " vNameDDD" A_Index } ExitApp
Thanks arizona, but that give me in the gui: [ ] checked, name var
Kon, that is exactly!