06.01.2015 Views

Introduction to EON SDK - Construction IT research at VTT

Introduction to EON SDK - Construction IT research at VTT

Introduction to EON SDK - Construction IT research at VTT

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

User Guide<br />

Techniques<br />

listen <strong>to</strong> and send messages of other types. A module may also freely<br />

define new message types th<strong>at</strong> it could use when communic<strong>at</strong>ing with<br />

other modules.<br />

Following is a brief description of how you should work with module<br />

messages.<br />

1. To begin with, you perform module initializ<strong>at</strong>ion. Call<br />

IAutApp::GetToken() once for each message type you want the module<br />

<strong>to</strong> recognize. S<strong>to</strong>re all <strong>to</strong>kens for future use—you will need them <strong>to</strong><br />

determine the type of module message when Windows messages finally<br />

start <strong>to</strong> arrive.<br />

2. Then call IAutApp::ListenTo() for all the message types you'd like<br />

<strong>EON</strong> Studio <strong>to</strong> forward <strong>to</strong> the module. As an argument, pass a handler<br />

<strong>to</strong> the window you want <strong>to</strong> be the target for the specific message<br />

type. The module (or r<strong>at</strong>her, one of the module's windows) is now<br />

ready <strong>to</strong> start receiving messages. It is important <strong>to</strong> note th<strong>at</strong> you<br />

should skip this step completely if you want <strong>to</strong> subscribe <strong>to</strong> menu<br />

command messages—those messages are received without calling<br />

IAutApp::ListenTo().<br />

3. A WindowProc() message handler placed in the target window should<br />

first decide whether the received Windows message is a module<br />

message. If so, the handler must decide which type the message has—<br />

you should compare the message <strong>to</strong>ken with the ones you have<br />

previously s<strong>to</strong>red (see Step 1).<br />

4. If the message belongs <strong>to</strong> the set of module messages you're<br />

interested in, then let the WindowProc() handler process it<br />

accordingly. Note th<strong>at</strong> you should never change the contents of the<br />

message structure. There might be other modules th<strong>at</strong> listen <strong>to</strong> the<br />

same message type. If you modify the inform<strong>at</strong>ion, those modules<br />

will receive corrupt messages.<br />

Note th<strong>at</strong> you should always work on copies of the original module<br />

messages if you wish <strong>to</strong> modify the contents of the messages.<br />

5. If necessary, make your handler call the parent message handler<br />

CWnd::WindowsProc() and return.<br />

No snippets of code are included in this section. However, it is<br />

advisable <strong>to</strong> inspect the source code of the Sample Module, or read<br />

through the ModuleView.CPP file cre<strong>at</strong>ed by the <strong>EON</strong> Module Wizard.<br />

View handling<br />

One of the most exciting fe<strong>at</strong>ures of cre<strong>at</strong>ing an <strong>EON</strong> module is the<br />

ability <strong>to</strong> seamlessly add cus<strong>to</strong>m views inside <strong>EON</strong> Studio. These views<br />

are tre<strong>at</strong>ed in the same way as any standard views. In fact, some of<br />

the complex views (Scenegraph, Butterfly, ScriptEdi<strong>to</strong>r, etc) in <strong>EON</strong><br />

18<br />

<strong>EON</strong> <strong>SDK</strong> 2.53.0

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!