• Aucun résultat trouvé

PXJe tere accessing rnerft)er) ENl;

Dans le document The Usa Applications (Page 33-36)

creating the sea. er with • :- LScar . . . sets tile scan poslt1oo to a point ).1st before the first element In the Hst. If you Wf:Ilt to set al lnlta1 position 8'ld

SCII1J1I8ctlcn

use

the

metlWJd

~.

at=nm

to

create

the

sca.... eactl

execution Of the \rtt-LE loop

• AdvanceS value of LscaI.4JOSlUm by 1.

• sets

menDtr to the next. merJt)er of tile co1Jectkn When the coUecUm

Is

a llst, IT'B11b8r Is al Object-reference. When the

conecum

Is a

strIrld

or

a

ftJe, met i

lber Is a CharaCter.

When the

collectkrl Is

ill may,

men Iller Is

8 pointer to a recont

• RUlS the code In the \\MLE loop.

WIlen the scan position reactes a point )at after the last element In tne list

• s.scan

returns FPLSE.

• mJ Is set

to ~

for

Usts ,tn:S

arrays, or

~

for stdr9

tn:S tiles.

• The . . . er trees Itself.

LIsa Toolkit Referetr:e MI!n.JaJ U2Jject When tre JXJIPOSe of tne Itq) Is to

searcn

fOr a certain element, call s.Dnt When tne element being searched for Is fcx.n1 Tnen

• The next s.Sca'l returns FALSE.

• me

object variable retains Its asSI{Jled value.

• me sea ••

frees Itself.

The following excrT1lle Illustrates the use of 8~"llStSca'n!r to peel

every

ba'la'la

In a tum Of t8lanas cnl reroove the rotten

ones.

If CIl tl'Grrtpe bancnlls

eroot.rlteretL ro more DCnrlaS are peeled

PROCE:l..RE 01eckBcnnIs (b.nn lUst ~ BilIJI$

VM

s:

TUstscaYm';

b: TBalIJ lit BEGIN

s :-

tud\.Scamer; peate

a sea. er

to SOCI'l

tud\I

WHl..E s.sca(b) 00

for

~ b in tum dO:) BEGIN

. b.Peel; ~1l b to P8elltself.) If b.l.merrIpe It£N b If It is tl'Grrtpe}

s.DoI'8 f so, force tne scan to terminate.) B..SE F b.mtten It£N ~ b If it is rotten.1

ENJ;

ENJ;

2JLl FUe8CaI. ers

s.Delete (1RLE); {If so, tell s to delete b from bl.nCh cnj free it.1

flle oojects, lIlllke oUler collectbl objects, C8'l only be ~

UlfOUC1\

scalers.

oroe

the flle8CaIl m Is created, fUrther refereooes to the file Object ~t as If

the contents of the fUe

were

a string stored CIl the heap. The CCIltents of the

diSk file are rot moved to the

neap,

rowever (trey are paged

UlfOUC1\

bUffers In the OS), so file qlerat1<JlS can take l~r than string operations. If ro disk

file wltn the given rane exiSts, the file Is created When tne f1leScaner Is

created, CI'ld the tile Object acts like a'l8l'f1)ty

strq.

~ that the ToolKit does not explicitly tell yclJ Whether or rot the rue existed before you created

the ft1eSaa I .,1.

LIsa ToolKIt RefeJa?ce MInJs/

~ YaJ-la:)les. t::ls:lara::llrll...D'W •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• 3--4.

3.6.1

Arittr1'letic CI1CJ LJtlllty

ClIJeratiCllS ••••••.•••••••••••••••••••••••••••••••••••••••••••••

3-6

~ F~()I'lS. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• 3-7 3.7.2.1

MU1TlE!tic

(J"l Points ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• 3-7 3.7.2.2. Aritt1Tletlc 00 Recta'lgles •••••••••••••••••••••••••••••••••••••••••••••••••••• 3-9 3.7.2.3

ClIJeratiCllS

CJI'l Recta'lgles •••••••••••••••••••••••••••••••••••••••••••••••••• 3-10 calculations with Recta'lgles a'ld Points - View COOrdinates ••••••••••••••• 3-11

Draw1~

ClIJeratlO1S for

'Ilew CCJc)rtIlrlates •••••••••••••••••••••••••••••••••••••••• 3-12 3.7.4..1 L1rle--Orawlrlg Rootlrles •••••••••••••••••••••••• : ••••••••••••••••••••••••.••• 3-12 3.7.4.2 ~c

ClIJeratlO1S

CJrl Rec:ta'lgles •••••••••••••••••••••••••••••••••••••• 3-13 3.7 .4..3 ~c

ClIJeratlO1S

00

ovals •••••••••••••••••••••••••••••••••••••••••••••.

3-13

3.7.4.4

GraJtllc OperatiCllS

CJrl ROU"Oed-Comer Recta'lgles •••••••••••••• 3-14 3.7 .4..5 ~c

ClIJerations on

Arcs a'ld wedges ... 3-15

Liss ToolKIt RefenJnce !4InIaJ

3.1 Jnt.mcl£t.lm

LDraw provideS ~CS routines for draw~ In ToolKit prognms. It I1IJSt

be used wltn all ToolKlt appllcaUons. The fU1cUons l.Dr8W provideS 1nclll1e ,most Of the flroUCIlS provided by QulCkOraW,~.except trial l.Dr8W uses 32-blt

long integer (L~ coordinates instead of 16-blt Integer (INTEGER) ooordlnates. l.DraW also provideS a feW' extra ftmUms.

USing long integer coordlnates provideS coordlnates that cal IlVlge from -2147483648 (-231) to 2147483647 (~1-1~

However, no single

object cal

haVe a size greater Ulan 215 In either dimenslcn

Thls Chapter assunes that you are fam11iar with the QuiCkOraW doclmentatlm, WhIch Is contained In the Pascal marual.

LDraw defines TAmIl,

w.t ...a

~

TArea lrT1>lements methods for all parts of an ~UcaUm that draW til the

screen, including bOrdered

areas, sucn as

windows

aoo JBlBls.

w.t

wtllch Is a S\bClass of TArea, lrT1>lements methods that take InfOrmation arawn In al appllcatltll's view, alO alsplay It on tne screen.

TBIaD\Area, WhICh Is also a SlbJlass of TArea, Is used Internally to maintain spl1ttaDle panels. Tnere Is a reference Sheet follBra1chAraa'1n Part II Of this mcn.aal. 'Because you dO not deal direcuy with tills class, It Is not discussed fUrther In tnls Chapter.

3.2 The PUlposes

or

lDnIW

LDraw exists, for two maln p.Irposes. Flnt, it d8f1nes the baSic grapI'llcal structures that ~ter1Ze ToolKtt ClAlllcatlms:

ooraerea em

\I'C)Oraerea

screen areas. S8cot'l(t l.Dr8W t.ra1s1ates graphics from ToolKit fonnats to fOrms tnat ccrt De

usea

by QUlCkOraW. QUlCkOraW

mas

all on screen

araw1rYJ on

the Lisa.

QuiCkDrS'fl al'N8YS draws In

a

grsfPort. A grafPOrt

Is a

SOftware-defined port that cornects ya.ar appllcatltll'S ~ raJtlnes to the screen. When'you WEWlt to draW, you fDcUs the grafPort

on some

part Of the

screen.

You rormally Ck) rot

neea

to

worry

abOUt

fOCUS1rYJ

In ToolKIt

prograns.

YW

draW in ywr view, using tile view ooordinate ~ rout1nes lrT1>1emented in LDraw nJ

aescrtDea

In tnts cnapt.er.

sane

Of ywr-~lIcat1on's meVDlS are callao wltn thegratPort alrealy focused CIld ready to draW in

a

pEn

or m a

page. Otter metl'02S are callea fOr a Wfl)le pEnl, n:J ITUSt call t.ne metnod

~, 'Nhlctl fOcUses

on

each pEn in turn.

Dans le document The Usa Applications (Page 33-36)

Documents relatifs