Results 1 to 4 of 4

Thread: Three very simple questions.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Location
    Atlanta
    Posts
    104

    Question

    ok, three very simple questions.

    How can I check to see if a button is being held down?
    I'm trying to increment a number when a button is pressed. How can I continue to increment that number if a button is pressed and held?

    I'm also looking for some examples of pseudo-3d code. I understand this isn't assembly, but there has to be some examples out there. Vector examples or something.

    Is it possible to change a PictureBox image?

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    [code]
    1. Forget it how would you know how many to increment
    2. Don't know
    3. Yes....

    Set Picture1.Picture = LoadPicture("C:\myfile.jpg")
    [code]
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Lively Member
    Join Date
    Feb 2000
    Posts
    118

    Use the UpDown control

    Can you use an UpDown control? Try this on a sample project and see if it will work for you. Its in the common controls.
    Code:
    Option Explicit
    Dim iNum As Integer
    
    Private Sub Form_Load()
    iNum = 10
    Text1.Text = iNum
    End Sub
    
    Private Sub UpDown1_DownClick()
    iNum = iNum - 1
    Text1.Text = iNum
    End Sub
    
    Private Sub UpDown1_UpClick()
    iNum = iNum + 1
    Text1.Text = iNum
    End Sub
    Kokopeli
    VB6 SP3

  4. #4
    Lively Member
    Join Date
    Feb 2000
    Posts
    118

    Better

    You want it to imcrement while its held down, don't you? Start a project, put 2 Command buttons, cmdUp and cmdDown. Put 2 timers tmr Up and tmrDown and Text box Text1. Paste in this code and see if it does what you want.
    Code:
    Dim iNum As Integer
    
    Private Sub cmdUp_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    tmrUp.Enabled = True
    End Sub
    
    Private Sub cmdUp_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    tmrUp.Enabled = False
    End Sub
    
    Private Sub Form_Load()
    iNum = 10
    Text1.Text = iNum
    tmrUp.Interval = 100
    tmrDown.Interval = 100
    tmrUp.Enabled = False
    tmrDown.Enabled = False
    End Sub
    
    Private Sub tmrDown_Timer()
    iNum = iNum - 1
    Text1.Text = iNum
    End Sub
    
    Private Sub tmrUp_Timer()
    iNum = iNum + 1
    Text1.Text = iNum
    End Sub
    
    Private Sub cmdDown_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    tmrDown.Enabled = False
    End Sub
    
    Private Sub cmdDown_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    tmrDown.Enabled = True
    End Sub
    I think this will do what you want.
    Kokopeli
    VB6 SP3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width