Loading ...
Sorry, an error occurred while loading the content.

Requesting assistance with mystery bug

Expand Messages
  • allen.minton@rocketmail.com
    I have written a program to control a laboratory pump, and it seems to work well with one exception. I am trying to interrupt a for-next loop controlling
    Message 1 of 7 , Jun 12, 2013
    • 0 Attachment
      I have written a program to control a laboratory pump, and it seems to work well with one exception. I am trying to interrupt a for-next loop controlling repeated pump delivery strokes with a button click. The loop contains a scan statement, and the labeled routine associated with the button click contains a wait statement. However, when I click this button the main window closes abruptly and I receive an error message stating that the label associated with the button click is an invalid branch, but I do not understand why. I am copying the relevant portion of the code and the error message below.

      Any help would be greatly appreciated.

      Thanks,
      Allen Minton

      allenpminton@...
      minton@...

      -------------------------------------------------------------------

      Code extract -- for diagnostic purposes I commented out all of the pump-specific statements:

      -------------------------------------------------------------------

      ' newpumpcommand - June 12

      ' call OpenCOMM5
      ' call pumpinit

      nomainwin

      WindowWidth = 592
      WindowHeight = 140

      textbox #main.volfield, 30, 31, 56, 25
      textbox #main.pctfield, 118, 31, 56, 25
      textbox #main.durfield, 206, 31, 56, 25
      textbox #main.repfield, 302, 31, 56, 25
      statictext #main.statictext5, "Total volume", 22, 11, 96, 20
      statictext #main.statictext6, "% A", 134, 11, 24, 20
      statictext #main.statictext7, "Stroke duration", 190, 11, 96, 20
      statictext #main.statictext8, "# repetitions", 294, 11, 96, 20
      button #main.startbutton, "Start", [start], UL, 398, 31, 64, 40
      button #main.stopbutton, "Stop", [stopreps], UL, 486, 31, 56, 40
      textbox #main.messagefield, 94, 66, 208, 25
      open "New pump command" for window as #main
      print #main, "trapclose [closeall]"
      print #main, "font ms_sans_serif 0 16"

      'initializing input values

      print #main.volfield, "1"
      print #main.pctfield, "50"
      print #main.durfield, "10"
      print #main.repfield, "1"
      print #main.stopbutton, "!disable"


      [main.inputLoop] 'wait here for input event
      wait


      [start]
      print #main.startbutton, "!disable"
      print #main.stopbutton, "!enable"
      print #main.volfield, "!contents? vol$"
      print #main.pctfield, "!contents? pct$"
      print #main.durfield, "!contents? dur$"
      print #main.repfield, "!contents? rep$"
      vol = val(vol$)
      pctA = val(pct$)
      stepdur = val(dur$)
      nreps = val(rep$)

      call DispenseEmulate vol, pctA, stepdur, nreps

      print #main.stopbutton, "!disable"
      print #main.startbutton, "!enable"
      print #main.messagefield, ""

      wait

      [stopreps]
      print #main.stopbutton, "!disable"
      print #main.startbutton, "!enable"
      print #main.messagefield, ""
      wait

      [closeall]
      ' call ReturnContents 3
      close #main
      ' close #comm
      end

      '
      ' other stuff here deleted
      '

      sub DispenseEmulate totvol, pctA, duration, nreps

      for j = 1 to nreps

      msg$ = "rep " + str$(j) + " " + str$(pctA) + "%A"
      print #main.messagefield, msg$
      call delay duration
      scan ' stop button pressed?

      next j

      end sub

      ------------------------------------------------------------------


      Here is the error log that was created when I pressed the 'stop button'.

      -------------------------------------------------------------------

      Error log timestamp Wednesday 06/12/13 04:58:37 AM

      Runtime error: invalid branch label: [stopreps]

      Error(Exception)>>defaultAction
      Error(Exception)>>activateHandler: <anUndefinedObject>
      Error(Exception)>>handle
      Error(Exception)>>signal
      Error class(Exception class)>>signal: <'invalid branch label...'>
      BasicProgram(Object)>>error: <'invalid branch label...'>
      BasicProgram>>terminateRun: <anError>
      [] in BasicProgram>>errorHandlerBlock
      ExceptionHandler>>evaluateResponseBlock: <aBlockClosure> for: <anError>
      [] in ExceptionHandler>>handle:
      ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure>
      BlockClosure>>invisibleEnsure: <aBlockClosure>
      ExceptionHandler>>handle: <anError>
      ExceptionHandler>>findHandler: <anError>
      Error(Exception)>>activateHandler: <anExceptionHandler>
      Error(Exception)>>handle
      Error(Exception)>>signal
      Error class(Exception class)>>signal: <'invalid branch label...'>
      BasicProgram(Object)>>error: <'invalid branch label...'>
      BasicProgram>>goto: <'[stopreps]'>
      BasicProgram>>gotoAndIfStoppedBegin: <'[stopreps]'>
      BasicProgram>>handlerName: <'[stopreps]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection>
      Message>>perform
      Message>>evaluate
      BasicProgram>>scanEvent
      [] in BasicProgram>>begin
      ExceptionHandler>>evaluateProtectedBlock: <aBlockClosure>
      [] in ExceptionHandler>>activateDuring:
      ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure>
      BlockClosure>>invisibleEnsure: <aBlockClosure>
      ExceptionHandler>>activateDuring: <aBlockClosure>
      ExceptionHandler class>>handle: <anError class> with: <aBlockClosure> during: <aBlockClosure>
      BlockClosure>>on: <anError class> do: <aBlockClosure>
      BasicProgram>>begin
      BasicProgram>>gotoAndIfStoppedBegin: <'[start]'>
      BasicProgram>>handlerName: <'[start]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection>
      BasicProgram>>submitHandlerName: <'[start]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection>
      BasicProgram>>submitHandlerName: <'[start]'> callParameters: <anOrderedCollection>
      LibButton>>click
      BasicWindow>>click: <aLibButton>
      LibButton(Button)>>click: <aLibButton>
      Message>>perform
      Message>>evaluate
      LibButton(Object)>>triggerEvent: <#clicked>
      LibButton(Button)>>triggerClickedEvent
      LibButton(Button)>>notifyClicked: <983830>
      LibButton(Object)>>perform: <#notifyClicked:> with: <983830>
      LibButton(ControlPane)>>asyncControlEvent: <0> with: <983830>
      Message>>perform
      NotificationManager>>empty
    • Robert Hendrix
      It looks to me like your loop is inside a subroutine; the branch label for the stop button would not be recognized inside the subroutine. It would probably
      Message 2 of 7 , Jun 18, 2013
      • 0 Attachment
        It looks to me like your loop is inside a subroutine; the branch label
        for the stop button would not be recognized inside the subroutine. It
        would probably work if you used a gosub rather than a sub, which
        actually calls a true subroutine.

        Bob Hendrix

        On 6/12/2013 5:57 AM, allen.minton@... wrote:
        > I have written a program to control a laboratory pump, and it seems to work well with one exception. I am trying to interrupt a for-next loop controlling repeated pump delivery strokes with a button click. The loop contains a scan statement, and the labeled routine associated with the button click contains a wait statement. However, when I click this button the main window closes abruptly and I receive an error message stating that the label associated with the button click is an invalid branch, but I do not understand why. I am copying the relevant portion of the code and the error message below.
        >
        > Any help would be greatly appreciated.
        >
        > Thanks,
        > Allen Minton
        >
        > allenpminton@...
        > minton@...
        >
        > -------------------------------------------------------------------
        >
        > Code extract -- for diagnostic purposes I commented out all of the pump-specific statements:
        >
        > -------------------------------------------------------------------
        >
        > ' newpumpcommand - June 12
        >
        > ' call OpenCOMM5
        > ' call pumpinit
        >
        > nomainwin
        >
        > WindowWidth = 592
        > WindowHeight = 140
        >
        > textbox #main.volfield, 30, 31, 56, 25
        > textbox #main.pctfield, 118, 31, 56, 25
        > textbox #main.durfield, 206, 31, 56, 25
        > textbox #main.repfield, 302, 31, 56, 25
        > statictext #main.statictext5, "Total volume", 22, 11, 96, 20
        > statictext #main.statictext6, "% A", 134, 11, 24, 20
        > statictext #main.statictext7, "Stroke duration", 190, 11, 96, 20
        > statictext #main.statictext8, "# repetitions", 294, 11, 96, 20
        > button #main.startbutton, "Start", [start], UL, 398, 31, 64, 40
        > button #main.stopbutton, "Stop", [stopreps], UL, 486, 31, 56, 40
        > textbox #main.messagefield, 94, 66, 208, 25
        > open "New pump command" for window as #main
        > print #main, "trapclose [closeall]"
        > print #main, "font ms_sans_serif 0 16"
        >
        > 'initializing input values
        >
        > print #main.volfield, "1"
        > print #main.pctfield, "50"
        > print #main.durfield, "10"
        > print #main.repfield, "1"
        > print #main.stopbutton, "!disable"
        >
        >
        > [main.inputLoop] 'wait here for input event
        > wait
        >
        >
        > [start]
        > print #main.startbutton, "!disable"
        > print #main.stopbutton, "!enable"
        > print #main.volfield, "!contents? vol$"
        > print #main.pctfield, "!contents? pct$"
        > print #main.durfield, "!contents? dur$"
        > print #main.repfield, "!contents? rep$"
        > vol = val(vol$)
        > pctA = val(pct$)
        > stepdur = val(dur$)
        > nreps = val(rep$)
        >
        > call DispenseEmulate vol, pctA, stepdur, nreps
        >
        > print #main.stopbutton, "!disable"
        > print #main.startbutton, "!enable"
        > print #main.messagefield, ""
        >
        > wait
        >
        > [stopreps]
        > print #main.stopbutton, "!disable"
        > print #main.startbutton, "!enable"
        > print #main.messagefield, ""
        > wait
        >
        > [closeall]
        > ' call ReturnContents 3
        > close #main
        > ' close #comm
        > end
        >
        > '
        > ' other stuff here deleted
        > '
        >
        > sub DispenseEmulate totvol, pctA, duration, nreps
        >
        > for j = 1 to nreps
        >
        > msg$ = "rep " + str$(j) + " " + str$(pctA) + "%A"
        > print #main.messagefield, msg$
        > call delay duration
        > scan ' stop button pressed?
        >
        > next j
        >
        > end sub
        >
        > ------------------------------------------------------------------
        >
        >
        > Here is the error log that was created when I pressed the 'stop button'.
        >
        > -------------------------------------------------------------------
        >
        > Error log timestamp Wednesday 06/12/13 04:58:37 AM
        >
        > Runtime error: invalid branch label: [stopreps]
        >
        > Error(Exception)>>defaultAction
        > Error(Exception)>>activateHandler: <anUndefinedObject>
        > Error(Exception)>>handle
        > Error(Exception)>>signal
        > Error class(Exception class)>>signal: <'invalid branch label...'>
        > BasicProgram(Object)>>error: <'invalid branch label...'>
        > BasicProgram>>terminateRun: <anError>
        > [] in BasicProgram>>errorHandlerBlock
        > ExceptionHandler>>evaluateResponseBlock: <aBlockClosure> for: <anError>
        > [] in ExceptionHandler>>handle:
        > ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure>
        > BlockClosure>>invisibleEnsure: <aBlockClosure>
        > ExceptionHandler>>handle: <anError>
        > ExceptionHandler>>findHandler: <anError>
        > Error(Exception)>>activateHandler: <anExceptionHandler>
        > Error(Exception)>>handle
        > Error(Exception)>>signal
        > Error class(Exception class)>>signal: <'invalid branch label...'>
        > BasicProgram(Object)>>error: <'invalid branch label...'>
        > BasicProgram>>goto: <'[stopreps]'>
        > BasicProgram>>gotoAndIfStoppedBegin: <'[stopreps]'>
        > BasicProgram>>handlerName: <'[stopreps]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection>
        > Message>>perform
        > Message>>evaluate
        > BasicProgram>>scanEvent
        > [] in BasicProgram>>begin
        > ExceptionHandler>>evaluateProtectedBlock: <aBlockClosure>
        > [] in ExceptionHandler>>activateDuring:
        > ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure>
        > BlockClosure>>invisibleEnsure: <aBlockClosure>
        > ExceptionHandler>>activateDuring: <aBlockClosure>
        > ExceptionHandler class>>handle: <anError class> with: <aBlockClosure> during: <aBlockClosure>
        > BlockClosure>>on: <anError class> do: <aBlockClosure>
        > BasicProgram>>begin
        > BasicProgram>>gotoAndIfStoppedBegin: <'[start]'>
        > BasicProgram>>handlerName: <'[start]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection>
        > BasicProgram>>submitHandlerName: <'[start]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection>
        > BasicProgram>>submitHandlerName: <'[start]'> callParameters: <anOrderedCollection>
        > LibButton>>click
        > BasicWindow>>click: <aLibButton>
        > LibButton(Button)>>click: <aLibButton>
        > Message>>perform
        > Message>>evaluate
        > LibButton(Object)>>triggerEvent: <#clicked>
        > LibButton(Button)>>triggerClickedEvent
        > LibButton(Button)>>notifyClicked: <983830>
        > LibButton(Object)>>perform: <#notifyClicked:> with: <983830>
        > LibButton(ControlPane)>>asyncControlEvent: <0> with: <983830>
        > Message>>perform
        > NotificationManager>>empty
        >
        >
        >
        >
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
      • Robert Hendrix
        Another alternative would be to use the sub, but have the stop button exit the sub with an appropriate flag set to indicate the button had been pressed. Bob
        Message 3 of 7 , Jun 18, 2013
        • 0 Attachment
          Another alternative would be to use the sub, but have the stop button
          exit the sub with an appropriate flag set to indicate the button had
          been pressed.

          Bob Hendrix

          On 6/12/2013 5:57 AM, allen.minton@... wrote:
          > I have written a program to control a laboratory pump, and it seems to work well with one exception. I am trying to interrupt a for-next loop controlling repeated pump delivery strokes with a button click. The loop contains a scan statement, and the labeled routine associated with the button click contains a wait statement. However, when I click this button the main window closes abruptly and I receive an error message stating that the label associated with the button click is an invalid branch, but I do not understand why. I am copying the relevant portion of the code and the error message below.
          >
          > Any help would be greatly appreciated.
          >
          > Thanks,
          > Allen Minton
          >
          > allenpminton@...
          > minton@...
          >
          > -------------------------------------------------------------------
          >
          > Code extract -- for diagnostic purposes I commented out all of the pump-specific statements:
          >
          > -------------------------------------------------------------------
          >
          > ' newpumpcommand - June 12
          >
          > ' call OpenCOMM5
          > ' call pumpinit
          >
          > nomainwin
          >
          > WindowWidth = 592
          > WindowHeight = 140
          >
          > textbox #main.volfield, 30, 31, 56, 25
          > textbox #main.pctfield, 118, 31, 56, 25
          > textbox #main.durfield, 206, 31, 56, 25
          > textbox #main.repfield, 302, 31, 56, 25
          > statictext #main.statictext5, "Total volume", 22, 11, 96, 20
          > statictext #main.statictext6, "% A", 134, 11, 24, 20
          > statictext #main.statictext7, "Stroke duration", 190, 11, 96, 20
          > statictext #main.statictext8, "# repetitions", 294, 11, 96, 20
          > button #main.startbutton, "Start", [start], UL, 398, 31, 64, 40
          > button #main.stopbutton, "Stop", [stopreps], UL, 486, 31, 56, 40
          > textbox #main.messagefield, 94, 66, 208, 25
          > open "New pump command" for window as #main
          > print #main, "trapclose [closeall]"
          > print #main, "font ms_sans_serif 0 16"
          >
          > 'initializing input values
          >
          > print #main.volfield, "1"
          > print #main.pctfield, "50"
          > print #main.durfield, "10"
          > print #main.repfield, "1"
          > print #main.stopbutton, "!disable"
          >
          >
          > [main.inputLoop] 'wait here for input event
          > wait
          >
          >
          > [start]
          > print #main.startbutton, "!disable"
          > print #main.stopbutton, "!enable"
          > print #main.volfield, "!contents? vol$"
          > print #main.pctfield, "!contents? pct$"
          > print #main.durfield, "!contents? dur$"
          > print #main.repfield, "!contents? rep$"
          > vol = val(vol$)
          > pctA = val(pct$)
          > stepdur = val(dur$)
          > nreps = val(rep$)
          >
          > call DispenseEmulate vol, pctA, stepdur, nreps
          >
          > print #main.stopbutton, "!disable"
          > print #main.startbutton, "!enable"
          > print #main.messagefield, ""
          >
          > wait
          >
          > [stopreps]
          > print #main.stopbutton, "!disable"
          > print #main.startbutton, "!enable"
          > print #main.messagefield, ""
          > wait
          >
          > [closeall]
          > ' call ReturnContents 3
          > close #main
          > ' close #comm
          > end
          >
          > '
          > ' other stuff here deleted
          > '
          >
          > sub DispenseEmulate totvol, pctA, duration, nreps
          >
          > for j = 1 to nreps
          >
          > msg$ = "rep " + str$(j) + " " + str$(pctA) + "%A"
          > print #main.messagefield, msg$
          > call delay duration
          > scan ' stop button pressed?
          >
          > next j
          >
          > end sub
          >
          > ------------------------------------------------------------------
          >
          >
          > Here is the error log that was created when I pressed the 'stop button'.
          >
          > -------------------------------------------------------------------
          >
          > Error log timestamp Wednesday 06/12/13 04:58:37 AM
          >
          > Runtime error: invalid branch label: [stopreps]
          >
          > Error(Exception)>>defaultAction
          > Error(Exception)>>activateHandler: <anUndefinedObject>
          > Error(Exception)>>handle
          > Error(Exception)>>signal
          > Error class(Exception class)>>signal: <'invalid branch label...'>
          > BasicProgram(Object)>>error: <'invalid branch label...'>
          > BasicProgram>>terminateRun: <anError>
          > [] in BasicProgram>>errorHandlerBlock
          > ExceptionHandler>>evaluateResponseBlock: <aBlockClosure> for: <anError>
          > [] in ExceptionHandler>>handle:
          > ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure>
          > BlockClosure>>invisibleEnsure: <aBlockClosure>
          > ExceptionHandler>>handle: <anError>
          > ExceptionHandler>>findHandler: <anError>
          > Error(Exception)>>activateHandler: <anExceptionHandler>
          > Error(Exception)>>handle
          > Error(Exception)>>signal
          > Error class(Exception class)>>signal: <'invalid branch label...'>
          > BasicProgram(Object)>>error: <'invalid branch label...'>
          > BasicProgram>>goto: <'[stopreps]'>
          > BasicProgram>>gotoAndIfStoppedBegin: <'[stopreps]'>
          > BasicProgram>>handlerName: <'[stopreps]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection>
          > Message>>perform
          > Message>>evaluate
          > BasicProgram>>scanEvent
          > [] in BasicProgram>>begin
          > ExceptionHandler>>evaluateProtectedBlock: <aBlockClosure>
          > [] in ExceptionHandler>>activateDuring:
          > ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure>
          > BlockClosure>>invisibleEnsure: <aBlockClosure>
          > ExceptionHandler>>activateDuring: <aBlockClosure>
          > ExceptionHandler class>>handle: <anError class> with: <aBlockClosure> during: <aBlockClosure>
          > BlockClosure>>on: <anError class> do: <aBlockClosure>
          > BasicProgram>>begin
          > BasicProgram>>gotoAndIfStoppedBegin: <'[start]'>
          > BasicProgram>>handlerName: <'[start]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection>
          > BasicProgram>>submitHandlerName: <'[start]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection>
          > BasicProgram>>submitHandlerName: <'[start]'> callParameters: <anOrderedCollection>
          > LibButton>>click
          > BasicWindow>>click: <aLibButton>
          > LibButton(Button)>>click: <aLibButton>
          > Message>>perform
          > Message>>evaluate
          > LibButton(Object)>>triggerEvent: <#clicked>
          > LibButton(Button)>>triggerClickedEvent
          > LibButton(Button)>>notifyClicked: <983830>
          > LibButton(Object)>>perform: <#notifyClicked:> with: <983830>
          > LibButton(ControlPane)>>asyncControlEvent: <0> with: <983830>
          > Message>>perform
          > NotificationManager>>empty
          >
          >
          >
          >
          >
          >
          >
          > ------------------------------------
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
        • Stefan Pendl
          ... NOTE: Branch labels inside functions and subroutines are not visible to code outside those functions and subroutines. Likewise, functions and subroutines
          Message 4 of 7 , Jun 18, 2013
          • 0 Attachment
            Am 12.06.2013 11:57, schrieb allen.minton@...:
            > I have written a program to control a laboratory pump, and it seems to work well with one exception. I am trying to interrupt a for-next loop controlling repeated pump delivery strokes with a button click. The loop contains a scan statement, and the labeled routine associated with the button click contains a wait statement. However, when I click this button the main window closes abruptly and I receive an error message stating that the label associated with the button click is an invalid branch, but I do not understand why. I am copying the relevant portion of the code and the error message below.
            >
            > Any help would be greatly appreciated.
            >

            In the help file section "Branch Labels, GOTO and GOSUB" is a note:

            >>
            NOTE: Branch labels inside functions and subroutines are not visible to
            code outside those functions and subroutines. Likewise, functions and
            subroutines cannot use branch labels defined outside their scope.
            <<

            Conclusion, whenever an application spends it time mostly inside of
            procedures (SUB or FUNCTION) use SUBs for the event handlers you need to
            invoke from there.


            --
            Stefan Pendl
            http://stefanpendl.runbasichosting.com/

            LB 4.04 Pro ... http://www.libertybasic.com/assist.html
            LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

            LB Community Wiki .............. http://basic.wikispaces.com/
            LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
            LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

            Books at http://www.lulu.com/ and http://www.amazon.com/
            Alyce Watson ... APIs for Liberty BASIC
            Carl Gundel .... Beginning Programming with Liberty BASIC

            Windows 7 Home Premium 64-bit SP1
            AMD Turion X2 RM-70 2GHz, 4GB RAM
          • Stefan Pendl
            ... I would not say that GOSUB results in a true subroutine, since it is highly dependent on the main code it is called from. For me true subroutines are
            Message 5 of 7 , Jun 18, 2013
            • 0 Attachment
              Am 18.06.2013 21:48, schrieb Robert Hendrix:
              > It would probably work if you used a gosub rather than a sub, which
              > actually calls a true subroutine.
              >

              I would not say that GOSUB results in a "true" subroutine, since it is
              highly dependent on the main code it is called from.

              For me "true" subroutines are independent from the main code and can be
              reused in many projects, so I would qualify a SUB as a "true" subroutine.

              But that might even be personal preference.


              --
              Stefan Pendl
              http://stefanpendl.runbasichosting.com/

              LB 4.04 Pro ... http://www.libertybasic.com/assist.html
              LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe

              LB Community Wiki .............. http://basic.wikispaces.com/
              LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
              LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/

              Books at http://www.lulu.com/ and http://www.amazon.com/
              Alyce Watson ... APIs for Liberty BASIC
              Carl Gundel .... Beginning Programming with Liberty BASIC

              Windows 7 Home Premium 64-bit SP1
              AMD Turion X2 RM-70 2GHz, 4GB RAM
            • Robert Hendrix
              I absolutely agree with you; I did not word my reply clearly. I was meaning that the SUB was the true subroutine, which caused the label outside the
              Message 6 of 7 , Jun 19, 2013
              • 0 Attachment
                I absolutely agree with you; I did not word my reply clearly. I was
                meaning that the SUB was the true subroutine, which caused the label
                outside the subroutine to not be visible from within the subroutine.
                The GOSUB is not a true subroutine, but it would keep the label
                associated with the button visible within the loop. In my other reply I
                mentioned that he could continue to use the SUB by using the button to
                cause a legal exit from the SUB.

                As I believe I have noticed often in the past, you have warned against
                mixing GOSUBs and SUBs. I have learned a great deal from your posts.

                Thank you.

                Robert Hendrix


                On 6/19/2013 12:12 AM, Stefan Pendl wrote:
                > Am 18.06.2013 21:48, schrieb Robert Hendrix:
                >> It would probably work if you used a gosub rather than a sub, which
                >> actually calls a true subroutine.
                >>
                > I would not say that GOSUB results in a "true" subroutine, since it is
                > highly dependent on the main code it is called from.
                >
                > For me "true" subroutines are independent from the main code and can be
                > reused in many projects, so I would qualify a SUB as a "true" subroutine.
                >
                > But that might even be personal preference.
                >
                >
                > --
                > Stefan Pendl
                > http://stefanpendl.runbasichosting.com/
                >
                > LB 4.04 Pro ... http://www.libertybasic.com/assist.html
                > LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe
                >
                > LB Community Wiki .............. http://basic.wikispaces.com/
                > LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
                > LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/
                >
                > Books at http://www.lulu.com/ and http://www.amazon.com/
                > Alyce Watson ... APIs for Liberty BASIC
                > Carl Gundel .... Beginning Programming with Liberty BASIC
                >
                > Windows 7 Home Premium 64-bit SP1
                > AMD Turion X2 RM-70 2GHz, 4GB RAM
                >
                >
                > ------------------------------------
                >
                > Yahoo! Groups Links
                >
                >
                >
                >
              • Robert Hendrix
                This is interesting. I submitted the following post on 6/19/2013, but it didn t appear at the time. I eventually forgot about it. Then it showed up in my
                Message 7 of 7 , Jul 18, 2013
                • 0 Attachment
                  This is interesting. I submitted the following post on 6/19/2013, but
                  it didn't appear at the time. I eventually forgot about it. Then it
                  showed up in my inbox this morning. I wonder where it has been for the
                  last month? I have had messages take a long time to arrive, but never
                  29 days. Well, it was only a side note, so it was not really important.


                  On 6/19/2013 11:01 PM, Robert Hendrix wrote:
                  > I absolutely agree with you; I did not word my reply clearly. I was
                  > meaning that the SUB was the true subroutine, which caused the label
                  > outside the subroutine to not be visible from within the subroutine.
                  > The GOSUB is not a true subroutine, but it would keep the label
                  > associated with the button visible within the loop. In my other reply I
                  > mentioned that he could continue to use the SUB by using the button to
                  > cause a legal exit from the SUB.
                  >
                  > As I believe I have noticed often in the past, you have warned against
                  > mixing GOSUBs and SUBs. I have learned a great deal from your posts.
                  >
                  > Thank you.
                  >
                  > Robert Hendrix
                  >
                  >
                  > On 6/19/2013 12:12 AM, Stefan Pendl wrote:
                  >> Am 18.06.2013 21:48, schrieb Robert Hendrix:
                  >>> It would probably work if you used a gosub rather than a sub, which
                  >>> actually calls a true subroutine.
                  >>>
                  >> I would not say that GOSUB results in a "true" subroutine, since it is
                  >> highly dependent on the main code it is called from.
                  >>
                  >> For me "true" subroutines are independent from the main code and can be
                  >> reused in many projects, so I would qualify a SUB as a "true" subroutine.
                  >>
                  >> But that might even be personal preference.
                  >>
                  >>
                  >> --
                  >> Stefan Pendl
                  >> http://stefanpendl.runbasichosting.com/
                  >>
                  >> LB 4.04 Pro ... http://www.libertybasic.com/assist.html
                  >> LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe
                  >>
                  >> LB Community Wiki .............. http://basic.wikispaces.com/
                  >> LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
                  >> LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/
                  >>
                  >> Books at http://www.lulu.com/ and http://www.amazon.com/
                  >> Alyce Watson ... APIs for Liberty BASIC
                  >> Carl Gundel .... Beginning Programming with Liberty BASIC
                  >>
                  >> Windows 7 Home Premium 64-bit SP1
                  >> AMD Turion X2 RM-70 2GHz, 4GB RAM
                  >>
                  >>
                  >> ------------------------------------
                  >>
                  >> Yahoo! Groups Links
                  >>
                  >>
                  >>
                  >>
                  >
                  >
                  > ------------------------------------
                  >
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                Your message has been successfully submitted and would be delivered to recipients shortly.