ultddave
October 24th, 2009, 06:19 PM
Hi all,
I'm having some trouble (again).
At the moment I'm trying to create and use a simple inputbox. (Like the one in Visual Basic)
I just created a simple Inputbox (=Windows Form) with a label, a button and a textbox.
In the eventhandler of the button I copy the content of the textbox to a global variable. And then I close the form using:
close();
Now I want to use the inputbox in another form.
So in "Form1" I'd like to call my inputbox. So I did this inside a public function of Form1:
inputbox window; // Create an Inputbox window
window.Show(); // Show it. => The window shows
window.focus(); // Change focus
But the problem is that the window (Inputbox) never gets focus and my "Form1" just keeps executing the lines after window.focus().
--> Is it possible to shift focus from my main program to the inputbox and when the inputbox closes (When I press the OKbutton on the inputbox), my main program will continue running.
So what I want is this in pseudo code:
- Open an inputbox where the user can enter text.
- Pause main program.
- User enters text in inputbox
- User presses OK button in inputbox
- Inputbox will validate input
- if the input is numerical => Save the input in a global variable and Close the inputbox
- When the inputbox closes, my mainprogram should continue running.
Is this possible? If so, how? ;)
Any help will be appreciated.
Greetz,
Dave
PS: The inputbox does not need to return a value. It just needs to get focus. ;)
I'm having some trouble (again).
At the moment I'm trying to create and use a simple inputbox. (Like the one in Visual Basic)
I just created a simple Inputbox (=Windows Form) with a label, a button and a textbox.
In the eventhandler of the button I copy the content of the textbox to a global variable. And then I close the form using:
close();
Now I want to use the inputbox in another form.
So in "Form1" I'd like to call my inputbox. So I did this inside a public function of Form1:
inputbox window; // Create an Inputbox window
window.Show(); // Show it. => The window shows
window.focus(); // Change focus
But the problem is that the window (Inputbox) never gets focus and my "Form1" just keeps executing the lines after window.focus().
--> Is it possible to shift focus from my main program to the inputbox and when the inputbox closes (When I press the OKbutton on the inputbox), my main program will continue running.
So what I want is this in pseudo code:
- Open an inputbox where the user can enter text.
- Pause main program.
- User enters text in inputbox
- User presses OK button in inputbox
- Inputbox will validate input
- if the input is numerical => Save the input in a global variable and Close the inputbox
- When the inputbox closes, my mainprogram should continue running.
Is this possible? If so, how? ;)
Any help will be appreciated.
Greetz,
Dave
PS: The inputbox does not need to return a value. It just needs to get focus. ;)