Page 1 of 1

SPECIAL>ALIASSCREEN command

Posted: Thu Aug 14, 2003 9:46 pm
by mashayekhi
In a sable application that I am developing, I want to move back and forth form different screens to one single specific screen. Is there any way to set up a return button on that single screen that by clicking on it, the system will return to the previous screen no matter which screen was the previous one?

In Venapp yo can do it by using SPECIAL>ALIASSCREEN command. But this command is not available form within sable. I appreciate any hint.

[Edited on 14-8-2003 by mashayekhi]

Posted: Fri Aug 15, 2003 11:04 am
by Lee Jones
In Sable, you will need to use SableScript.

1. First, open the text editor by selecting View > View Text Editor from the main menu in Sable.

2. Next enter the script code given below.

3. Save the file as ExtProg.vts in the SCRIPTS sub directory of the project.

4. Reopen the project to allow Sable to read in the script code. If you modify the code, you will need to reopen the project in order for Sable to update to the new code.

Here is the code:
-----------------------------------------------------
global sourcescreenid as integer


sub movetoscreen(byval sourcescreen as string)
// This routine will check to see which screen the user is clicking in from, and set
// a value for "sourcescreenid" unique to that screen
// "sourcescreen" is a piece of text past to this routine from the Sable button command set in the project.

if (sourcescreen = "TestScreen1")

sourcescreenid=1

end if

if (sourcescreen = "TestScreen2")

sourcescreenid=2

end if

// Finally, execute the move to the intended screen (the one that many screens can click into, but
// you want a single return button to return to the source screen)

call MoveToMainScreen("Intro.vnn")

end sub

sub returntoscreen()
// This routine interogates the global variable "sourcescreenid" and moves the user to the desired source
// screen.

dim nextscreen as string

if (sourcescreenid = 1)
nextscreen = "Test Screen 1.vnn"
end if

if (sourcescreenid = 2)
nextscreen = "Test Screen 2.vnn"
end if

call MoveToMainScreen(nextscreen)

end sub
-----------------------------------------------------

In sable, for the button to click to the common screen, use the XCommand "Execute Script" (eg. in my example, the command is Execute Script:SableScript.movetoscreen(TestScreen1)) making sure you enter the correct unique arguement for the source screen.

In Sable, for the return button, use the XCommand "Execute Script" (in my example; Execute Script:SableScript.returntoscreen()) Note there are no arguements to this routine.

I hope this is clear.

Lee

Posted: Tue Aug 19, 2003 1:38 am
by mashayekhi
Lee,

It seems that Sable does not create a SCRIPT folder in the project. There is no such a folder in the sample project that you have supplied with the software.

Should we produce that folder ourself?

Posted: Tue Aug 19, 2003 7:34 am
by Lee Jones
It sounds as if you are using a slightly older version of Sable than the latest release.

In these older versions, you will need to create the extprog.vst file yourself (simply a text file) in the root directory for the project (ie. where the VNP file is). Sable will automatically read this file.

SPECIAL»ALIASSCREEN

Posted: Wed Aug 20, 2003 6:40 am
by mashayekhi
Lee,

I installed the new version of Sable and I have the SCRIPTS folder in my project. Then I followed your instruction and created the following screen to be able to go to the "ANALYSIS" screen from four screens and come back to the them. But I still have a problem as I describe bellow.

global sourcescreenid as integer


sub movetoscreen(byval sourcescreen as string)
// This routine will check to see which screen the user is clicking in from, and set
// a value for "sourcescreenid" unique to that screen
// "sourcescreen" is a piece of text past to this routine from the Sable button command set in the project.

if (sourcescreen = "Simulate LT ST BF CT R and measurement")

sourcescreenid=1

end if

if (sourcescreen = "Simulate LT ST BF CT R and measurement 3 years")

sourcescreenid=2

end if
if (sourcescreen = "Simulate LT ST BF CT R and measurement 30 days")

sourcescreenid=3

end if

if (sourcescreen = "Simulate LT ST BF CT R M and Vision")

sourcescreenid=4

end if

// Finally, execute the move to the intended screen (the one that many screens can click into, but
// you want a single return button to return to the source screen)

call MoveToMainScreen("ANALYSIS.VNN")

end sub

sub returntoscreen()
// This routine interogates the global variable "sourcescreenid" and moves the user to the desired source
// screen.

dim nextscreen as string

if (sourcescreenid = 1)
nextscreen = "Simulate LT ST BF CT R and measurement.vnn"
end if

if (sourcescreenid = 2)
nextscreen = "Simulate LT ST BF CT R and measurement 3 years.vnn"
end if

if (sourcescreenid = 3)
nextscreen = "Simulate LT ST BF CT R and measurement 30 days.vnn"
end if

if (sourcescreenid = 4)
nextscreen = "Simulate LT ST BF CT R M and Vision.vnn"
end if

call MoveToMainScreen(nextscreen)

end sub


I tried to test the program by setting up a button in "Simulate LT ST BF CT R and measurement" screen. In the button I used these different forms of command. :

XCommnad  Execute Script:ExtProg.movetoscreen("Simulate LT ST BF CT R and measurement")

XCommnad  Execute Script:SableScript.movetoscreen("Simulate LT ST BF CT R and measurement")

XCommnad  Execute Script:movetoscreen("Simulate LT ST BF CT R and measurement")

XCommnad  Execute Script: SableScript.ExtProg.movetoscreen("Simulate LT ST BF CT R and measurement")


None of them moved us to the "ANALYSIS" screen that we intended to go.

Please let me know what is wrong with what I am doing.

Thanks,
Ali

[Edited on 20-8-2003 by mashayekhi]

Posted: Wed Aug 20, 2003 7:20 am
by Lee Jones
Hi Ali,

try entering the command arguement without the leading and trailing ("), this should work.

Lee

Posted: Wed Aug 20, 2003 7:58 am
by mashayekhi
Which one of the four commands that I mentioned in my email I should use without (")?

Posted: Wed Aug 20, 2003 8:12 am
by mashayekhi
I tried all four without (") but none worked. Can you please send me an example of the Xcommand that has worked?

Thanks
Ali:(

Posted: Wed Aug 20, 2003 8:32 am
by Administrator
Hello Ali,

Are you manually typing in the following commands?

XCommnad  Execute Script:ExtProg.movetoscreen("Simulate LT ST BF CT R and measurement")
XCommnad  Execute Script:SableScript.movetoscreen("Simulate LT ST BF CT R and measurement")
XCommnad  Execute Script:movetoscreen("Simulate LT ST BF CT R and measurement")
XCommnad  Execute Script: SableScript.ExtProg.movetoscreen("Simulate LT ST BF CT R and measurement")

If you have the script file loaded correctly, you should have a combo box where you can select the correct function. Are you getting these?

Tony.

typo

Posted: Wed Aug 20, 2003 8:43 am
by Wilson
is the problem just a typo, in the commands you listed, you had

"XCommnad " rather than XCommand"

Posted: Wed Aug 20, 2003 8:45 am
by mashayekhi
Lee,
I do not get the combo box. I have created the script file and saved it as ExtProg.vst in the SCRIPTS folder of the project. But after choosing the Xcommand and "Execute script" no combo box appears. May be th eproblem is ther. How can load my script correctly. I went to the work space and saw the file in the SCRIPTS folder. I right clicked on SCRIPT folder nothing came up to let me load the file if it is not loaded before.

Posted: Wed Aug 20, 2003 8:51 am
by mashayekhi
the commands tony referred to were typed, but only "Xcommand" was chosen, not typed. and the spelling was correct.

Posted: Wed Aug 20, 2003 8:59 am
by Administrator
When you select XCommand, you should also be able to select the correct function to call.

Can you e-mail me the screen you are using? I should be able to work out what is going wrong.

Tony.

Posted: Wed Aug 20, 2003 9:01 am
by Lee Jones
Originally posted by mashayekhi
I tried all four without (") but none worked. Can you please send me an example of the Xcommand that has worked?

Thanks
Ali:(
Ali,

the xcommand I sent in the original post works as I had to create it to test it.

Execute Script:SableScript.movetoscreen("TestScreen1")

The above is the exact command I have used today, testing the presence of the "" (which still works).

When you add an XCommand to a button, double-click on the right-hand-side (under "Commands") and a navigation button will appear to the far right. Click on this and you will get another dialog with a drop-down box (as mentioned by Tony). From here, select EXECUTE SCRIPT and click on the navigation button to the right of this command. This will give you the SCRIPT COMMAND dialog from which you can select the desired script to run.

Remember that if you change the script, you will need to reopen the project in order for Sable to reopen the script file.

Lee

[Edited on 20-8-2003 by Lee Jones]

Posted: Wed Aug 20, 2003 9:20 am
by mashayekhi
I do all that. The problem is that in the final step, in front of the "script function" I get a gray combo box. It seems to me that for some reason, the script file is not loaded correctly. I sent attached th script file to Tony. I will sen it to you too.

Posted: Wed Aug 20, 2003 9:45 am
by Lee Jones
Ali,

from what you have sent me, the error seems to be in the use of the suffix VTS for the extprog file, instead of the correct VST

Lee

PS I have just noticed that it was MY typing error in the first place, so many apologies!

[Edited on 20-8-2003 by Lee Jones]