Waiting for input

Unforgiving400

New member
Joined
Feb 21, 2008
Messages
3
Programming Experience
3-5
I have a program (its really big so i wont post it all) but im trying to get the main program to stop and wait for the user to make a selection in a diffrent form. in the past i got by this by making lots of sub like

main.start >
other.getInput>
main.keepgoing

but the way this program works i cant think of a way to just stop the loop and resum without seriusly recoding thousands of lines of code, and that does not sould like fun.

this is the main.sub that runs the program:
VB.NET:
Private Sub RUN_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RUN.Tick
        ActingPlayer.Text = World.GetCharacter(PlayerIndex).GetType.ToString
        If World.GetCharacter(PlayerIndex).isHuman() Then
            While World.GetCharacter(PlayerIndex).isActing()
                ActionSelection.Show()
                While actionBuffer < 0
                    'This should wait for the ActionSelection to finish its action
                End While
                selectingSpace = True
                While locbuffer.Equals(Nothing)
                    'This should wait for the user to click a location
                End While
                World.GetCharacter(PlayerIndex).getAction(actionBuffer).Cast(World.GetCharacter(PlayerIndex), locBuffer)
                clearActionBuffer()
            End While
        Else
            World.GetCharacter(PlayerIndex).Act()
        End If
        PlayerIndex += 1
        If PlayerIndex + 1 < World.numberOfCharacters Then
            PlayerIndex += 1
        Else
            PlayerIndex = 0
        End If
    End Sub

if you have questions about the other code i can post it.

but the buffers are just variables that hold the input from other functions and then are cleared after there used.

basicly the problem im seeing is when i run the code the loop keeps running so fast the display never catches up so the selection form never becoms usable because the proccess of the loop freezes up the program.
 
ActionSelection.ShowDialog()
 
Tryed the .showDialog()

Ok im using the .showDialog() and it worked kind of for the ActionSelect.ShowDialog() but fot the other while loop, its all the main forum, there is a panel that a drig is draw on and then a timer that loops through all the characters allowing them to run, i need the while loop to kind of wait for the user to click on a spot in the panel then continue with the rest of its functions... im thinking this could be done by exiting the tick sub and disableing the timer for a short bit but this seem like alot of unnessesary code.

PS. just to help me understand the .showDialog() whats the differance with that and just .show() ?
 
Back
Top