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.

� The general-purpose control designed to live in a dialog should show the cursor, if it<br />

has one, when focused, and not otherwise. Many editors include some kind of cursor, or<br />

even the window server's flashing text cursor to indicate that they have focus.<br />

12.2.6 Dimming and Visibility<br />

There are two ways to indicate that a control in a dialog cannot receive focus:<br />

� Make it invisible: You can make the entire line – prompt and control – invisible. The<br />

control environment has full support for this action; invisible controls are omitted from<br />

redraw and pointer handling, and dialogs will not allow invisible lines to be given focus.<br />

� Dim it : If you dim a control, it will be omitted from pointer handling. Dialogs will not<br />

allow a dimmed line to gain focus. However, the control environment will not omit a<br />

dimmed control from redrawing; rather, the implementer of the control has to code<br />

Draw() to dim the control explicitly.<br />

The good thing, supposedly, about dimming is that the user can still see the control and the<br />

value it contains, even though they can't change it. But actually, dimming is a nuisance; the<br />

writer of the control has to add support in Draw() (using logical colors can help with this –<br />

see <strong>Chapter</strong> 15 for more information). In any case, unavailable options might be entirely<br />

meaningless, in which case you don't want to dim the control, you want to hide it altogether.<br />

Some dialogs in UIQ use a cute compromise; when you call Make-<br />

LineVisible(EFalse), the dialog dims the prompt and makes the general-purpose<br />

control invisible. The user gets the right effect, the general-purpose control doesn't have to<br />

support dimming explicitly, and there's no attempt to display meaningless values.<br />

The relevant functions for dimming are found in CCoeControl:<br />

class CCoeControl : public CBase<br />

{<br />

public:<br />

...<br />

IMPORT_C virtual void SetDimmed(TBool aDimmed);<br />

IMPORT_C TBool IsDimmed() const;<br />

...<br />

};<br />

If you need to, honor IsDimmed() in your Draw() function.<br />

12.2.7 Valiation<br />

While a control has focus and the user is editing it, it may become temporarily invalid –<br />

numeric editors are an example of this. However, when focus is taken from a control – for a<br />

change in dialog line, or because Done was pressed – it's important that the control should<br />

be valid.<br />

UIQ calls PrepareForFocusLossL() on any control from which it is about to remove<br />

focus. The default CCoeControl implementation of this function is empty: there is no need<br />

to override it for a control whose internal state can never be invalid (for example, a choice<br />

list, a button, a checkbox, or a text editor). If your control could be invalid, however, you<br />

should implement this function to check the current validity of the control. If it is invalid, you<br />

should:

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

Saved successfully!

Ooh no, something went wrong!