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

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

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

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

It is caused by the view’s controlsbeing created and initialized in the ViewConstructL() function which,as mentioned earlier, is called as late as possible, just before the view firstbecomes visible. This means that the document’s RestoreL() function(and, at least when the application is run for the first time, its StoreL()function) are called before the view is fully initialized.We resolve this problem by adding an iInitialFocusId data member to the COandXView class and coding the view’s SetFocusByIdL()function as:void COandXView::SetFocusByIdL(TInt aControlId){CCoeControl * control = ControlById<CCoeControl>(aControlId);if (control){RequestFocusL(control);}else // Control does not yet exist{iInitialFocusId = aControlId;}}If the control does not yet exist, the value is copied into iInitalFocusId and used, within ViewConstructL(), to move focus to thecorrect control after it has been created.We also need to deal with the case where the persistent data needs tobe written before the tiles exist (this only happens once, the first time theapplication is run, when the application’s INI file is being created).

The relevant data is obtained by a call to the view’s IdOfFocusedControl(),whose implementation is:TInt COandXView::IdOfFocusedControl(){TInt i;for (i=0; i<KNumberOfTiles; i++){CCoeControl *control=ControlById<CCoeControl>(i);if (!control) // Not yet created{return 0;}if (control->IsFocused()){break;}}return i;}366A SIMPLE GRAPHICAL APPLICATIONIf a control does not yet exist, the function simply returns zero, whichis the correct default value.SummaryThis chapter has described a simple but non-trivial application to play agame of Noughts and Crosses.After a brief introduction to the game, the chapter explained the overallarchitecture of the application, before describing each of the S60 version’smajor component classes in more detail.The chapter concluded with a discussion of the main differencesbetween the S60 and UIQ versions of the game.13Resource FilesIn Chapters 2 and 11, resource files are used to define the main elementsrequired by a Symbian OS application UI.

In Chapter 16 we also useresource files to specify dialogs.In this chapter we review resource files and the resource compilermore closely, to understand their role in development for Symbian OS.This chapter provides a quick tour – for a fuller reference, see the SDK.13.1 Why a Symbian-Specific Resource Compiler?The Symbian OS resource compiler starts with a text source file andproduces a binary data file in parallel with the application’s executable.In contrast, Windows uses a resource compiler which supports iconsand graphics as well as text-based resources, and which builds theresources right into the application executable so that an application canbe built as a single package. Many Windows programmers never see thetext resource script nowadays, because their development environmentincludes powerful and convenient GUI-based editors.So, why does Symbian OS have its own resource compiler, and howcan an ordinary programmer survive without the graphical resourceediting supported by modern Windows development environments?Unlike Windows developers, Symbian OS developers target a widerange of hardware platforms, each of which may require a differentexecutable format.

Keeping the resources separate introduces a layer ofabstraction that simplifies the development of Symbian OS, and the effortsrequired by independent developers when moving applications betweendifferent hardware platforms. Furthermore, and perhaps more importantly,it provides good support for localization. In addition to facilitating the368RESOURCE FILESprocess of translation by confining the items to be translated into separatefiles, it allows a multilingual application to be supplied as a singleexecutable together with a number of language-specific resource files.An application based on the GUI application templates generated bythe Carbide.c++ wizard (see Chapter 11) uses a resource file to containGUI element definitions (menus, dialogs, etc.) and strings that are neededby the program at run time.

The run-time resource file has the extension.rsc, and post-Symbian OS v9 it resides in the applications resourcedirectory rather than in the same directory as the application.13.2Source File SyntaxBecause processing starts with the C preprocessor, a resource file has thesame lexical conventions as a C program, including source-file commentsand C preprocessor directives.The built-in data types in Table 13.1 are used to specify the datamembers of a resource, as described later.

A resource file may containstatements of the types shown in Table 13.2.Table 13.1 Built-in Data TypesData TypeDescriptionBYTEA single byte, which may be interpreted as a signed orunsigned integer value.WORDTwo bytes, which may be interpreted as a signed or unsignedinteger value.LONGFour bytes, which may be interpreted as a signed or unsignedinteger value.DOUBLEEight-byte real, for double precision floating point numbers.TEXTA string terminated by a null. This is deprecated: use LTEXTinstead.LTEXTA Unicode string with a leading length byte but noterminating null.BUFA Unicode string with no leading byte or terminating null.BUF8A string of 8-bit characters with no leading byte or terminatingnull.BUF<n>A Unicode string of up to n characters with no leading byte orterminating null.SOURCE FILE SYNTAX369Table 13.1 (continued )Data TypeDescriptionLINKThe ID of another resource (16 bits).LLINKThe ID of another resource (32 bits).SRLINKA 32-bit self-referencing link that contains the resource ID ofthe resource in which it is defined.

Its value is assignedautomatically by the resource compiler.Table 13.2 Resource File Statement TypesStatement typeDescriptionNAMEDefines the leading 20 bits of any resource ID. Mustbe specified prior to any RESOURCE statement.STRUCTDefines a named structure for use in buildingaggregate resources.RESOURCEDefines a resource, which may optionally be given aname.ENUM/enumDefines an enumeration and supports a syntaxsimilar to that of C.CHARACTER SETDefines the character set for strings in the generatedresource file. If not specified, cp1252 is the default.STRUCT StatementsA STRUCT statement takes the following form:STRUCT struct-name [ BYTE |WORD ] { struct-member-list }struct_name specifies a name for the struct. The name must startwith a letter and be in upper-case characters. It may contain letters, digitsand underscores, but not spaces.

The optional BYTE and WORD keywordsare intended for use with structs that have a variable length. They have noeffect unless the struct is used as a member of another struct, when theycause the data of the struct to be preceded by a length BYTE or lengthWORD, respectively.struct_member_list is a list of member initializers, terminated bysemicolons, and enclosed in braces {}. A member may be one of thebuilt-in types, a previously defined struct or an array.

An array member370RESOURCE FILESdoes not specify either the number or the type of its elements. It iscommon to supply members with default values, frequently either 0 or anempty string. The following example, taken from eikon.rh, illustratesmany of the features of a STRUCT statement.STRUCT DIALOG{LONG flags=0;LTEXT title="";LLINK pages=0;LLINK buttons=0;STRUCT items[];LLINK form=0;}// an arraySTRUCT statements are conventionally placed in separate files with a.rh (resource header) extension and included in the resource script. Youmay find it instructive to review the contents of the various RH files thatyou will find in the \epoc32\include directory of an installed SDK.RESOURCE StatementsThe RESOURCE statement is probably the most important, and certainlythe most frequently used, statement. It takes the form:RESOURCE struct_name [ id ] { member_initializer_list }struct_name refers to a previously encountered STRUCT statement.In most application resource scripts, this means a struct defined in anincluded RH file.

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

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

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

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