当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLForm::Event方法代码示例

本文整理汇总了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));
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:58,代码来源:hreset.cpp

示例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));
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:94,代码来源:hpasswd.cpp


注:本文中的HTMLForm::Event方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。