HowTo: Use a Runtime Revolution Window interface with the Linux Shell -- Part 1
Novell Cool Solutions: Feature
Digg This -
Posted: 8 Oct 2004
|Learning to use Linux at Home and Work
Welcome to my ongoing series of HowTo articles designed to help Linux newbies get comfortable with Linux. Before trying any of these HowTos, take a few minutes to study the prerequisites so you can hit the ground running.
Aims and Purposes
In the previous HowTo we wrote two simple shell scripts, one to facilitate the saving of humourous poems into a text file, and one to show a number selected poem on a terminal window.
The functional aim of this two-part HowTo is to build on the previous article and create a window interface to let us write and save the poem in the first part, and to let us select and show the poem in the second part..
We are going to use Runtime Revolution to build our windows. Runtime Revolution is an end-user program which provides an easy scripting language called Transcript to make things happen.
When you have created your windows you can build them into a runtime application. You can get evaluation copies of Runtime Revolution from www.runrev.com
There are two pertinent offerings. One has a 10-hour limit and the other a 30-day limit. They both work the same, but the licensing for the built application is different as reflected in the pricing.
Choose the strategy that best suits your purpose, although you will be able to use the evaluation to achieve the aims of this HowTo.
The RunRev help is excellent, with terms definitions, scripting examples, a tutorial and plenty of online help pages.
We are also going to use the shell. RunRev can talk to the shell which is a huge bonus for Linux users. Simple shell scripts and simple RunRev scripts combine to give ordinary users the ability to create powerful applications which are normally the exclusive domain of power programmers.
Your RunRev Program
Setting up a shortcut
After you have downloaded, installed RunRev, and put in the unlock key, it will install in the /opt directory. You can create a shortcut on your desktop by right clicking your mouse, selecting “create launcher” in GNOME or “Create new – file – link to application” in KDE, fill in a name eg RunRev, and select “/opt/Revolution_Dir/revolution” as the command or program.
You can find a suitable icon in /opt/Revolution_Dir/Made_With_Logos/Graphics ie a .png file.
Using RunRev is a matter of creating windows or cards as they are known in RunRev, stretching them to the size you want, filling them with fields for texts or pictures, buttons for actions, and other special inserts.
Controls are typed into simple action scripts. Various things can be controlled such as what happens when you start or stop a program, when you open a card for viewing, when you press a button or click on a field, or when a timer is finished or another event has occurred.
The colours, themes, placement, sizes, activities and visibility of things on your cards can also be changed, all by simple, easy to understand commands and actions.
Starting a new program
My version of RunRev is 1.1. Yours will have the latest interface, but the functions I use are the same, so don't be put off by my interface pictures. Actually your version has an even better help interface.
Start RunRev clicking your new short cut icon. Put the RunRev windows in convenient places. Open the application overview window. You will find this in the Tools menu. Left click on the NEW icon at the left of the main menu bar.
This will open a new window as shown above.
Right click on the window and select and left-click Stack Properties.
The Properties pop up will open, with the Basic Tab highlighted.
Enter the Name and Label as shown.
This gives our RunRev window stack a name and a label.
The next activity is to open up the overview window so we can watch the changes to our work.
You can see the left pointing triangle on the overview window. Clicking this will expand this window to the right.
By left-clicking each + box, more information is shown about our cards.
Next we need to modify our card properties. We once again right-click on the POEMS window and this time select and left-click on Card Properties.
Change the card name to ENTRY. If you now click elsewhere on this pop up you will see the name change reflected in the Overview window.
Next we are going to use the tool box to put a scrolling field, ie text area, on our card where we can type in new poems.
As you hover over each icon on the tool box, a help message will tell you what each icon is for.
Left clicking an icon makes RunRev change an open properties popup to the selected activity and waits for you to click or draw on the current card.
Select the Scrolling Field icon.
Draw the field as shown.
Change the name of this field to Poem.
Now select the right hand Tab on the properties pop up. We are going to put horizontal lines in our poem field to make it easier to enter text.
Highlight the Horizontal Line button as shown and you will see that your field becomes full of lines.
The default window size is a bit small for viewing our input so now we shall use the mouse to change it to something larger.
Hold the mouse over the bottom right corner of the window until the pointer changes into a double-ended diagonal arrow. Hold down the left button and drag diagonally to the right until the window is large enough as shown.
In the same fashion grab the bottom right of the poem field, stretching it to leave a gap at the bottom for some buttons.
This picture also shows how to increase the text size of the current object: ie., the one with the square dots around it.
Select Text, then size from the drop-down menu. Select 18 from the size menu.
Changing the size switches off the Fixed Line Height button in the properties right Tab. Turn this back on to get the line back again.
The next object to place on our window is a button we will use to save our typing, so select the button icon from the tool box. Holding the mouse button down for a few seconds over this icon allows you to select different styles of button. You can always change these later via the properties pop up tabs.
Draw the button as shown.
Change the name of the button to ENTRY
Change the Label to Save This Poem
Now it is time to write the simple RunRev scripting for the events we want to happen when this button is clicked, so left click on the script Tab of the properties pop up.
Enter the first line of the RunRev event handler:
Press the enter key and RunRev inserts the handler completion statement and leaves the insert point on a blank line ready for you to type your events.
The scripting instructions we type in are going to let us save the contents of the field Poem at the end of the text file poems.txt which we used before in our Linux shell script entry.sh
When the text has been appended we empty the field for another poem if required.
Notice the use of quotes around field names, and the brackets around the PoemFile variable constructor. The & symbol is used by RunRev to concatenate.
The next statement makes sure that there aren't any returns in the constructed name.
Press the Apply button to save the script.
Next we will look at the RunRev help documentation to check if our statements are okay.
Open the help by left clicking the help icon at the right hand end of the RunRev bar. This Opens the help window.
If not selected, select the Transcript dictionary window. Type the word open into the search field. A selection of terms using the open word will appear.
Select open file, which is what we are doing in our script.
A second window will appear describing the usage of our selected term.
This window show how to use the open file command. We see in the synopsis that we can open the file for text append. Scrolling down shows us more information on this aspect.
From reading this information I definitely think we should use it as it makes sure that newlines are correctly inserted in the file.
Close these windows by left-clicking the top right x button.
Change the Entry button script and Apply to save the changes.
Clever users will notice that there isn't any marker to separate one poem from another like we had in the Linux shell version.
The next picture includes this marker in the script.
Also if we press this button when there is nothing in the field it will save only another marker, which is no good.
A simple if check to see the field is not empty around the actions prevents this from happening.
This is a lot more sophisticated than our Linux shell entry script.
Notice that RunRev uses <> to denote not equal to and the end of the if statement is denoted by end if
Each scripting language has its own way of doing these things, but as long as you have some help documentation to refer to, it doesn't take much to get around the syntax.
Don't forget to apply the changes.
You can see from this example how easy and simple it is to write RunRev scripting.
Change the Text Size of the button to 18. If you've forgotten go back up this HowTo until you discover the way, or use your RunRev documentation.
The next step is to make sure that the Poem field is empty when we first start the program.
Right click on a blank area in the window and select Card Properties.
Give the card a meaningful name. Eg ENTRY
Click on the script Tab.
Type the script as shown, Apply and x click the properties.
Use the SAVE icon on the menu bar to save your file in your bin directory as “poems”
RunRev always goes to its own directory first, so you will have to click the .. filename enough times to go back to the root directory, then home and your_name and bin to get there.
Test what you've done by clicking the hand on the top left of the Tool Box or selecting Tools – Browse Tool from the main menu bar
Now type in a poem and press the button to save it.
Open a shell terminal and use the command
$ cat $HOME/poems.txt
to see if it worked.
End of Part 1.
The reporting script is more long winded, as it involves some validation, but uses the same easy scripting style combined with some of our Linux shell script.
Part 2 will explain how to put a viewing button on our initial window that will open a viewing selection window.
There you will see how our shell scripting is used in conjunction with RunRev.
Using these simple examples, we will use this knowledge in more simple HowTos to make the shell do work for us with the sophistication of a windowing interface.
For more information about Runtime Revolution visit http://www.novell.com/coolsolutions/feature/1863.html
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com