[comp.windows.ms] How does Excel do cells

swonk@ccicpg.UUCP (Glen Swonk) (12/02/89)

How does Excel implement the cells in a spreadsheet?
Are they just a drawing area on window or are all the
cells themselves seperate windows, thus allowing
the windows enviroment to send messages direct to
the process that manages the cell directly.

A related question, what is the "cost" of creating
lots of child windows?

And just one more, how does Excel provide the blinking
cell when a cell is selected with a control insert?


thanks
-- 
Glenn L. Swonk		CCI Computers 
(714)458-7282		9801 Muirlands Boulevard
			Irvine, CA 92718
uunet!ccicpg!swonk

mms00786@uxa.cso.uiuc.edu (12/05/89)

Interesting! I was once a cat with the same curiosity, so...
I wrote a small program that, when started, went into a loop and created the
same number of child windows as the number of cells I could see in Excel on
my 800x600 monitor. I think I cut all possible overhead, but my program was
not able to create all the child windows. So unless I am totally up the
creek without a paddle, I don't think each cell is a window...

On further reflection, I hope that the designers of Excel made no assumptions
as to the max resolution and size of the display device, and therefore cannot
know the max number of cells that Excel might be called upon to display at 
once. Given the absence of virtual memory and the generous 640K limit, I don't
think each cell is a window.

However, how about ONE child window, corresponding to the currently active cell?
(But, but, what about ranges etc...)

This was an illustration of how a senior approaching finals week attempts to 
think.

Milan
.

patrickd@chinet.chi.il.us (Patrick Deupree) (12/05/89)

In article <49529@ccicpg.UUCP> swonk@ccicpg.UUCP (Glen Swonk) writes:
>How does Excel implement the cells in a spreadsheet?
>Are they just a drawing area on window or are all the
>cells themselves seperate windows, thus allowing
>the windows enviroment to send messages direct to
>the process that manages the cell directly.
>
>And just one more, how does Excel provide the blinking
>cell when a cell is selected with a control insert?

I can't be sure (since I'm not a Microsoft developer) but my best guess says
that the spreadsheet in Excel was created entirely via GDI calls.  I don't
believe that each cell is a separate window since the overhead involved in that
would be collosal, not to mention the fact that there's no real reason to use
a window for the cell.  The blinking can be done fairly easily with a timer
and a FrameRect call (or something similar).  The only place that really 
needs a window would be the edit "bar" on top of the window.  Otherwise the
cells are display only.

As I said, though, these are just guesses and it is entirely possible (if not
probable) that Microsoft did it in some other way.
-- 
"I place my faith in fools.  Self confidence, my friends call it."
					-Edgar Allen Poe

Patrick Deupree -> patrickd@chinet.chi.il.us

bturner@hpcvlx.cv.hp.com (Bill Turner) (12/07/89)

> On further reflection, I hope that the designers of Excel made no assumptions
> as to the max resolution and size of the display device, and therefore cannot
> know the max number of cells that Excel might be called upon to display at 
> once. Given the absence of virtual memory and the generous 640K limit, I don't
> think each cell is a window.

Actually, it's even worse than that.  When a window is created, a data structure
of non-trivial size (I don't know exactly how large) is allocated from a single
64K segment, which is also used to allocate class structures from.  (HINT:  This
is why you shouldn't register window classes with large cbClsExtra or cbWndExtra
values)

--Bill Turner (bturner@hp-pcd.hp.com)
HP Corvallis Information Systems

johnc@plx.UUCP (John C.) (12/08/89)

I'll bet Excel uses DrawText to write the cell contents, and uses
just *one* additional window for the current cell (the only place
data entry is allowed).  The current-cell window is probably
MoveWindow'd around the spreadsheet window as you change the
current cell position with the mouse or arrow keys.  The key 
concept here is that even *controls* (child windows) can be 
MoveWindow'd, not only app windows or their popups.

It should be easy to test this theory -- just bring up the Spy app
which is part of the SDK.  Choose "Window / Set", then move the cursor 
around the Excel display and see if the window info displayed in Spy's
dialog changes as you do so.  You might even be able to see the
WM_MOVE being sent to the current-cell window, if my guess pans out.

If anyone tries this, please e-mail me your findings...

/John Ciccarelli (johnc@plx.uucp --or-- ...sun!plx!johnc)