Normal Topic Go To Command Button (Read 878 times)
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Go To Command Button
May 1st, 2005 at 9:33pm
Print Post Print Post  
[color=Black][/color]Does "Goto" work to take you to a command button?  I am using the following code:

Code
Select All
var Z as int


if not @update then
{
z = @asynchshell("C:\Program Files\Sesame\Data\Sounds\Cannot Use Here.wav")

STOP

}


else


if status = "deceased"
{
z = @asynchshell("C:\Program Files\Sesame\Data\Sounds\Deceased.wav")

STOP

}


else


if record type = "companion"
and @isblank(Mail Name)
then
{
z = @asynchshell("C:\Program Files\Sesame\Data\Sounds\Companion.wav")
Goto Alt Record

STOP

}
else

AlternateDefaultPrinter("Auto HP LaserJet 5 - Envelopes")

Newpage(950,412)
PrintString("Spencer Wulwick (MVR)", 30, 25, 0, "Arial", 14, 0)
PrintString("210 South Hale Avenue", 30, @PageExtentY(), 0, "Arial", 14, 0)
PrintString("Tampa, FL 33609-3933", 30, @PageExtentY(), 0, "Arial", 14, 0)

PrintString(Mail Name, 450, 200, 0, "BArial", 16, 0)
PrintString(Street Address + " " + Apt, 450, @PageExtentY(), 0, "BArial", 16, 0)
PrintString(City + ", " + State + "  " + Zip, 450, @PageExtentY(), 0, "BArial", 16, 0)

FinishPage()

RestoreDefaultPrinter()

 



The Alt Record has on entry programming on a Command Button that would take me to another specific record.

When on a record that should execute the "Goto", nothing happens.  The focus remains on the current record.

This is the area of the above text, where the Goto should be executed:

Code
Select All
if record type = "companion"
and @isblank(Mail Name)
then
{
z = @asynchshell("C:\Program Files\Sesame\Data\Sounds\Companion.wav")
Goto Alt Record 


  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Go To Command Button
Reply #1 - May 1st, 2005 at 11:43pm
Print Post Print Post  
Have you tried ThrowFocus(Alt Record) vs. GoTo?

If you throw focus to a command button, it would likely execute right away if your button programming is in OnEntry section.  Are you sure you want that to happen? 
If ThrowFocus cannot go to a button, then make the button programming a sub routine in Global Code section and have this programming and the button call the same subroutine.
----------------------------------

Note:  I see in your PrintString commands, some fonts without the leading space, like "Arial" vs. " Arial".  Although it may work, it has been recommended that the blank space should be there if not using Bold or Italic.  See May issue of Inside Sesame and great Print String information from Alec.
----------------------
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Go To Command Button
Reply #2 - May 2nd, 2005 at 12:37am
Print Post Print Post  
Bob -

My understanding of ThrowFocus (as compared to Goto) is that Throw Focus allows the remainder of the programming (in the element you are in) to be processed FIRST (which I do NOT want).  Nevertheless, I DID try the ThrowFocus and it makes no difference.  The same form remains in place.  (With regard to the use of "ThrowFocus" I thought that perhaps the "STOP" command (since the programming in the element is executed first) to halt the action and negate the ThrowFocus command.

When I "played" with it by removing the STOP, an envelope was printed from the record I was in ... which I do NOT want.

Yes, I DO want the programming in the Command Button to be executed right away.

As for the PrintString command, I do recall a conversation about needing either a font descriptor (such as B or I) ... or a space ... before the font and I will probably change it for "consistency" regarding accuracy of programming.  HOWEVER, that has never been a problem.  The envelope is (when appropriate) being printed exactly as I want it.

I hate to "mix threads" but am wondering if you saw my last post under printing multiple envelopes.  If so, and you can help, I would appreciate your responding to that post (keeping this one focused on my current problem).  I simply cannot get one envelope to print ... nor do I know how to execute Mass Update programming and no-one has responded in several days.

Thanks!



  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Go To Command Button
Reply #3 - May 2nd, 2005 at 11:47am
Print Post Print Post  
Simply arriving at a command button does not run its programming. You have to click on it. Otherwise, command button programming would run simply by the button being tabbed through.

If you want to call the same programming, rather than using navigation to do so, make it into a function or subroutine and call it.

BTW: GOTO, GOSUB, RETURN, and STOP are supported only for Q&A compatibility. They are no longer needed and are strongly deprecated. Use ThrowFocus in place of GOTO. If you don't want following code to run, use conditionals like If to prevent it rather than dropping a  GOTO before it.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged