davidc wrote:[POST MOVED TO POWERSHELL GUI FORUM BY MODERATOR]
Sounds like a great idea
As for the loop, you have to switch your mindset to think in events instead of one continues script that runs in the console.
https://www.sapien.com/blog/2016/01/04/ ... in-events/
In this case don't need a loop in a GUI event driven script. For example, you should only trigger the next calculation after your child presses the submit button.
David
As a matter of fact.. I did switch my mindset.
I've made a script which runs in the console a few months so I had to port it to a GUI. One thing I had to let go for now is that they can enter how many calculations they will have to do.
That's what I did, Now I have a working GUI which shows the multiplications, how many good/bad answers and a button which shows their score
Kinda neat
Now I have to dive in events...
jvierra wrote:Suggestion.
Decide what "actions" are to be performed by the user in a session; what do they see and what do they do to respond. Once you define these steps then you can look at what controls will be used and how. Each control would have an appropriate event that moves to the next "state if the exercises.
Example:
User is presented with problem in Label1 -> user types answer into TextBox1.
===> Text box "Change" event checks answer and opens MessageBox with happy face and reward ("Very good - try another")
and new problem is displayed.
If answer wrong play ugly sound and clear answer for another guess.
loop on this until all problems are answered.
This requires one event that runs whenever an answer is typed and enter or tab is used or you could use a submit button.
I've found another piece of script from both of you about pressing Enter in a Textbox.
Code: Select all
$textbox1_KeyUp=[System.Windows.Forms.KeyEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.KeyEventArgs]
if($_.KeyCode -eq 'Enter')
{
&$button1_Click
}
}
I've tried this but when I entered a 2 digit solution, it does $button1_click on the first digit. I've changed the action of the textbox to KeyUp $button1_Click...
Did I misplace it in the script maybe?
As you may have noticed, I'm new to powershell studio and forms..
I've been working with powershell for over a year now and I really like it..