WAP之家:为您提供最全最新的WAP技术,CP.SP.3G等行业资讯。 WAP之家交流论坛全新开放 点击进入>>
WAP资讯 | 3G动态 | SP动态 | 运营商动态 | 内容商动态 | 制造商动态 | 论坛讨论>> 每次自动访问
WAP技术 | WAP源码 | 手机编程 | 手机源码 | 无线技术 | J2ME技术 | 手机软件 添加到收藏夹
IVR技术 | SP资料 | SMS MMS技术 | 商业方案 | IVR下载 | 书籍教程 | 工具软件 语言:繁體中文

WAP之家技术文章手机编程PlamPALM开发教程-第九章 分类和查找

PALM开发教程-第九章 分类和查找
作者:palmheart  来源:palmheart.net  发布时间:2005-12-21 3:36:55
imeType ) );

// CH.5 Unlock the record
MemHandleUnlock( hrecord );

// CH.5 Clear the busy bit and set the dirty bit
DmReleaseRecord( contactsDB, cursor, true );

// CH.5 Increment the total record count
numRecords++;

// CH.5 Set the dirty bit
isDirty = true;

// Ch.9 Get the record attribute bits
DmRecordInfo( contactsDB, cursor, &recAttrs, NULL, NULL );

// CH.9 Clear the category bits
recAttrs &= ~dmRecAttrCategoryMask;

// CH.9 Set the category to the appropriate category
if( listCat == dmAllCategories )
recAttrs |= dmUnfiledCategory;
else
recAttrs |= listCat;

// CH.9 Set the record attributes
DmSetRecordInfo( contactsDB, cursor, &recAttrs,
NULL );

// CH.5 We're done
return;
}

// CH.5 A time saver: Gets object pointers based on their ID
static VoidPtr getObject( FormPtr form, Word objectID )
{
Word index; // CH.5 The object index

// CH.5 Get the index
index = FrmGetObjectIndex( form, objectID );

// CH.5 Return the pointer
return( FrmGetObjectPtr( form, index ) );
}

// CH.5 Gets the current database record and displays it
// in the detail fields
static void setFields( void )
{
FormPtr form; // CH.5 The contact detail form
CharPtr precord; // CH.6 A record pointer
Word index; // CH.5 The object index
UInt recAttrs; // CH.9 The record attribute bits
Char catName[dmCategoryLength]; // CH.6 The category name

// CH.5 Get the contact detail form pointer
form = FrmGetActiveForm();

// CH.5 Get the current record
hrecord = DmQueryRecord( contactsDB, cursor );

// CH.6 Initialize the date and time variable
precord = MemHandleLock( hrecord );
MemMove( &dateTime, precord + DB_DATE_TIME_START,
sizeof( dateTime ) );

// CH.6 Initialize the date control
setDateTrigger();

// CH.6 Initialize the time control
setTimeTrigger();

// CH.5 Set the text for the First Name field
setText( getObject( form, ContactDetailFirstNameField ),
precord + DB_FIRST_NAME_START );

// CH.5 Set the text for the Last Name field
setText( getObject( form, ContactDetailLastNameField ),
precord + DB_LAST_NAME_START );

// CH.5 Set the text for the Phone Number field
setText( getObject( form, ContactDetailPhoneNumberField ),
precord + DB_PHONE_NUMBER_START );
MemHandleUnlock( hrecord );

// CH.5 If the record is already dirty, it's new, so set focus
if( isDirty )
{
// CH.3 Get the index of our field
index = FrmGetObjectIndex( form, ContactDetailFirstNameField );

// CH.3 Set the focus to the First Name field
FrmSetFocus( form, index );

// CH.5 Set upper shift on
GrfSetState( false, false, true );
}

// CH.9 Get the record attributes
DmRecordInfo( contactsDB, cursor, &recAttrs, NULL, NULL );

// CH.9 Get the category
detailCat = recAttrs & dmRecAttrCategoryMask;

// CH.9 Set the category popup trigger label
CategoryGetName( contactsDB, detailCat, catName );
CategorySetTriggerLabel( getObject( form,
ContactDetailCategoryPopupPopTrigger ), catName );

// CH.5 We're done
return;
}

// CH.5 Puts any field changes in the record
void getFields( void )
{
FormPtr form; // CH.5 The contact detail form

// CH.5 Get the contact detail form pointer
form = FrmGetActiveForm();

// CH.5 Turn off focus
FrmSetFocus( form, -1 );

// CH.5 If the record has been modified
if( isDirty )
{
CharPtr precord; // CH.5 Points to the DB record

// CH.7 Detach the record from the database
DmDetachRecord( contactsDB, cursor, &hrecord );

// CH.5 Lock the record
precord = MemHandleLock( hrecord );

// CH.5 Get the text for the First Name field
getText( getObject( form, ContactDetailFirstNameField ),
precord, DB_FIRST_NAME_START );

// CH.5 Get the text for the Last Name field
getText( getObject( form, ContactDetailLastNameField ),
precord, DB_LAST_NAME_START );

// CH.5 Get the text for the Phone Number field
getText( getObject( form, ContactDetailPhoneNumberField ),
precord, DB_PHONE_NUMBER_START );

// CH.7 Find the proper position
cursor = DmFindSortPosition( contactsDB, pre

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] 

[] [返回上一页] [打 印]
文章评论

用户名: 查看更多评论

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

         (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码