| Mirage Source http://web.miragesource.net/forums/ |
|
| Vbkey open/close http://web.miragesource.net/forums/viewtopic.php?f=201&t=3802 |
Page 1 of 1 |
| Author: | Kay-No [ Wed Jun 04, 2008 3:53 pm ] |
| Post subject: | Vbkey open/close |
Hello, im using vbkey's to open players inventory and such. But i what i got stuck at is how to make the second time the player presses the key, the pic will close. Ex. You press "i" and the inventory opens. Then you hit "i" again and the inventory closes Pretty simple? This is the piece of code im using. Code: Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If (KeyCode = vbKeyI) Then picPlayerInventory.Visible = True End If End Sub |
|
| Author: | Lea [ Wed Jun 04, 2008 3:56 pm ] |
| Post subject: | Re: Vbkey open/close |
Have the key press toggle a static/global boolean variable. |
|
| Author: | Lea [ Wed Jun 04, 2008 3:58 pm ] |
| Post subject: | Re: Vbkey open/close |
Or something like this Code: Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If (KeyCode = vbKeyI) Then If picPlayerInventory.Visible = True Then picPlayerInventory.Visible = False Else picPlayerInventory.Visible = True End If End If End Sub |
|
| Author: | Asrrin29 [ Wed Jun 04, 2008 7:52 pm ] |
| Post subject: | Re: Vbkey open/close |
Dave wrote: Or something like this Code: Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If (KeyCode = vbKeyI) Then If picPlayerInventory.Visible = True Then picPlayerInventory.Visible = False Else picPlayerInventory.Visible = True End If End If End Sub QFT |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|