本文整理汇总了C++中HTMLForm::Event方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLForm::Event方法的具体用法?C++ HTMLForm::Event怎么用?C++ HTMLForm::Event使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::Event方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DefaultEvent
HTMLEventStatus HTMLInputReset::DefaultEvent(HTMLEvent *pEvent)
{
HTMLEvent e;
HTMLForm *pForm = Form();
HTMLDocument *pDoc = GetDocument();
int x = pEvent->data.position.x, y = pEvent->data.position.y;
WebKey key;
WEBC_DEBUG_ReceiveEvent(this, pEvent);
switch (pEvent->type)
{
case HTML_EVENT_CLICK:
if (pForm)
{
e.type = HTML_EVENT_RESET;
e.data.position.x = x;
e.data.position.y = y;
e.elem = (HELEMENT_HANDLE)this;
return (pForm->Event(&e));
}
return (HTML_EVENT_STATUS_DONE);
case HTML_EVENT_KEYDOWN:
{
HTMLEventStatus retval = DefaultInputKeyHandler(pEvent);
if (retval != HTML_EVENT_STATUS_CONTINUE)
{
return (retval);
}
break;
}
case HTML_EVENT_KEYPRESS:
key = pEvent->data.key;
if (pForm && key == '\r')
{
e.type = HTML_EVENT_RESET;
e.data.position.x = x;
e.data.position.y = y;
e.elem = (HELEMENT_HANDLE)this;
HTMLEventStatus status = pForm->Event(&e);
if (status == HTML_EVENT_STATUS_HALT)
{
return (status);
}
return (HTML_EVENT_STATUS_CONTINUE);
}
break;
default:
// ignore other event types
break;
}
return (HTMLInputButton::DefaultEvent(pEvent));
}
示例2: DefaultEvent
HTMLEventStatus HTMLInputPassword::DefaultEvent(HTMLEvent *pEvent) // tbd
{
WEBC_UINT8 onlyBox = 1;
WEBC_UINT8 hasSubmit = 0;
HTMLElement *pElem = 0;
HTMLInput *pSubmit = 0;
vector_iterator it;
WEBC_DEBUG_ReceiveEvent(this, pEvent);
switch (pEvent->type)
{
case HTML_EVENT_CHANGE:
break;
case HTML_EVENT_EDIT:
{
HTMLForm *pForm = Form();
if (pForm)
{
pElem = (HTMLElement*)ObjectListGetFirst(pForm->GetFieldVector(), &it);
while (pElem)
{
if ( (pElem->Type() == HTML_EDIT_STR_ELEMENT ||
pElem->Type() == HTML_EDITBOX_ELEMENT)
&& pElem != this)
{
onlyBox = 0;
break;
}
if (pElem->Type() == HTML_BUTTON_ELEMENT
&& !hasSubmit)
{
hasSubmit = 1;
pSubmit = (HTMLInput *)pElem;
}
pElem = (HTMLElement*)ObjectListGetNext(&it);
}
if (pSubmit && onlyBox)
{
HTMLEvent e;
e.type = HTML_EVENT_SUBMIT;
e.data.position.x = pEvent->data.position.x;
e.data.position.y = pEvent->data.position.y;
e.elem = (HELEMENT_HANDLE)pSubmit;
return (pForm->Event(&e));
}
}
break;
}
case HTML_EVENT_FOCUS:
{
HTMLSetFlagFinder f(HELEM_FLAG_HAS_FOCUS, 1);
FindElement(&f);
SetFlag(HINPUT_FLAG_ACTIVE);
Update(0,0);
break;
}
case HTML_EVENT_UNFOCUS:
{
HTMLSetFlagFinder f(HELEM_FLAG_HAS_FOCUS, 0);
FindElement(&f);
ClearFlag(HINPUT_FLAG_ACTIVE);
Update(0,0);
break;
}
case HTML_EVENT_KEYDOWN:
{
HTMLEventStatus retval = DefaultInputKeyHandler(pEvent);
if (retval != HTML_EVENT_STATUS_CONTINUE)
{
return (retval);
}
switch (pEvent->data.key)
{
case WGK_LNDN:
case WGK_LNUP:
case WGK_LEFT:
case WGK_RIGHT:
pEvent->flags |= HTML_EVENT_FLAG_CANCEL_BUBBLE;
break;
}
break;
}
default:
break;
}
return (HTMLInput::DefaultEvent(pEvent));
}