Ejemplo n.º 1
0
void TableView::OnContextMenu(MouseEvent* evt)
{
	evt->stopPropagation();
//	TextEdit::OnLButtonUp();

	CLXUIMenuElement* menu = new CLXUIMenuElement();
	menu->SetRParent(this);
	menu->SetOwnerWindow(get_OwnerWindow());

	int nfields = m_table.GetFieldCount();
	for (int i = 0; i < nfields; i++)
	{
		menu->AddItem(new TextString(m_table.GetField(i)->GetName()), 100+i);
	}

	/*
	menu->AddSeparator();
	menu->AddItem(new TextString(OLESTR("Insert/Remove Breakpoint")), ID_DEBUG_TOGGLEBREAKPOINT);
	*/

	menu->GetMenuPopup()->Popup(menu, LDraw::Point(evt->get_ScreenX(), evt->get_ScreenY()));
}
Ejemplo n.º 2
0
void MailReaderFrame::ViewTable(Table pTable)
{
	ASSERT(0);
#if 0
	TableView* pTableView = new TableView;
	pTableView->m_list = new TreeControl;
	pTableView->m_table = pTable;
	pTableView->m_Canvas = pCanvas;

	int nfields = pTable.GetFieldCount();
	for (int i = 0; i < nfields; i++)
	{
		pTableView->m_list->m_treeHeader->AddColumn(new TextString(pTable.GetField(i)->GetName()));
	}

	try
	{
		int count = pTable.GetCount();

		for (int i = 0; i < count; i++)
		{
			Record pRecord = pTable[i];
			TreeItem* item = new TreeItem(pTableView->m_list);
			item->m_itemData = new IntObject(i);

			for (int f = 0; f < nfields; f++)
			{
				Field pField = pRecord[f];

				if (pField.GetDef()->GetType() == FTyp_VarString)
				{

					sysstring str;

					try
					{
						str = pField.GetStringA().ToStringW();
					}
					catch(int)
					{
						str = OLESTR("(Error)");
					}

					item->AppendColumnCell(new TextString(str));
				//	item->AppendColumnCell(new TextEdit(ConvertA2S((char*)pField->GetData(), pField->GetSize())));
				}
				else if (pField.GetDef()->GetType() == FTyp_Long)
				{
					OLECHAR buf[16];
					swprintf(buf, OLESTR("%d"), (long)pField.GetValue());
					item->AppendColumnCell(new TextEdit(buf));
				}
				else if (pField.GetDef()->GetType() == FTyp_ShortDate)
				{
					time_t tim = (long)pField.GetValue();
					tm* t = localtime((time_t*)&tim);
					if (t)
					{
						char buf[256];
						strftime(buf, 256, "%c", t);
						//swprintf(buf, OLESTR("%d"), pField->u.int32);
						item->AppendColumnCell(new TextString(ConvertA2S(buf, strlen(buf))));
					}
					else
						item->AppendColumnCell(new TextString(OLESTR("")));
				}
			}

			pTableView->m_list->get_Children()->AppendItem(item);
		}
	}
	catch(int)
	{
		char msg[256];
#if 0
		sprintf(msg, "Error reading database %s", pTable->get_filename().c_str());
#endif
		MessageBox(NULL/*GetHwnd()*/, msg, "", MB_OK);
	}

	{
		ChildWindow* pWindow = new ChildWindow;
		pWindow->put_Width(Length(200, Length::UnitAbsolute));
		pWindow->put_Height(Length(200, Length::UnitAbsolute));

		ScrollViewer* pScroller = new ScrollViewer;
		{
			pScroller->put_Content(pTableView->m_list);
		}
		pTableView->put_VisualTree(pScroller);

		pWindow->put_Content(pTableView);
		pWindow->put_TitleText(OLESTR("www.bredband.no"));
		pCanvas->AddChild(pWindow);
	}
#endif
}