Results 1 to 16 of 16

Thread: Drawing Lines

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Posts
    6

    Unhappy Drawing Lines

    JUST STARTED FIRST ASSIGNMENT IN VB AND AM STUCK.

    HAVE TO DRAW A LINE ON A PIC BOX GOING NORTH, SOUTH, EAST OR WEST WITH 3 COMMAND BUTTONS AND LABEL SHOWING DIRECTION (N,S,E,W)

    1- FORWARD BUTTON
    2- TURN LEFT
    3 TURN RIGHT

    DEFAULT IS 300 TWIPS PER CLICK

    THE LINE STARTS AT BOTTOM, MIDDLE OF PICTURE BOX AND IS ALWAYS CONNECTED.


    I HAVE BEEN ABLE TO MOVE AN IMAGE ROUND ON A PIC BOX (ALTHOUGH NOT ROTATING IT) WITH A CORRESPONDING DIRECTION IN A LABEL (N,S,E,W). THIS IMAGE MOVES 300 TWIPS WITH EACH CLICK. HOWEVER, I JUST CANNOT FIGURE OUT HOW TO DRAW A LINE THAT ACTS IN THE SAME WAY.

    CAN ANYONE HELP ME, PLEASE???????????

    KIND REGARDS

    JAMES

  2. #2
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274

    Re: Drawing Lines

    Hi
    ok first thing .. let go of that caps lock key!!
    here is some code for u to play around with.. i am not sure what stage u are at with VB and so maybe some of it u may not be sure about. Pls ask if u have any qtns or if u need to do it an easier way eg without a seperate 'Update' subroutine.
    Regards
    Stuart
    VB Code:
    1. 'FORM HAS:
    2. Picture1 - Picture box
    3. Command1, Command2, Command3, Command4 - Command buttons
    4. Label1 - Label control
    5.  
    6. Option Explicit
    7.  
    8. Dim CurX As Single 'starting / current positions
    9. Dim CurY As Single
    10.  
    11. Private Sub Form_Load()
    12.     'Set captions .. can be done at design time instead of here
    13.     Command1.Caption = "North"
    14.     Command2.Caption = "West"
    15.     Command3.Caption = "East"
    16.     Command4.Caption = "South"
    17.     'Set start position to centre bottom
    18.     With Picture1 'Work on Picture1 within With.. With End stmt
    19.         CurX = .Width \ 2 'Centre of picture
    20.         CurY = .Height 'Bottom of picture
    21.         .CurrentX = CurX 'Set drawing posn
    22.         .CurrentY = CurY
    23.     End With
    24. End Sub
    25.  
    26. Private Sub Command1_Click()
    27.     Update 0, -300 'Tell sub to move X by 0 and Y by -300
    28.     Label1.Caption = "North" 'update caption
    29. End Sub
    30.  
    31. Private Sub Command2_Click()
    32.     Update -300, 0
    33.     Label1.Caption = "West"
    34. End Sub
    35.  
    36. Private Sub Command3_Click()
    37.     Update 300, 0
    38.     Label1.Caption = "East"
    39. End Sub
    40.  
    41. Private Sub Command4_Click()
    42.     Update 0, 300
    43.     Label1.Caption = "South"
    44. End Sub
    45.  
    46. Private Sub Update(ByVal MoveX As Single, ByVal MoveY As Single)
    47.     'Sub gets movement amounts of X and Y
    48.     'You can check for boundaries of picture or remove everything before and
    49.     'including the "Then" keyword
    50.     If CurX + MoveX > 0 And CurX + MoveX < Picture1.Width Then CurX = CurX + MoveX
    51.     If CurY + MoveY > 0 And CurY + MoveY < Picture1.Height Then CurY = CurY + MoveY
    52.     'Draw line from current position to new position
    53.     Picture1.Line -(CurX, CurY)
    54. End Sub
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  3. #3
    Frenzied Member JungleMan's Avatar
    Join Date
    Feb 2001
    Posts
    2,033

    Re: Re: Drawing Lines

    Originally posted by beachbum
    Hi
    ok first thing .. let go of that caps lock key!!
    if he starts misspelling stuff he'll be teh next jeff K
    I'm bringing geeky back...

  4. #4
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    What are you saying James? I thought Stuarts code hit it right on the head.

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Posts
    6

    Thumbs up

    Originally posted by MarkT
    What are you saying James? I thought Stuarts code hit it right on the head.


    Stuart U nailed it,

    Thanks mate, that helped a great deal.

    How about making the line disappear and reappear several commands later? The lines already drawn must stay visible.


    Any help appreciated


    James in sunny UK

  6. #6
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    hi again
    ok, how about something like this.. it is not "perfect" but u can get the idea and play around with it.

    1) Keep all the sub code from the original and only change the ones listed here
    2) Add a small shape control to the picture box. Add a checkbox control to the form (not in the pic box)

    VB Code:
    1. Option Explicit
    2.  
    3. Dim CurX As Single 'starting / current positions
    4. Dim CurY As Single
    5.  
    6.  
    7. Private Sub Form_Load()
    8.     'Set captions .. can be done at design time instead of here
    9.     Command1.Caption = "North"
    10.     Command2.Caption = "West"
    11.     Command3.Caption = "East"
    12.     Command4.Caption = "South"
    13.     'Set start position to centre bottom
    14.     With Picture1 'Work on Picture1 within With.. With End stmt
    15.         CurX = .Width \ 2 'Centre of picture
    16.         CurY = .Height 'Bottom of picture
    17.         .CurrentX = CurX 'Set drawing posn
    18.         .CurrentY = CurY
    19. 'New---------------------------------------------------------
    20.         .AutoRedraw = True
    21.     End With
    22.    
    23.     Check1.Caption = "Hide Line"
    24.     Shape1.Visible = False
    25. 'New---------------------------------------------------------
    26. End Sub
    27.  
    28. Private Sub Update(ByVal MoveX As Single, ByVal MoveY As Single)
    29.     'Sub gets movement amounts of X and Y
    30.     'You can check for boundaries of picture or remove everything before and
    31.     'including the "Then" keyword
    32.     If CurX + MoveX > 0 And CurX + MoveX < Picture1.Width Then CurX = CurX + MoveX
    33.     If CurY + MoveY > 0 And CurY + MoveY < Picture1.Height Then CurY = CurY + MoveY
    34.     'Draw line from current position to new position
    35.     Picture1.Line -(CurX, CurY)
    36. 'New---------------------------------------------------------
    37.     With Shape1
    38.         .Move CurX - .Width \ 2, CurY - .Height \ 2
    39.     End With
    40. 'New---------------------------------------------------------
    41. End Sub
    42.  
    43. 'New---------------------------------------------------------
    44. Private Sub Check1_Click()
    45.     If Check1.Value = vbChecked Then
    46.         Shape1.Visible = True
    47.         Picture1.DrawMode = 11 'Sorry cant remember constant name
    48.     Else
    49.         Shape1.Visible = False
    50.         Picture1.DrawMode = 13
    51.     End If
    52. End Sub
    53. 'New---------------------------------------------------------
    Regards
    Stuart
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  7. #7
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    Hi Jimmbo
    In response to ur Pm regarding saving lines into an array, i added extra code to that which u already had.

    ps. I receive an email as soon as u or anyone else replies to this thread and so it can save u from doing pm's.
    Regards
    Stuart

    VB Code:
    1. 'Form contains
    2. 'Command buttons (Command1 to Command4)
    3. 'Label1 for direction
    4. 'Check1 if u want to hide / show line
    5. 'Shape1 inside picture box
    6. 'Picture1 for drawing area
    7.  
    8. 'NEW CONTROLS SINCE LAST TIME
    9. 'Command Buttons (Command5 to Command7) for record, stop, play
    10. 'Timer1 for playback
    11.  
    12.  
    13. Option Explicit
    14.  
    15. 'NEW ------------------------------------.
    16. Private Type LineType
    17.     X1 As Single
    18.     Y1 As Single
    19.     X2 As Single
    20.     Y2 As Single
    21.     'You could add stuff here for colours etc
    22. End Type
    23. Dim MyLine() As LineType
    24. Dim LineCounter As Long
    25. Dim RecorderOn As Boolean
    26. 'NEW ------------------------------------'
    27.  
    28. Dim CurX As Single 'starting / current positions
    29. Dim CurY As Single
    30.  
    31.  
    32. Private Sub Form_Load()
    33. 'NEW ------------------------------------
    34.     LineCounter = -1 'so that first item starts at zero by adding 1
    35.     Command5.Caption = "Record"
    36.     Command6.Caption = "Stop Recording"
    37.     Command7.Caption = "Playback"
    38.     Command6.Enabled = False
    39.     Command7.Enabled = False
    40.     RecorderOn = True 'set to on auto
    41.     Timer1.Interval = 500 '1/2 second playback
    42.     Timer1.Enabled = False 'Set timer off to start
    43. 'NEW ------------------------------------
    44.    
    45.     'Set captions .. can be done at design time instead of here
    46.     Command1.Caption = "North"
    47.     Command2.Caption = "West"
    48.     Command3.Caption = "East"
    49.     Command4.Caption = "South"
    50.     'Set start position to centre bottom
    51.     With Picture1 'Work on Picture1 within With.. With End stmt
    52.         CurX = .Width \ 2 'Centre of picture
    53.         CurY = .Height 'Bottom of picture
    54.         .CurrentX = CurX 'Set drawing posn
    55.         .CurrentY = CurY
    56.         .AutoRedraw = True
    57.     End With
    58.    
    59.     Check1.Caption = "Hide Line"
    60.     Shape1.Visible = False
    61. End Sub
    62.  
    63.  
    64. Private Sub Command1_Click()
    65.     Update 0, -300 'Tell sub to move X by 0 and Y by -300
    66.     Label1.Caption = "North" 'update caption
    67. End Sub
    68.  
    69. Private Sub Command2_Click()
    70.     Update -300, 0
    71.     Label1.Caption = "West"
    72. End Sub
    73.  
    74. Private Sub Command3_Click()
    75.     Update 300, 0
    76.     Label1.Caption = "East"
    77. End Sub
    78.  
    79. Private Sub Command4_Click()
    80.     Update 0, 300
    81.     Label1.Caption = "South"
    82. End Sub
    83.  
    84. Private Sub Update(ByVal MoveX As Single, ByVal MoveY As Single)
    85.     'Sub gets movement amounts of X and Y
    86.     'You can check for boundaries of picture or remove everything before and
    87.     'including the "Then" keyword
    88.     If CurX + MoveX > 0 And CurX + MoveX < Picture1.Width Then CurX = CurX + MoveX
    89.     If CurY + MoveY > 0 And CurY + MoveY < Picture1.Height Then CurY = CurY + MoveY
    90.    
    91. 'NEW ------------------------------------.
    92.     'Put line into array
    93.     If RecorderOn And Shape1.Visible = False Then 'Only do if drawing a line
    94.         'NB u could also set some other flag if preferred
    95.         LineCounter = LineCounter + 1
    96.         ReDim Preserve MyLine(LineCounter)
    97.         With MyLine(LineCounter)
    98.             .X1 = Picture1.CurrentX
    99.             .Y1 = Picture1.CurrentY
    100.             .X2 = CurX
    101.             .Y2 = CurY
    102.         End With
    103.     End If
    104. 'NEW ------------------------------------'
    105.    
    106.     'Draw line from current position to new position
    107.     Picture1.Line -(CurX, CurY)
    108.     With Shape1
    109.         .Move CurX - .Width \ 2, CurY - .Height \ 2
    110.     End With
    111. End Sub
    112.  
    113. Private Sub Check1_Click()
    114.     If Check1.Value = vbChecked Then
    115.         Shape1.Visible = True
    116.         Picture1.DrawMode = 11 'Sorry cant remember constant name
    117.     Else
    118.         Shape1.Visible = False
    119.         Picture1.DrawMode = 13
    120.     End If
    121. End Sub
    122.  
    123. 'NEW ------------------------------------.
    124. Private Sub Command5_Click()
    125. 'Start recording
    126.     With Picture1
    127.         'Remember current coordinates before clearing
    128.         CurX = .CurrentX
    129.         CurY = .CurrentY
    130.         .Cls 'Clear picture to start with
    131.         .CurrentX = CurX 'Reset coords
    132.         .CurrentY = CurY
    133.     End With
    134.     RecorderOn = True
    135.     LineCounter = -1
    136.    
    137.     'Show applicable buttons
    138.     Command5.Enabled = False 'Record
    139.     Command6.Enabled = True 'Stop
    140.     Command7.Enabled = False 'Play
    141. End Sub
    142.  
    143. Private Sub Command6_Click()
    144. 'Stop recording
    145.     RecorderOn = False
    146.     Command5.Enabled = True
    147.     Command6.Enabled = False
    148.     Command7.Enabled = True
    149. End Sub
    150.  
    151. Private Sub Command7_Click()
    152. 'Playback using Timer 1
    153.     Command5.Enabled = False
    154.     Command6.Enabled = False
    155.     Command7.Enabled = False
    156.     If UBound(MyLine) >= 0 Then
    157.         Picture1.Cls 'Clear before redraw
    158.         Timer1.Enabled = True 'Only do if some to redraw
    159.     Else
    160.         Command5.Enabled = True 'Else reset to allow recording
    161.     End If
    162. End Sub
    163.  
    164. Private Sub Timer1_Timer()
    165. 'Actual redraw
    166.     Static lNumLines As Long
    167.  
    168.     If lNumLines <= UBound(MyLine) Then
    169.         With MyLine(lNumLines)
    170.             Picture1.Line (.X1, .Y1)-(.X2, .Y2)
    171.         End With
    172.         lNumLines = lNumLines + 1
    173.     Else
    174.         lNumLines = 0
    175.         Timer1.Enabled = False
    176.         Command5.Enabled = True
    177.         Command7.Enabled = True
    178.     End If
    179. End Sub
    180. 'NEW ------------------------------------'
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  8. #8

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Posts
    6

    Question RECORD

    Hi Stu

    I am having trouble with the code.

    Have an error message when playback is pressed "subscript out of range" and VB directs me to:

    If UBound(MyLine) >=0 Then etc

    Any ideas before I headbut the monitor


    Regards

    Jimbo

  9. #9
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    Hi
    That is strange. I just copied and pasted to a new project and it worked fine. did u change anything in the code before running it?

    If u didnt change code and you are still getting a problem at that line u can change...

    FROM : If Ubound(MyLine)>=0 Then

    TO: If LineCounter >= 0 Then

    Regards
    Stuart
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  10. #10
    Addicted Member
    Join Date
    Sep 2001
    Location
    Indiana,PA,USA
    Posts
    217
    I just copied and pasted and pasted staurt and Beachebump first code.I placed label 4 commad buttons and one picture.

    It is not working.It is not drawing lines when I click the nuttons.

    Thanks.
    Sudha

  11. #11
    Addicted Member
    Join Date
    Sep 2001
    Location
    Indiana,PA,USA
    Posts
    217
    It is working.Sorry it is my mistake.I chenged image color = black. .

    Thanks.
    Sudha

  12. #12

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Posts
    6

    Smile Store and play back 2 shapes

    Hi

    Stu, it seems your code has the ability to store several shapes but I am struggling to play back each shape individually.

    My aim is to have a combo box on the form with the choice of recording 2 different shapes. At any time I am able to playback either shape.

    Any Ideas????


    James




    Option Explicit
    Private Type LineType
    X1 As Single
    Y1 As Single
    X2 As Single
    Y2 As Single

    End Type
    Dim Shape1 As String
    Dim Shape2 As String


    Dim Black As String
    Dim Blue As String
    Dim Green As String
    Dim Red As String
    Dim MyLine() As LineType
    Dim LineCounter As Long
    Dim RecorderOn As Boolean
    Dim CurX As Single
    Dim CurY As Single
    Dim n As Integer
    Dim up As Single
    Dim Down As Single
    Dim west As Single
    Dim south As Single
    Dim east As Single
    Dim north As Single



    Private Sub Command1_Click()

    n = Text1.Text
    Image1.Stretch = True

    If Combo1.Text = "Red" Then
    Picture1.ForeColor = vbRed

    ElseIf Combo1.Text = "Green" Then
    Picture1.ForeColor = vbGreen

    ElseIf Combo1.Text = "Blue" Then
    Picture1.ForeColor = vbBlue

    ElseIf Combo1.Text = "Black" Then
    Picture1.ForeColor = vbBlack
    End If


    If Label1.Caption = "north" Then
    Update 0, -n

    ElseIf Label1.Caption = "east" Then
    Update -n, 0


    ElseIf Label1.Caption = "south" Then
    Update 0, n

    ElseIf Label1.Caption = "west" Then
    Update n, 0

    End If


    End Sub

    'west is right
    'east is left
    Private Sub Command2_Click()
    If Label1.Caption = "north" Then
    Label1.Caption = "east"


    ElseIf Label1.Caption = "east" Then
    Label1.Caption = "south"

    ElseIf Label1.Caption = "south" Then
    Label1.Caption = "west"

    Else
    Label1.Caption = "north"
    End If

    End Sub

    Private Sub Command3_Click()

    If Label1.Caption = "north" Then
    Label1.Caption = "west"

    ElseIf Label1.Caption = "west" Then
    Label1.Caption = "south"

    ElseIf Label1.Caption = "south" Then
    Label1.Caption = "east"

    Else
    Label1.Caption = "north"
    End If


    End Sub


    Private Sub Command4_Click()

    Text2.Text = "down"
    If Text2.Text = "down" Then
    Picture1.DrawMode = 13
    Image1.Visible = True

    End If

    End Sub

    Private Sub Command5_Click()
    Text2.Text = "up"
    If Text2.Text = "up" Then
    Picture1.DrawMode = 11
    Image1.Visible = True

    End If


    End Sub

    Private Sub Command6_Click()

    With Picture1
    Picture1.Cls
    Combo1.Text = "Black"
    Label1.Caption = "north"
    CurX = .Width \ 2
    CurY = .Height \ 2
    .CurrentX = CurX
    .CurrentY = CurY

    End With

    With Image1
    .Move CurX - .Width \ 2, CurY - .Height \ 2
    End With


    If Command8.Enabled = False Then
    Image1.Visible = True
    End If

    Combo1.Enabled = True


    End Sub

    Private Sub Command7_Click()
    'Start recording

    With Picture1
    'Remember current coordinates before clearing

    CurX = .CurrentX
    CurY = .CurrentY

    .Cls 'Clear picture to start with

    CurX = .Width \ 2
    CurY = .Height \ 2
    .CurrentX = CurX
    .CurrentY = CurY

    End With



    If RecorderOn = True Then

    LineCounter = -1

    'Show applicable buttons

    Command7.Enabled = False 'Record

    Command8.Enabled = True 'Stop

    Command9.Enabled = False 'Play

    Combo1.Enabled = False

    End If

    End Sub

    Private Sub Command8_Click()
    'Stop recording

    RecorderOn = False

    Command7.Enabled = True 'was true

    Command8.Enabled = False

    Command9.Enabled = True

    End Sub

    Private Sub Command9_Click()
    'Playback using Timer 1

    Command7.Enabled = False

    Command8.Enabled = False

    Command9.Enabled = False

    Combo1.Enabled = False 'have put in


    If UBound(MyLine) >= 0 Then

    Picture1.Cls 'Clear before redraw
    Image1.Visible = False 'image invis. on play

    Timer1.Enabled = True 'Only do if some to redraw

    Else

    Command7.Enabled = False 'Else reset to allow recording
    'was true
    End If

    End Sub

    Private Sub Form_Load()



    Combo2.Text = "Shape1"
    Combo2.AddItem "Shape1"
    Combo2.AddItem "Shape2"

    Combo1.Text = "Black"
    Combo1.AddItem "Black"
    Combo1.AddItem "Red"
    Combo1.AddItem "Green"
    Combo1.AddItem "Blue"

    Text2.Text = "down"
    LineCounter = -1

    Command7.Caption = "Record Shape"
    Command8.Caption = "Stop"
    Command9.Caption = "Play"
    Command8.Enabled = False
    Command9.Enabled = False


    RecorderOn = True
    Timer1.Interval = 500
    Timer1.Enabled = False

    With Picture1
    CurX = .Width \ 2
    CurY = .Height \ 2
    .CurrentX = CurX
    .CurrentY = CurY
    .AutoRedraw = True
    End With

    With Image1
    .Move CurX - .Width \ 2, CurY - .Height \ 2

    End With
    Image1.Visible = True

    End Sub


    Private Sub Update(ByVal MoveX As Single, ByVal MoveY As Single)
    If CurX + MoveX > 0 And CurX + MoveX < Picture1.Width Then CurX = CurX + MoveX
    If CurY + MoveY > 0 And CurY + MoveY < Picture1.Height Then CurY = CurY + MoveY



    LineCounter = LineCounter + 1
    ReDim Preserve MyLine(LineCounter)

    With MyLine(LineCounter)

    .X1 = Picture1.CurrentX

    .Y1 = Picture1.CurrentY

    .X2 = CurX

    .Y2 = CurY

    End With

    Picture1.Line -(CurX, CurY)


    With Image1
    .Move CurX - .Width \ 2, CurY - .Height \ 2

    End With

    End Sub

    Private Sub Timer1_Timer()
    'Actual redraw
    Static lNumLines As Long


    If lNumLines <= UBound(MyLine) Then

    With MyLine(lNumLines)

    Picture1.Line (.X1, .Y1)-(.X2, .Y2)

    End With

    lNumLines = lNumLines + 1

    Else

    lNumLines = 0

    Timer1.Enabled = False


    Command7.Enabled = True

    Command9.Enabled = True

    End If

    End Sub

  13. #13

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Posts
    6

    Unhappy Auto record

    Me again

    Lets forget about 2 shapes for the time being.

    Any further lines drawn after stop is pressed are still recorded and played back.

    It seems the recorder is on auto all the time (which is how it was set in form), but I want to be able to draw further lines on the picturebox without recording them.

    Without sounding a dick, How do i turn off auto record.


    Desperate


    James

  14. #14
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    Dear Desperate (in my best Agony Aunt voice)
    I dont quite follow what u are saying about Auto record. The recording will start when u press the record button and stop when u press the stop button. If u then press the record button again it will erase the current lines and start recording from the current position.

    So, i think the problem is that i am not following what u are trying to do. can u pls try again and maybe put it in point form... no code at this stage.. i just want to see what u are trying to achieve overall. And pretend that u are explaining it to a 6 yr old... 1- so that u cover everything and 2- becos that is not far from the truth
    Regards
    Stuart
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  15. #15

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Posts
    6

    Smile RECORD

    Hi Stu,

    I will try to be a simple and precise as possible (Hopefully)

    Ok, I am now reffering to your original code and not mine.

    1 - Run program
    2 - Press record
    3 - Draw a square
    4 - Press Stop record
    5 - Draw another line without pressing record
    6 - finish drawing other line
    7 - press play to see square that i recorded
    8 - square is drawn ASWELL as the other line
    9 - I dont want this other line to redraw when i press play.

    So, what i want to do is record a shape, then I want to be able to draw another shape without it being automatically recorded.

    so, i want to be able to

    1 - press record
    2 - draw a square (for example)
    3 - press stop
    4 - draw a few more shapes for fun without recording
    5 - press play to see recorded square only
    6 - draw a few more lines and shapes without recording
    7 - press play again to see square only.


    Thus, only the square is saved in memory.

    I was also attempting to record several shapes for furture playback at any time. However, I think I will just be happy to record one shape.


    Hope you understand


    Kind Regards

    James

  16. #16
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    Hi James
    Now u got me confused lol. I just set up the program again straight from here (copy / paste) and it does not redisplay any lines drawn after u press Stop Record. This is how it goes (for me at least )

    1 - Run program
    2 - Press record
    3 - Draw a square
    4 - Press Stop record
    5 - Draw another line without pressing record
    6 - finish drawing other line
    7 - press play to see square that i recorded
    8 - square is drawn AND NOT THE OTHER LINE

    Are u sure that u didnt modify the code somehow?

    Also in regard to recording a number of shapes. You can already do that. Remember that u have the checkbox to stop the line being visible. And so, if u do this u can record 2 squares for example.

    1 - Run program
    2 - Press record
    3 - Draw a square
    4 - Check the Hide Line checkbox
    5 - Move to a new position
    6 - Uncheck the checkbox
    7 - Draw another square
    8 - Press Stop record
    9 - press play to see both squares

    This works. You dont have to use the particular controls that i set up but the underlying code can be transferred as u desire. If u just make up a separate project for testing and copy / paste the code directly from here I am sure that it will work as planned.
    Regards
    Stuart
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

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