Thanks Jack,
On Aug 7, 2006, at 10:42 PM, CV wrote:
On Aug 7, 2006, at 8:59 PM, Robert Poland wrote:
Hi,
RB 5.5.4. Forgive me but I feel the need for a goto statement.
Rb has a GoTo but it's need and use is rare. Rb has more powerful
and reliable programming structures.
I have a calculate, Clear and a Send pushbuttonn. I want to have a
gosub at the start of the send routine
There is no keyword GoSub in Rb. You can put your code directily in
the Action event of the pushbutton, or you can add a method to your
window or in a module and call the method by name from the button.
If you add a method, say MyMethod, to your window then you can call
it from the button_Action event like this: MyMethod (or
self.MyMethod). That would be equivalent to a GoSub in other
languages.
and a goto at the end of the clear routine to be sure that
calculate has been done. One work around would be to trap this
with an error message box but that seems like the hard way.
I don't understand your intent, but it doesn't sound like a place
for either GoTo or error trapping. Perhaps you could explain
further your objective.
Workaround isn't necessary now that I understand the RB use of Gosub.
After a lot of looking I have added to the end of the "Clear"
routine the command "goto calculatecode".
Why?
After I clear all entries I would like to update totals to 0.0.
And at the start of the "Send routine" I have added the line gosub
calculatecode. And at the start of the Calculate routine I have
added the line "calculatecode: // label to jump to".
Now when I run the formally working program I get the error
"Internal compiler error in window1.Clear_Button: Dim Me As
Pushbutton".
Trying gosub in place of goto gets the error "This method or
property does not exist".
I've looked all over the web and my book "REALbasic Cross Platform
Application Development". Obviously I'm missing something here.
Well, eliminate the GoSub by adding your code directly in Action
(or add a method to your window and call it). Then post a more
descriptive explanation of what you expect the GoTo to do, so that
some alternatives can be discussed.
Best
Jack
Robert Poland
[EMAIL PROTECTED]
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>