03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

},<br />

This is a control without a prompt or control ID (neither are needed). The control is a label.<br />

You should always use the annotation font for cue text labels.<br />

The other controls use an EDWIN and CHOICELISTs, which we've already met. The derived<br />

dialog class shows the functions we use to control the visibility of the address field:<br />

class CGameInitiateDialog : public CEikDialog<br />

{<br />

public:<br />

CGameInitiateDialog(CGameController* aController);<br />

private:<br />

// From CEikDialog<br />

void PreLayoutDynInitL(); // Settings on dialog launch<br />

TBool OkToExitL(TInt aKeycode); // Action when OK pressed<br />

// Listen to changing selections<br />

void HandleControlStateChangeL(TInt aControlId);<br />

// Show only necessary controls<br />

void ShowRelevantControls(); // Called when needed<br />

private:<br />

CGameController* iController;<br />

};<br />

As well as PreLayoutDynInitL() and OkToExitL(), I have implemented another<br />

CEikDialog framework function, HandleControlStateChangeL(), which gets called<br />

with the relevant control ID whenever the value of any of the choice list fields in the dialog is<br />

changed. I also have a function called ShowRelevantControls() that I use to show or<br />

hide the address depending on the settings of other controls.<br />

Here's the implementation of ShowRelevantControls():<br />

void CGameInitiateDialog::ShowRelevantControls()<br />

{<br />

CEikChoiceList* choicelist1 =<br />

static_cast(Control(EGameControlIdStartMode));<br />

CEikChoiceList* choicelist2 =<br />

static_cast(Control(EGameControlIdProtocol));<br />

// Get start mode: 1=listen, 0=initiate<br />

TInt listen = choicelist1->CurrentItem();<br />

// Get protocol

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

Saved successfully!

Ooh no, something went wrong!