EasyManuals Logo
Home>Casio>Calculator>ClassPad 300

Casio ClassPad 300 Programming Guide

Casio ClassPad 300
125 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #11 background imageLoading...
Page #11 background image
PegThing* PegThing::Remove(PegThing *Who, BOOL bDraw = TRUE);
void Destroy(PegThing *Who);
The PegThing member function Remove() is used to detach an object from the object’s
parent. This removes the object from the tree, but does not remove the object from
memory. The PegThing member function Destroy() is similar to Remove(), although
Destroy() both removes the object from the tree and deletes the object from memory.
As long as items belong to the PegPresentationManager, all memory will be freed
automatically. However, once you use Remove() to remove an object from the tree you
are in charge of deleting its memory.
Changing a PegThing’s Size or Location
PegThing has two member functions that deal with resizing or relocating itself. These
functions are:
virtual void Resize(PegRect Rect);
virtual void Center(PegThing *Who);
Any PEG object can resize itself or any other object at any time by calling the Resize()
function. The new screen coordinates for the objects are passed in the parameter Rect. If
you maintain or find a pointer to another object, you can also resize that object by calling
the same function. The following example illustrates this concept:
PegRect Rect(10, 10, 40, 40);
PegButton *MyButton = new PegTextButton(Rect, 0, “Hello”);
.
. // at any time, to resize MyButton:
.
Rect.Set(20, 20, 60, 60);
MyButton->Resize(Rect);
If an object is visible when it is resized, it will automatically perform the necessary
invalidation and drawing. It is perfectly acceptable to resize an object that is not visible,
in fact in many cases this is the best time to do it. Note that passing a rectangle of the
same size as your PegThing, but at different location will cause the Resize() function to
move your PegThing’s without changing its size.
Center() will adjust the screen coordinates of Who such that Who is horizontally and
vertically centered over the client area of this. Who does not necessarily have to be a
child of this, although that is the most common case. The following example
demonstrates centering an object on the screen:
PegRect Rect;
Rect.Set(0, 0, 100, 100); // create 100x100 pixel window
PegWindow *MyWin = new PegWindow(Rect);
Presentation()->Center(MyWin); // center window on the screen
Presentation()->Add(MyWin); // make the window visible
11

Table of Contents

Other manuals for Casio ClassPad 300

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Casio ClassPad 300 and is the answer not in the manual?

Casio ClassPad 300 Specifications

General IconGeneral
BrandCasio
ModelClassPad 300
CategoryCalculator
LanguageEnglish

Related product manuals