|
-
Apr 7th, 2006, 12:21 PM
#1
Thread Starter
Addicted Member
[RESOLVED]moving error
VB Code:
Private Sub cmdmmove_KeyPress(KeyAscii As Integer)
If KeyAscii = 97 And picleftmale.Visible = True Then
frmupchar.Left = frmupchar.Left - 100
picleftmale.Visible = True
picbackmale.Visible = False
picfrontmale.Visible = False
ElseIf KeyAscii = 115 And picleftmale.Visible = True Then
frmupchar.Top = frmupchar.Top + 100
picfrontmale.Visible = True
picleftmale.Visible = False
picbackmale.Visible = False
ElseIf KeyAscii = 100 And picleftmale.Visible = True Then
frmupchar.Left = frmupchar.Left + 100
ElseIf KeyAscii = 119 And picleftmale.Visible = True Then
frmupchar.Top = frmupchar.Top - 100
picbackmale.Visible = True
picleftmale.Visible = False
picfrontmale.Visible = False
End If
that code is to make the frm move but the problem is it doesnt want to move anymore. maybe its bacause i have a **** load of stuff on the form. im not sure but ill leave the form so u can take a look
Last edited by Ebiru; Apr 10th, 2006 at 05:42 PM.
-
Apr 7th, 2006, 12:46 PM
#2
Re: moving error
my guess w/o downloading...
that cmdmmove needs to have the focus...
after downloading.. I have no clue whats going on in that form!! lol
try:
change the forms KeyPreview to True
then move your keypress code to Form_Keypress
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Apr 7th, 2006, 12:51 PM
#3
Thread Starter
Addicted Member
Re: moving error
 Originally Posted by Static
my guess w/o downloading...
that cmdmmove needs to have the focus...
after downloading.. I have no clue whats going on in that form!! lol
try:
change the forms KeyPreview to True
then move your keypress code to Form_Keypress
well u need to click cmdmmove other wise u wont move cause i got 3 other cmds which get the focus n it saved me some time and i try with the form_keypress but u need focus but the cmds got it
-
Apr 7th, 2006, 12:59 PM
#4
Re: moving error
but the problem is stuff is appearing , disapearing etc.. U might want to start over..
make your object move properly.. then slowly add things back in...
if u set keypreview to true.. it will still catch the keypress event even if a cmdbutton or textbox etc has focus...
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Apr 7th, 2006, 07:15 PM
#5
Re: moving error
 Originally Posted by Ebiru
VB Code:
Private Sub cmdmmove_KeyPress(KeyAscii As Integer)
If KeyAscii = 97 And picleftmale.Visible = True Then
frmupchar.Left = frmupchar.Left - 100
picleftmale.Visible = True
picbackmale.Visible = False
picfrontmale.Visible = False
ElseIf KeyAscii = 115 And picleftmale.Visible = True Then
frmupchar.Top = frmupchar.Top + 100
picfrontmale.Visible = True
picleftmale.Visible = False
picbackmale.Visible = False
ElseIf KeyAscii = 100 And picleftmale.Visible = True Then
frmupchar.Left = frmupchar.Left + 100
ElseIf KeyAscii = 119 And picleftmale.Visible = True Then
frmupchar.Top = frmupchar.Top - 100
picbackmale.Visible = True
picleftmale.Visible = False
picfrontmale.Visible = False
End If
that code is to make the frm move but the problem is it doesnt want to move anymore. maybe its bacause i have a **** load of stuff on the form. im not sure but ill leave the form so u can take a look
That would be better written like
VB Code:
If picleftmale.Visible = True Then
Select Case KeyAscii
Case 97
frmupchar.Left = frmupchar.Left - 100
picleftmale.Visible = True
picbackmale.Visible = False
picfrontmale.Visible = False
Case 115
frmupchar.Top = frmupchar.Top + 100
picfrontmale.Visible = True
picleftmale.Visible = False
picbackmale.Visible = False
Case 100
frmupchar.Left = frmupchar.Left + 100
Case 119
frmupchar.Top = frmupchar.Top - 100
picbackmale.Visible = True
picleftmale.Visible = False
picfrontmale.Visible = False
End Select
End If
-
Apr 9th, 2006, 07:40 PM
#6
Thread Starter
Addicted Member
Re: moving error
 Originally Posted by MartinLiss
That would be better written like
VB Code:
If picleftmale.Visible = True Then
Select Case KeyAscii
Case 97
frmupchar.Left = frmupchar.Left - 100
picleftmale.Visible = True
picbackmale.Visible = False
picfrontmale.Visible = False
Case 115
frmupchar.Top = frmupchar.Top + 100
picfrontmale.Visible = True
picleftmale.Visible = False
picbackmale.Visible = False
Case 100
frmupchar.Left = frmupchar.Left + 100
Case 119
frmupchar.Top = frmupchar.Top - 100
picbackmale.Visible = True
picleftmale.Visible = False
picfrontmale.Visible = False
End Select
End If
ty for cleaning up my code but it still doesnt work
-
Apr 9th, 2006, 07:48 PM
#7
Fanatic Member
Re: moving error
question - When you "hold" the key down does it work?
Software languages known:
Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
Software API's known:
Directx 7 and 8
Internet languages, in the process of learning:
HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX
-
Apr 9th, 2006, 08:04 PM
#8
Re: moving error
Put a breakpoint on the If picleftmale.Visible = True Then line and then step through the code using F8.
-
Apr 10th, 2006, 06:10 AM
#9
Thread Starter
Addicted Member
Re: moving error
 Originally Posted by damasterjo
question - When you "hold" the key down does it work?
no
 Originally Posted by MartinLiss
Put a breakpoint on the If picleftmale.Visible = True Then line and then step through the code using F8.
im not getting what u mean
-
Apr 10th, 2006, 07:38 AM
#10
Re: moving error
a breakpoint is when u click in the column next to the line of code. it will place a red dot in the column and highlight the line red... then when you run the code it willstop at that line. at this point u can pres F8 and have the code execute one line at a time.. helps to figure out where the problem is
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Apr 10th, 2006, 05:41 PM
#11
Thread Starter
Addicted Member
Re: moving error
i figure it out....
VB Code:
If picleftmale.Visible = True Then
that is what was wrong.... ty for ur help guys
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|