Главная » Просмотр файлов » Wiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007

Wiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007 (779890), страница 79

Файл №779890 Wiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007 (Symbian Books) 79 страницаWiley.Symbian.OS.C.plus.plus.for.Mobile.Phones.Aug.2007 (779890) страница 792018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 79)

The nature of the optimization is left to the FEP itself, soyou should not assume that a control will never receive key events otherthan those specified in its own InputCapabilities() function andthose of its component controls.FocusThe basic concept of focus – sometimes referred to as keyboard focus – isfairly straightforward. In previous discussions the ‘current’ tile wasequated with the one that had ‘focus’, and that is essentially the case.In any compound control there is generally one component that is thecurrent control of interest, the one with which the user is interacting, forexample:• typing text into an edit box• selecting one item from those in a list box• changing a date in a date editor.438CONTROLSYou might be tempted to define the control with focus as being the oneto which key events are offered, but that is not entirely true.

Certainly,some key events are directed to the control with focus, but others arenot. Key events might be offered to, and consumed by, other types ofcontrol before there is any chance of their being offered to the controlwith focus. Such potential consumers of keys include FEPs, dialogs andthe application’s menu bar.Some FEPs consume key events as well as generate them. An exampleis one that consumes a key-event sequence to generate a single Chinesecharacter. Such FEPs own a control that is placed on the control stackat a higher priority than visible controls, giving it first refusal of all keyevents.All controls are capable of having focus by default. You can set a controlto be incapable of receiving focus by calling SetFocusing(EFalse),and check if a control is in this state by calling IsNonFocusing().

Anon-focusing control can be made capable of receiving focus by callingSetFocusing(ETrue).Only one component control should have focus at any one time,and it is the application’s responsibility to ensure that this is obeyedby its views. A container can find out if a control has focus by callingits IsFocused() function, and can set or remove focus on one of itscomponent controls with that control’s SetFocus() function.In addition to setting or removing focus on a control, SetFocus() alsocalls the control’s FocusChanged() function. The parameter passed tothis latter function is EDrawNow if the control is visible and activated,otherwise ENoDrawNow.

The purpose of this function is to give the controlan opportunity to change its appearance in response to the change infocus. The default implementation is empty, so controls should implementit as and when necessary. One simple implementation of this functioncan be the following:void COandXTile::FocusChanged(TDrawNow aDrawNow){if (aDrawNow == EDrawNow){DrawNow();}}There are two other focus-related functions, PrepareForFocusGainL() and PrepareForFocusLossL(). The control frameworkdoes not call them, and their default implementations are empty.HANDLING KEY AND POINTER EVENTS439Pointer EventsPointer events are system events that originate in the digitizer driver,which passes the events to the window server. The window serverassociates the pointer event with a particular window and sends the eventto the application that owns the window group containing that window.As discussed earlier, S60-specific controls have no need to respond topointer events, but all the general-purpose controls available in SymbianOS, and all UIQ-specific controls, respond to pointer as well as keyevents.Representation of pointer eventsA pointer event is represented by an instance of a TKeyEvent, definedin w32std.h.struct TPointerEvent{enum TType{EButton1Down,EButton1Up,EButton2Down,EButton2Up,EButton3Down,EButton3Up,EDrag,EMove,EButtonRepeat,ESwitchOn,};TType iType;TUint iModifiers;TPoint iPosition;TPoint iParentPosition;};////////Type of pointer eventState of pointing device & assoc.

buttonsWindow co-ordinates of mouse eventPosition relative to parent windowThe following event types are defined:• EButton1Down (pen down)• EButton1Up (pen up)• other buttons: you don’t get these on pen-based devices• EButtonRepeat, which is generated when a button is held downcontinuously in one place, just like keyboard repeat – most useful forcontrols such as scroll arrows or emulated on-screen keyboards• EDrag, which is rarely used in Symbian OS, but can be useful• ESwitchOn, as some phones can be switched on by a tap on thescreen440CONTROLS• EMove, which you never get on pen-based devices.

Devices supporting move also have to support a mouse cursor (which the windowserver provides functionality for), control entry/exit notification, andchanging the cursor to indicate what will happen if you press button 1.That’s all hard work and adds little value to Symbian OS phones.The iModifiers member contains any pointer-event modifiers,including Shift, Ctrl, and Alt keys (where available), using the samevalues as for key-event modifiers.

For instance, in a text editor, Shift andtap might be used to make or extend a selection.Distributing pointer eventsUnlike key events, the Symbian OS framework code directs pointerevents to the appropriate control without any explicit assistance from theapplication. Normally the window server associates a pointer event withthe foremost window whose rectangle encloses the event’s position.Pointer grab is one exception to this rule. It is used to ensure that thecontrol that received a pointer-down event receives all subsequent pointerevents until the next pointer-up event, even if the pointer is dragged sothat these later events occur outside the original control.

Implementingpointer grab needs cooperation between the window server, which hasto ensure that the subsequent events are directed to the same window,and the control framework, which has to ensure that they go to the samecontrol within that window.The other exception is pointer capture, which is initiated and terminated by calling a control’s SetPointerCapture() function. Whileset, pointer capture prevents any other control from receiving pointerdown events. The most common uses of pointer capture are:• in dialogs, to throw away pointer events that occur outside the dialog• in menus, to dismiss the menu in response to a pointer down eventoutside its window.Processing pointer eventsWithin the application, the event is passed to the HandleWsEventL()function of the application UI class, which is the same function thathandles key events.

This function recognizes the event as a pointer eventassociated with a particular window and calls the ProcessPointerEventL() of the control that owns the window. This in turn callsthe control’s HandlePointerEventL() function. If the control hascomponents, the default implementation of HandlePointerEventL()scans the visible non-window-owning components to locate one that contains the event’s position. If one is found, HandlePointerEventL()calls its ProcessPointerEventL() function.HANDLING KEY AND POINTER EVENTS441To customize the response to pointer events in a simple control, youshould override its HandlePointerEventL() function.

You wouldn’tnormally override this function in a compound control, but if you do,make sure that you don’t prevent pointer events from being passed to acomponent control.In the Noughts and Crosses example, the tile’s HandlePointerEventL() function is implemented as follows:void COandXTile::HandlePointerEventL(const TPointerEvent&aPointerEvent){if (aPointerEvent.iType == TPointerEvent::EButton1Down){TryHitL();}}The TryHitL() function uses controller code to attempt to add anought or a cross to the relevant tile and, if successful, redraws the tile.The way a control handles pointer events is, in many ways, similar tohandling key events:• it does not need to check if it is supposed to receive a pointer eventbecause it does not receive one otherwise• it can ignore the event• it can use the event to generate a command that is processed elsewhere.However, a pointer event is delivered only to the particular control forwhich it is intended, which means:• there is normally no need to pass the event to another control• the concept of not consuming a pointer event has no meaning, whichis reflected in both the function’s name (HandlePointerEventL())and its return type (void).In addition to calling HandlePointerEventL(), the ProcessPointerEventL() function also performs some useful preprocessingof pointer events.

Характеристики

Тип файла
PDF-файл
Размер
6,45 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6418
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее