| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Phone book

Page history last edited by PBworks 17 years, 5 months ago

PHONE BOOK - PART 1

 

The new architecture of Microsoft, Windows Vista, recommends that programmers create applications using paradigm of web pages. Squeak has an object that does this: it is called Book. We are going to create a project / simple activity: in one page we will be able to enter with names and telephone numbers (we will add (an index?) field of codigo ) to be recorded and, in another page, we will be able to see the list of all phone numbers. We will also have a layer page. The second part (of the reading) we already made in the previous lesson (Scroll pane quick reference). We will start our project by reopening this previous project. We drag a Book object:

 

 

Click with the right button and reclick; we see that inside of the Book object we have an object page. (If we reclick in the top part we will discover two other objects: Alignments and PageControls) In the upper right part of the upper bar of the Book, we have small logo. Click in it, and we can increase (or decrease) the available buttons. As we want to have 3 pages (a layer, a page for the inputting data and another one for the report) we press twice the “+” button. Opening the halo of each page we move, in the inferior part, the name of them stops: layer, page1 and page2. On page2 we want to have the button and the ScrollPane to read the list- from the previous exercise - already we can use them in this page. So that they are not in a layer below, we click (in the Menu of them) in: bring you front. Later, “to embed them” in the page, we select embed into page2.

 

 

We have to increase the size of each page to make them the same. You can advance through the 3 pages pressing the buttons on the top bar. Although our application is simple, we would like to create three flaps that, when clicked, would take them to that page. We go to see as we make this for the layer. First we place a Rectangle (to use the Supplies) blue as a deep one of page. Later, a Button with its color changed for the same blue. As script to go for the layer (a redundancy therefore already we are here in the layer) it goes to be gone off clicando the tongue-piece, we open a Publisher of script for this Button and later, opening others two Viewers, we place “cold lines” with the objects Book and layer. It sees the figure:

 

 

Script will be: Book goto: Layer. It repairs that goto: it is a method of the Book object. If it does not forget to save script! For script to be gone off with a click in the tongue-piece (Button) we clicamos in “Normal” in the Publisher of script and change for: mouseDown.

 

 

In the halo of the Button a green button exists to create copies of it. These copies go with scripts grudados. Thus, we create two copies and we place our tongue-piece of the Layer in the others two pages. Into remembers “embed”. It uses to advantage to create new deep (with Rectangles) in these pages. You can test to see if she is coming back toward the layer, from another page. We go to save, for the time being, this our partial work with the project name: Telephones. What it goes to create the archive: Telefones.001.pr. E we saimos of the Squeak-Etoys.


 

BOOK OF TELEPHONES - PART 2

 

We go to reopen our project now and, to create new tongues-piece (buttons) for the other pages. You already know as to make this…

 

 

Tested all the buttons and being all OK, you can give another Save in the project. You can erase the superior bar because already she has the buttons to sail for the application. He always goes for the layer before saving therefore, when you recharge a project, it she comes with the situation of when you she saved it. Telefones.002.pr This is because we have a new version of the project.

 

 

We go then to create script for cadastre of new telephones. For this we place in the page three titulos using Text and three TextFields for the data entry. We change types etc. We also place a Button which will be on script. One remembers that everybody is embedado in the page. If it does not forget that, to inside use an object of script of another one, you have that to drag a “cold line” of the Viewer of that object.

 

 

In ours case script will be:

 

|cod nome tel file reg|

cod:=Text4 getCharacters as String.

nome:=Text3 getCharacters as String.

tel:=Text2 getCharacters as String.

file:= FileStream fileNamed:'meuarquivo.txt'.

file setToEnd.

reg:= cod,'#',nome,'#', tel,':'.

file nextPutAll:reg.

Text4 setCharacters:' '.

Text3 setCharacters:' '.

Text2 setCharacters:' '.

file close.

 

 

One remembers to save and to define that it will be gone off with one mouseDown. There we make a test, entering with new register to be recorded in the archive:

 

 

Going for the page of the List, we clicamos the button to read the archive:

 

 

The new register is there. To complete our project we could create a layer with instructions on as to use the application. We would also need, in a real application, to make one better edition of the list, being created columns with headings etc. This everything using the properties of the String Classroom. To finish, we again save the project after coming back toward the layer.

Comments (0)

You don't have permission to comment on this page.