Click here to Skip to main content
15,891,881 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hello,

I have the following problem where i dont see the solution.
I have created a vb .net 2008 programm that is used thru a touch screen.

The problem that is sometimes coming thru is that the users are ticking to fast (i think) on the touch screen and the windows are coming above eachother.

When they click a option , i show a new form and direct after this i close the old form befor doing something else.

like the commands below.


I use a FrmMain that is a big one in dimensions almost the full screen.
When selecting a button on this main form i do the following command.

FrmMain.enabled=false
FrmTest.show()


Now there is a form on top of the mainform (the one that is disabled and greyed out). In this new form there are a few options. when clicking on a button for example Total of the bill is do the follwoing command.

FrmTotal.Show()
Me.Enabled = False


The new windows comes up with a total amount to pay. When clicking on 'payed' i do the following commands

me.close
frmtest.close()
frmmain.enabled=true
frmain.show()
frmmain.focus()



so it is like that tey can click next to the frm.total and so set the frmmain on top of the small frmtotal so it is not possible anymore to click on the button on the frmTotal because of the frmmain that is on top of the small window.
I dont understand this is possible since the frmmain is still disabled.


The program comes in a wrong windows position and can only be solved when using a mouse to click on the correct form.

Because the use of a touch screen there is no mouse , neither a keyboard is connected.

So the programm is locked because the windows is on top of the one they have to click.

Is there some comand so i can check that i can put in extra


Suggestions are most welcome.

Thanks.


best regards


Didier
Posted
Updated 6-Jun-11 21:41pm
v4
Comments
Sergey Alexandrovich Kryukov 7-Jun-11 2:29am    
Sounds like an apparent misuse, but still not clear. Make a simple code sample (no detail except showing/disabling/enabling the forms) and post the code here. Use "Improve question".
--SA

1) I think you need to change the order you perform the opertaions to make it more logical.

2) Also look at using the TopMost property which will adjust the zOrder of the windows.

3) Use the hide property first, perform the other options and then close the form, best to keep the close till last.

See the code below as example of what you are trying to do above;
VB
Public Class FormMain

Private Sub ButtonShowTest_Click(sender As System.Object, e As System.EventArgs) Handles ButtonShowTest.Click
        Me.Enabled = False
        FormTest.Show()
        FormTest.TopMost = True
End Sub
End Class


VB
Public Class FormTest

Private Sub ButtonShowPay_Click(sender As System.Object, e As System.EventArgs) Handles ButtonShowPay.Click
        Me.Enabled = False
        FormPay.Show()
        FormPay.TopMost = True
End Sub

Private Sub ButtonClose_Click(sender As System.Object, e As System.EventArgs) Handles ButtonClose.Click
        Me.Hide()
        FormMain.Enabled = True
        Me.Close()

End Sub
End Class


VB
Public Class FormPay

Private Sub ButtonClose_Click(sender As System.Object, e As System.EventArgs) Handles ButtonClose.Click
    Me.Hide()
    FormTest.Enabled = True
    Me.Close()
End Sub
End Class
 
Share this answer
 
Try changing your code a bit: instead of using the Show method, use ShowDialog. The difference is that the later does not return until the form is closed. This way, the form that needs to show a sub form remains in control - the sub form does not need to know about the earlier ones.

frmMain:
me.Enabled = false
FrmTest.ShowDialog()
me.Enabled = true

frmTest:
me.Enabled = false
FrmTotal.ShowDialog()
me.Enabled = true
me.Close()

frmTotal:
me.Close()

This way, it is clearer what is happening, and better structured. Your problem should disappear.
 
Share this answer
 
Comments
DaveAuld 7-Jun-11 5:45am    
Yours is probably the better option.........
DaveAuld 7-Jun-11 5:46am    
Although, you don't need to disable the original form as it is blocked anyway. :)
OriginalGriff 7-Jun-11 6:28am    
I would agree, but the OP did, presumably to grey out all the controls to indicate to the user that he can't use them - makes sense to me!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900