Yes! The otherwise statement was getting executed all along and I just ignored it because I was getting the behavior I wanted. When that button was clicked the select statement was executed, the other buttons on preceding when statements were ignored,
the when statement executed the method (but not because it was selected) and the otherwise statement just issued a statement. When I added a couple methods to the do block after the PbtRevertToZeros I realized they were not getting executed. When I changed
the name of the button to something different than the name of the method, I got the results I expect (and in the fashion I intended).
method actionPerformed(evt=ActionEvent)
if Debug_Level > 3 then trace results
select
when evt.getSource().equals(PbtRevertToZeros) then do
ResetAllScores()
DisplayScore(DaScore)
ShowNextCard(Rand1)
end
when evt.getSource().equals(advanceThruDeck) then do
ShowNextCard(Rand1)
end
when evt.getSource().equals(SaveExit) then do
SaveScoreLine(DaScore)
SaveTheRightWrongStatus()
GuiClose()
end
when evt.getSource().equals(Submit_Check) then do
Submit_Check(A_answer)
end
otherwise say "This should not have happened, darn." -- we don't expect anything else
catch e3=IOException
say 'Exception caught:' e3 '\n ' e3.getMessage()
end
I suspect my Submit_Check button/method is not working llike I thought it was…
-----Original Message-----
From: [hidden email] [[hidden email]] On Behalf Of Kermit Kiser Sent: Thursday, February 21, 2013 5:50 PM To: IBM Netrexx Subject: Re: [Ibm-netrexx] this make no sense In the absence of option "strictargs", PbtRevertToZeros is equivalent to PbtRevertToZeros(). Hence the line:
"when evt.getSource().equals(PbtRevertToZeros) then do"
is calling method PbtRevertToZeros which returns a "4" which is unlikely to equal evt.getSource(), so the otherwise clause will be executed in that case.
-- Kermit
On 2/21/2013 9:37 AM, Kenneth Klein (TEMA TPC) wrote:
> This program was working and then I made a few _small_ enhancements. The trace shows the select block getting executed, the PbtRevertToZeros when-clause getting selected and then the first method in that do-block is executed but then it directly falls
thru to the otherwise statement. WTF?
>
> method actionPerformed(evt=ActionEvent) -- signals IOException
> if Debug_Level > 3 then trace results
> select
> when evt.getSource().equals(advanceThruDeck) then do
> ShowNextCard(Rand1)
> end
> when evt.getSource() == SaveExit then do
> SaveScoreLine(DaScore)
> SaveTheRightWrongStatus()
> catch e=RuntimeException
> say 'I/O Exception.' e.getMessage()
> GuiClose()
> end
> when evt.getSource().equals(Submit_Check) then do
> Submit_Check(A_answer)
> end
> when evt.getSource().equals(PbtRevertToZeros) then do
> PbtRevertToZeros()
> if Debug_Level > 10 then trace results
> reset()
> DisplayScore(DaScore)
> ShowNextCard(Rand1)
> end
> otherwise say "This should not have happened, darn." -- we don't expect anything else
> catch e3=IOException
> say 'Exception caught:' e3 '\n ' e3.getMessage()
> -- catch e4 = NullPointerException
> -- say 'Exception caught:' e4 '\n ' e4.getMessage()
> -- finally say "Caught something." -- awkward when exception is not thrown
> End
>
> 590 *=* method actionPerformed(evt=ActionEvent) -- signals IOException
> >a> evt "java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=Reset,when=1361472751949,modifiers=Button1] on javax.swing.JButton[,421,183,359x34,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@c7833c,flags=424,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Reset
all scores,defaultCapable=true]"
> 592 *=* select
> 593 *=* when evt.getSource().equals(advanceThruDeck)
> >>> "javax.swing.JButton[,4,183,409x34,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@c7833c,flags=424,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Display
the next card.,defaultCapable=true]"
> >>> "0"
> 596 *=* when evt.getSource() == SaveExit
> >>> "0"
> 603 *=* when evt.getSource().equals(Submit_Check)
> >>> "javax.swing.JButton[,4,139,409x34,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@c7833c,flags=424,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Submit
and check your answer now.,defaultCapable=true]"
> >>> "0"
> 606 *=* when evt.getSource().equals(PbtRevertToZeros)
> 700 *=* method PbtRevertToZeros -- SIGNALS RuntimeException
> 702 *=* rightAnswers = 0
> >p> rightAnswers "0"
> 703 *=* wrongAnswers = 0
> >p> wrongAnswers "0"
> 704 *=* pb.setValue(0) -- increment the progress bar value
> >>> "0"
> 705 *=* pb2.setValue(0) -- increment the progress bar value
> >>> "0"
> 706 *=* totalMinutes = 0
> >p> totalMinutes "0"
> 707 *=* if Debug_Level < 60
> >>> "1"
> *=* then
> *=* trace off
> >>> "4"
> >>> "0"
> 613 *=* otherwise
> *=* say "This should not have happened, darn." -- we don't expect anything else
> >>> "This should not have happened, darn."
> This should not have happened, darn.
> 619 *=* end
>
> And this is the mehod that you can see actually get executed in the when-do-clause:
>
> method PbtRevertToZeros -- SIGNALS RuntimeException
> if Debug_Level > 10 then trace results
> rightAnswers = 0
> wrongAnswers = 0
> pb.setValue(0) -- increment the progress bar value
> pb2.setValue(0) -- increment the progress bar value
> totalMinutes = 0
> if Debug_Level < 60 then trace off
> loop label writeAns_doneTable qNumber = 1 to totalQCount
> myCard[qNumber,3] = 0
> myCard[qNumber,4] = 0
> end writeAns_DoneTable
> totalMinutes=0
> return 4
>
> _______________________________________________
> Ibm-netrexx mailing list
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>
>
_______________________________________________
Ibm-netrexx mailing list
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
After patting myself on the back for having learned so much about netrexx and java over the last year or two and bam, reality hit me again. I added strictargs to my options line and suddenly: I guess I still have a lot to learn. So these methods are not getting the “type” they expect? But before strictargs they didn’t care? And the program was working?
From: [hidden email] [mailto:[hidden email]]
On Behalf Of Kenneth Klein (TEMA TPC) Yes! The otherwise statement was getting executed all along and I just ignored it because I was getting the behavior I wanted. When that button was clicked the select statement
was executed, the other buttons on preceding when statements were ignored, the when statement executed the method (but not because it was selected) and the otherwise statement just issued a statement. When I added a couple methods to the do block after the
PbtRevertToZeros I realized they were not getting executed. When I changed the name of the button to something different than the name of the method, I got the results I expect (and in the fashion I intended). method actionPerformed(evt=ActionEvent)
if Debug_Level > 3 then trace results select when evt.getSource().equals(PbtRevertToZeros) then do ResetAllScores() DisplayScore(DaScore) ShowNextCard(Rand1) end when evt.getSource().equals(advanceThruDeck) then do ShowNextCard(Rand1) end when evt.getSource().equals(SaveExit) then do SaveScoreLine(DaScore) SaveTheRightWrongStatus() GuiClose() end when evt.getSource().equals(Submit_Check) then do Submit_Check(A_answer) end otherwise say "This should not have happened, darn." -- we don't expect anything else catch e3=IOException say 'Exception caught:' e3 '\n ' e3.getMessage() end I suspect my Submit_Check button/method is not working llike I thought it was… -----Original Message----- In the absence of option "strictargs", PbtRevertToZeros is equivalent to PbtRevertToZeros(). Hence the line: "when evt.getSource().equals(PbtRevertToZeros) then do" is calling method PbtRevertToZeros which returns a "4" which is unlikely to equal evt.getSource(), so the otherwise clause will be executed in that case. -- Kermit On 2/21/2013 9:37 AM, Kenneth Klein (TEMA TPC) wrote: > This program was working and then I made a few _small_ enhancements. The trace shows the select block getting executed, the PbtRevertToZeros when-clause getting selected
and then the first method in that do-block is executed but then it directly falls thru to the otherwise statement. WTF? > > method actionPerformed(evt=ActionEvent) -- signals IOException > if Debug_Level > 3 then trace results > select > when evt.getSource().equals(advanceThruDeck) then do > ShowNextCard(Rand1) > end > when evt.getSource() == SaveExit then do > SaveScoreLine(DaScore) > SaveTheRightWrongStatus() > catch e=RuntimeException > say 'I/O Exception.' e.getMessage() > GuiClose() > end > when evt.getSource().equals(Submit_Check) then do > Submit_Check(A_answer) > end > when evt.getSource().equals(PbtRevertToZeros) then do > PbtRevertToZeros() > if Debug_Level > 10 then trace results > reset() > DisplayScore(DaScore) > ShowNextCard(Rand1) > end > otherwise say "This should not have happened, darn." -- we don't expect anything else > catch e3=IOException > say 'Exception caught:' e3 '\n ' e3.getMessage() > -- catch e4 = NullPointerException > -- say 'Exception caught:' e4 '\n ' e4.getMessage() > -- finally say "Caught something." -- awkward when exception is not thrown > End > > 590 *=* method actionPerformed(evt=ActionEvent) -- signals IOException > >a> evt "java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=Reset,when=1361472751949,modifiers=Button1] on javax.swing.JButton[,421,183,359x34,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@c7833c,flags=424,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Reset
all scores,defaultCapable=true]" > 592 *=* select > 593 *=* when evt.getSource().equals(advanceThruDeck) > >>> "javax.swing.JButton[,4,183,409x34,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@c7833c,flags=424,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Display
the next card.,defaultCapable=true]" > >>> "0" > 596 *=* when evt.getSource() == SaveExit > >>> "0" > 603 *=* when evt.getSource().equals(Submit_Check) > >>> "javax.swing.JButton[,4,139,409x34,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@c7833c,flags=424,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Submit
and check your answer now.,defaultCapable=true]" > >>> "0" > 606 *=* when evt.getSource().equals(PbtRevertToZeros) > 700 *=* method PbtRevertToZeros -- SIGNALS RuntimeException > 702 *=* rightAnswers = 0 > >p> rightAnswers "0" > 703 *=* wrongAnswers = 0 > >p> wrongAnswers "0" > 704 *=* pb.setValue(0) -- increment the progress bar value > >>> "0" > 705 *=* pb2.setValue(0) -- increment the progress bar value > >>> "0" > 706 *=* totalMinutes = 0 > >p> totalMinutes "0" > 707 *=* if Debug_Level < 60 > >>> "1" > *=* then > *=* trace off > >>> "4" > >>> "0" > 613 *=* otherwise > *=* say "This should not have happened, darn." -- we don't expect anything else > >>> "This should not have happened, darn." > This should not have happened, darn. > 619 *=* end > > And this is the mehod that you can see actually get executed in the when-do-clause: > > method PbtRevertToZeros -- SIGNALS RuntimeException > if Debug_Level > 10 then trace results > rightAnswers = 0 > wrongAnswers = 0 > pb.setValue(0) -- increment the progress bar value > pb2.setValue(0) -- increment the progress bar value > totalMinutes = 0 > if Debug_Level < 60 then trace off > loop label writeAns_doneTable qNumber = 1 to totalQCount > myCard[qNumber,3] = 0 > myCard[qNumber,4] = 0 > end writeAns_DoneTable > totalMinutes=0 > return 4 > > _______________________________________________ > Ibm-netrexx mailing list > Online Archive :
http://ibm-netrexx.215625.n3.nabble.com/ > > > _______________________________________________ Ibm-netrexx mailing list Online Archive :
http://ibm-netrexx.215625.n3.nabble.com/ _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Ha. I got it. With strictargs the methods all look like properties if you omit the (). From: [hidden email] [mailto:[hidden email]]
On Behalf Of Kenneth Klein (TEMA TPC) After patting myself on the back for having learned so much about netrexx and java over the last year or two and bam, reality hit me again. I added strictargs to my options line and suddenly: I guess I still have a lot to learn. So these methods are not getting the “type” they expect? But before strictargs they didn’t care? And the program was working?
From:
[hidden email] [[hidden email]]
On Behalf Of Kenneth Klein (TEMA TPC) Yes! The otherwise statement was getting executed all along and I just ignored it because I was getting the behavior I wanted. When that button was clicked the select statement
was executed, the other buttons on preceding when statements were ignored, the when statement executed the method (but not because it was selected) and the otherwise statement just issued a statement. When I added a couple methods to the do block after the
PbtRevertToZeros I realized they were not getting executed. When I changed the name of the button to something different than the name of the method, I got the results I expect (and in the fashion I intended). method actionPerformed(evt=ActionEvent)
if Debug_Level > 3 then trace results select when evt.getSource().equals(PbtRevertToZeros) then do ResetAllScores() DisplayScore(DaScore) ShowNextCard(Rand1) end when evt.getSource().equals(advanceThruDeck) then do ShowNextCard(Rand1) end when evt.getSource().equals(SaveExit) then do SaveScoreLine(DaScore) SaveTheRightWrongStatus() GuiClose() end when evt.getSource().equals(Submit_Check) then do Submit_Check(A_answer) end otherwise say "This should not have happened, darn." -- we don't expect anything else catch e3=IOException say 'Exception caught:' e3 '\n ' e3.getMessage() end I suspect my Submit_Check button/method is not working llike I thought it was… -----Original Message----- In the absence of option "strictargs", PbtRevertToZeros is equivalent to PbtRevertToZeros(). Hence the line: "when evt.getSource().equals(PbtRevertToZeros) then do" is calling method PbtRevertToZeros which returns a "4" which is unlikely to equal evt.getSource(), so the otherwise clause will be executed in that case. -- Kermit On 2/21/2013 9:37 AM, Kenneth Klein (TEMA TPC) wrote: > This program was working and then I made a few _small_ enhancements. The trace shows the select block getting executed, the PbtRevertToZeros when-clause getting selected
and then the first method in that do-block is executed but then it directly falls thru to the otherwise statement. WTF? > > method actionPerformed(evt=ActionEvent) -- signals IOException > if Debug_Level > 3 then trace results > select > when evt.getSource().equals(advanceThruDeck) then do > ShowNextCard(Rand1) > end > when evt.getSource() == SaveExit then do > SaveScoreLine(DaScore) > SaveTheRightWrongStatus() > catch e=RuntimeException > say 'I/O Exception.' e.getMessage() > GuiClose() > end > when evt.getSource().equals(Submit_Check) then do > Submit_Check(A_answer) > end > when evt.getSource().equals(PbtRevertToZeros) then do > PbtRevertToZeros() > if Debug_Level > 10 then trace results > reset() > DisplayScore(DaScore) > ShowNextCard(Rand1) > end > otherwise say "This should not have happened, darn." -- we don't expect anything else > catch e3=IOException > say 'Exception caught:' e3 '\n ' e3.getMessage() > -- catch e4 = NullPointerException > -- say 'Exception caught:' e4 '\n ' e4.getMessage() > -- finally say "Caught something." -- awkward when exception is not thrown > End > > 590 *=* method actionPerformed(evt=ActionEvent) -- signals IOException > >a> evt "java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=Reset,when=1361472751949,modifiers=Button1] on javax.swing.JButton[,421,183,359x34,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@c7833c,flags=424,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Reset
all scores,defaultCapable=true]" > 592 *=* select > 593 *=* when evt.getSource().equals(advanceThruDeck) > >>> "javax.swing.JButton[,4,183,409x34,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@c7833c,flags=424,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Display
the next card.,defaultCapable=true]" > >>> "0" > 596 *=* when evt.getSource() == SaveExit > >>> "0" > 603 *=* when evt.getSource().equals(Submit_Check) > >>> "javax.swing.JButton[,4,139,409x34,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@c7833c,flags=424,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Submit
and check your answer now.,defaultCapable=true]" > >>> "0" > 606 *=* when evt.getSource().equals(PbtRevertToZeros) > 700 *=* method PbtRevertToZeros -- SIGNALS RuntimeException > 702 *=* rightAnswers = 0 > >p> rightAnswers "0" > 703 *=* wrongAnswers = 0 > >p> wrongAnswers "0" > 704 *=* pb.setValue(0) -- increment the progress bar value > >>> "0" > 705 *=* pb2.setValue(0) -- increment the progress bar value > >>> "0" > 706 *=* totalMinutes = 0 > >p> totalMinutes "0" > 707 *=* if Debug_Level < 60 > >>> "1" > *=* then > *=* trace off > >>> "4" > >>> "0" > 613 *=* otherwise > *=* say "This should not have happened, darn." -- we don't expect anything else > >>> "This should not have happened, darn." > This should not have happened, darn. > 619 *=* end > > And this is the mehod that you can see actually get executed in the when-do-clause: > > method PbtRevertToZeros -- SIGNALS RuntimeException > if Debug_Level > 10 then trace results > rightAnswers = 0 > wrongAnswers = 0 > pb.setValue(0) -- increment the progress bar value > pb2.setValue(0) -- increment the progress bar value > totalMinutes = 0 > if Debug_Level < 60 then trace off > loop label writeAns_doneTable qNumber = 1 to totalQCount > myCard[qNumber,3] = 0 > myCard[qNumber,4] = 0 > end writeAns_DoneTable > totalMinutes=0 > return 4 > > _______________________________________________ > Ibm-netrexx mailing list > Online Archive :
http://ibm-netrexx.215625.n3.nabble.com/ > > > _______________________________________________ Ibm-netrexx mailing list Online Archive :
http://ibm-netrexx.215625.n3.nabble.com/ _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Free forum by Nabble | Edit this page |