Example #1
0
//---------------------------------------------------------------------------
void __fastcall TSynchronizeDialog::DoLog(TSynchronizeController * /*Controller*/,
  TSynchronizeLogEntry Entry, const UnicodeString Message)
{
  LogView->Items->BeginUpdate();
  try
  {
    TListItem * Item = LogView->Items->Add();
    Item->Caption = Now().TimeString();
    Item->SubItems->Add(Message);
    Item->MakeVisible(false);
    while (LogView->Items->Count > MaxLogItems)
    {
      LogView->Items->Delete(0);
    }
  }
  __finally
  {
    LogView->Items->EndUpdate();
    if (Entry == slScan)
    {
      // redraw log before the scanning block update
      LogView->Repaint();
    }
  }
}
Example #2
0
//---------------------------------------------------------------------------
void __fastcall TAuthenticateForm::Log(const UnicodeString Message)
{
  TListItem * Item = LogView->Items->Add();
  Item->Caption = Message;
  Item->MakeVisible(false);
  AdjustLogView();
  LogView->Repaint();
}
void __fastcall TfrmReplaceRule::lvReplaceRulesDragDrop(TObject *Sender,
      TObject *Source, int X, int Y)
{
  TListItem * DestItem = lvReplaceRules->GetItemAt(X,Y);
  TListItem * Item     = lvReplaceRules->Selected;
  TListItem * NewItem  = lvReplaceRules->Items->Insert(DestItem->Index);
  NewItem->Assign(Item);
  lvReplaceRules->Items->Delete(Item->Index);
}
Example #4
0
TEnclosuresView::~TEnclosuresView()
{
	for (int32 index = fList->CountItems();index-- > 0;)
	{
		TListItem *item = static_cast<TListItem *>(fList->ItemAt(index));
		fList->RemoveItem(index);

		if (item->Component() == NULL)
			watch_node(item->NodeRef(), B_STOP_WATCHING, this);
		delete item;
	}
}
Example #5
0
//---------------------------------------------------------------------------
void __fastcall TSynchronizeChecklistDialog::StatusBarMouseDown(
  TObject * /*Sender*/, TMouseButton /*Button*/, TShiftState Shift, int X,
  int /*Y*/)
{
  int IPanel = PanelAt(X);

  if (IPanel >= 0)
  {
    TListItem * Item = SelectAll(true, IPanel, Shift.Contains(ssCtrl));
    if (Item != NULL)
    {
      Item->MakeVisible(false);
      Item->Focused = true;
      ListView->SetFocus();
    }
  }
}
Example #6
0
//---------------------------------------------------------------------------
void TFScheduler::SetStatus(int prio, int time, int code)
{
	int row = m_status->RowCount;

	m_status->Cells[0][row-1] = code;
	m_status->Cells[1][row-1] = prio;
	m_status->Cells[2][row-1] = "Pronto";
	m_status->Cells[3][row-1] = time;

	m_status->RowCount++;

	TListItem * list = m_ls->Items->Add();
	list->Caption = IntToStr(code);
	list->SubItems->Add("Processo em estado de criação");
	list->ImageIndex = prio;
	list->MakeVisible(true);
	list->Selected = true;
}
Example #7
0
//---------------------------------------------------------------------------
void __fastcall TSynchronizeDialog::DoLogInternal(
  TSynchronizeLogEntry Entry, const UnicodeString & Message,
  TStrings * MoreMessages, TQueryType Type, const UnicodeString & HelpKeyword)
{
  LogView->Items->BeginUpdate();
  try
  {
    TListItem * Item = LogView->Items->Add();

    TLogItemData * LogItemData = new TLogItemData();
    Item->Data = LogItemData;
    LogItemData->Entry = Entry;
    LogItemData->Message = Message;
    if (MoreMessages != NULL)
    {
      LogItemData->MoreMessages.reset(new TStringList());
      LogItemData->MoreMessages->Assign(MoreMessages);
    }
    LogItemData->Type = Type;
    LogItemData->HelpKeyword = HelpKeyword;

    Item->Caption = Now().TimeString();

    UnicodeString UnformattedMessage = UnformatMessage(Message);
    UnformattedMessage = ReplaceStr(UnformattedMessage, L"\r", L"");
    UnformattedMessage = ReplaceStr(UnformattedMessage, L"\n", L" ");

    Item->SubItems->Add(UnformattedMessage);
    Item->MakeVisible(false);
    while (LogView->Items->Count > MaxLogItems)
    {
      LogView->Items->Delete(0);
    }
  }
  __finally
  {
    LogView->Items->EndUpdate();
    if (Entry == slScan)
    {
      // redraw log before the scanning block update
      LogView->Repaint();
    }
  }
}
Example #8
0
entry_ref *
listview::FindItem()
{
//	char		string[512];
	int32		index;
	entry_ref	*ref = NULL;
//	status_t	result;
	TListItem	*item;
	
	index = fList->CurrentSelection();
	item = dynamic_cast<TListItem *>(fList->ItemAt(index));
	if (item)
	{
		ref = item->Ref();
		if (ref) 
			return(ref);
	}
	return NULL;
}
void __fastcall TfrmBillFormat::lvFieldsDragDrop(TObject *Sender,
      TObject *Source, int X, int Y)
{
  TListItem * DestItem = lvFields->GetItemAt(X,Y);
  TListItem * Item     = lvFields->Selected;
  int SourIndex,DestIndex;
  SourIndex = Item->Index;
  DestIndex = DestItem->Index;
  TListItem * NewItem;
  if(SourIndex < DestIndex)
    NewItem  = lvFields->Items->Insert(DestIndex + 1);
  else
    NewItem  = lvFields->Items->Insert(DestIndex);
  NewItem->Assign(Item);
  _di_IXMLNode RecordNode = BillConfig->GetRecordNode(BillName);
  _di_IXMLNode SourNode   = BillConfig->GetFieldNode(BillName,Item->SubItems->Strings[0]);
  _di_IXMLNode DestNode   = BillConfig->GetFieldNode(BillName,DestItem->SubItems->Strings[0]);
  _di_IXMLNode TmpNode    = SourNode->CloneNode(true);
  //RecordNode->ChildNodes->Remove(DestNode);
  //RecordNode->ChildNodes->Insert(DestIndex,TmpNode);

  RecordNode->ChildNodes->Remove(SourNode);
  RecordNode->ChildNodes->Insert(DestIndex,TmpNode);
  lvFields->Items->Delete(Item->Index);
/*
  TListItem * DestItem = lvFields->GetItemAt(X,Y);
  TListItem * Item     = lvFields->Selected;
  int OldIndex = Item->Index;
  TListItem * NewItem  = lvFields->Items->Insert(DestItem->Index);
  int NewIndex = NewItem->Index;
  if(OldIndex < NewIndex)
    NewIndex -= 1;
  _di_IXMLNode RecordNode   = BillConfig->GetRecordNode(BillName);
  _di_IXMLNode OldFieldNode = BillConfig->GetFieldNode(BillName,Item->SubItems->Strings[0]);
  _di_IXMLNode NewFieldNode = OldFieldNode->CloneNode(true);
  RecordNode->ChildNodes->Delete(OldIndex);
  RecordNode->ChildNodes->Insert(OldIndex,NewFieldNode);

  NewItem->Assign(Item);
  lvFields->Items->Delete(Item->Index);
*/
}
void __fastcall TfrmBillConfig::lvBillsDragDrop(TObject *Sender,
      TObject *Source, int X, int Y)
{
  TListItem * DestItem = lvBills->GetItemAt(X,Y);
  TListItem * Item     = lvBills->Selected;
  int SourIndex,DestIndex;
  SourIndex = Item->Index;
  DestIndex = DestItem->Index;
  TListItem * NewItem;
  if(SourIndex < DestIndex)
    NewItem  = lvBills->Items->Insert(DestIndex + 1);
  else
    NewItem  = lvBills->Items->Insert(DestIndex);
  NewItem->Assign(Item);
  _di_IXMLNode SourNode  = BillConfig->GetBillNode(Item->SubItems->Strings[0]);
  _di_IXMLNode TmpNode   = SourNode->CloneNode(true);

  BillConfig->BillRootNode->ChildNodes->Remove(SourNode);
  BillConfig->BillRootNode->ChildNodes->Insert(DestIndex,TmpNode);
  lvBills->Items->Delete(Item->Index);
}
Example #11
0
//---------------------------------------------------------------------------
void __fastcall TSynchronizeChecklistDialog::ListViewWindowProc(TMessage & Message)
{
  if (Message.Msg == CN_NOTIFY)
  {
    TWMNotify & NotifyMessage = reinterpret_cast<TWMNotify &>(Message);
    if (NotifyMessage.NMHdr->code == NM_CUSTOMDRAW)
    {
      // Due to a bug in VCL, OnAdvancedCustomDrawSubItem is not called for any
      // other stage except for cdPrePaint. So we must call it ourselves.
      TNMLVCustomDraw * CustomDraw =
        reinterpret_cast<TNMLVCustomDraw *>(NotifyMessage.NMHdr);
      if (FLAGSET(CustomDraw->nmcd.dwDrawStage, CDDS_ITEM) &&
          FLAGSET(CustomDraw->nmcd.dwDrawStage, CDDS_SUBITEM) &&
          FLAGSET(CustomDraw->nmcd.dwDrawStage, CDDS_ITEMPOSTPAINT) &&
          (CustomDraw->iSubItem == 4) &&
          (ActionImages->Width <= ListView->Columns->Items[CustomDraw->iSubItem]->Width))
      {
        TListItem * Item = ListView->Items->Item[CustomDraw->nmcd.dwItemSpec];
        const TSynchronizeChecklist::TItem * ChecklistItem =
          static_cast<const TSynchronizeChecklist::TItem *>(Item->Data);
        TRect R = Item->DisplayRect(drBounds);
        for (int Index = 0; Index < CustomDraw->iSubItem; Index++)
        {
          R.Left += ListView->Columns->Items[Index]->Width;
        }
        R.Left +=
          (ListView->Columns->Items[CustomDraw->iSubItem]->Width - ActionImages->Width) / 2;
        // doing this from ListViewAdvancedCustomDraw corrupts list view on Windows 7
        ImageList_Draw(reinterpret_cast<HIMAGELIST>(ActionImages->Handle),
          int(ChecklistItem->Action), CustomDraw->nmcd.hdc,
          R.Left, ((R.Top + R.Bottom - ActionImages->Height) / 2), ILD_TRANSPARENT);
      }
    }
  }

  FOrigListViewWindowProc(Message);
}
Example #12
0
void
listview::UpdateList(char *buffname, bool need_save)
{
//	(new BAlert("Niue", "Updating..", "Ok", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();

	BString string, newstring;

	for(int i=0; i < fList->CountItems(); i++)
	{
		string = buffname;
		TListItem *item = dynamic_cast<TListItem *>(fList->ItemAt(i));
					
		if(item->is_source == true)
		{
			newstring = item->GetName();

			Window()->Lock();			
			if(string == newstring)
			{

				if(need_save)
				{
//					(new BAlert("Niue", "Updating.., need save", "Ok", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
					item->save = false;
//					item->fIcon= NULL;
					item->DrawItem(this->fList,BRect(0,(i*42),item->Width(), item->Height()+2), true);
//					item->Update(this->fList, be_plain_font);
				}
				else
				{
//					(new BAlert("Niue", "Updating.., no need save", "Ok", 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
					item->save = true;
//					item->fIcon= NULL;
					item->DrawItem(this->fList,BRect(0,(i*42),item->Width(), item->Height()+2), true);
//					item->Update(this->fList, be_plain_font);
				}
				fList->Invalidate();
			}
			
//				BuildList(startref);
				Window()->Unlock();
		}
		else
			item->save = true;
	}	
}
Example #13
0
void __fastcall TfrmSearch::lvParamsDragDrop(TObject *Sender,
      TObject *Source, int X, int Y)
{
  TListItem * SourItem = lvParams->Selected;
  TListItem * DestItem = lvParams->GetItemAt(X,Y);
  TListItem * TempItem = lvParams->Items->Add();
  TempItem->Assign(SourItem);
  SourItem->Assign(DestItem);
  DestItem->Assign(TempItem);
  lvParams->Items->Delete(TempItem->Index);
}
Example #14
0
//---------------------------------------------------------------------------
bool __fastcall TAuthenticateForm::Execute(UnicodeString Status, TPanel * Panel,
  TWinControl * FocusControl, TButton * DefaultButton, TButton * CancelButton,
  bool FixHeight, bool Zoom, bool ForceLog)
{
  TModalResult DefaultButtonResult;
  TAlign Align = Panel->Align;
  try
  {
    assert(FStatus.IsEmpty());
    FStatus = Status;
    DefaultButton->Default = true;
    CancelButton->Cancel = true;

    DefaultButtonResult = DefaultResult(this);

    if (Zoom)
    {
      Panel->Align = alClient;
    }

    if (ForceLog || Visible)
    {
      if (ClientHeight < Panel->Height)
      {
        ClientHeight = Panel->Height;
      }
      // Panel being hidden gets not realigned automatically, even if it
      // has Align property set
      Panel->Top = ClientHeight - Panel->Height;
      Panel->Show();
      TCursor PrevCursor = Screen->Cursor;
      try
      {
        if (Zoom)
        {
          LogView->Hide();
        }
        else
        {
          if (LogView->Items->Count > 0)
          {
            TListItem * Item = LogView->ItemFocused;
            if (Item == NULL)
            {
              Item = LogView->Items->Item[LogView->Items->Count - 1];
            }
            Item->MakeVisible(false);
          }
        }
        Screen->Cursor = crDefault;

        if (!Visible)
        {
          assert(ForceLog);
          ShowAsModal();
        }

        ActiveControl = FocusControl;
        ModalResult = mrNone;
        AdjustControls();
        do
        {
          Application->HandleMessage();
        }
        while (!Application->Terminated && (ModalResult == mrNone));
      }
      __finally
      {
        Panel->Hide();
        Screen->Cursor = PrevCursor;
        if (Zoom)
        {
          LogView->Show();
        }
        Repaint();
      }
    }
    else
    {
      int PrevHeight = ClientHeight;
      int PrevMinHeight = Constraints->MinHeight;
      int PrevMaxHeight = Constraints->MaxHeight;
      try
      {
        Constraints->MinHeight = 0;
        ClientHeight = Panel->Height;
        if (FixHeight)
        {
          Constraints->MinHeight = Height;
          Constraints->MaxHeight = Height;
        }
        LogView->Hide();
        Panel->Show();
        FFocusControl = FocusControl;

        ShowModal();
      }
      __finally
      {
        FFocusControl = NULL;
        ClientHeight = PrevHeight;
        Constraints->MinHeight = PrevMinHeight;
        Constraints->MaxHeight = PrevMaxHeight;
        Panel->Hide();
        LogView->Show();
      }
    }
  }
Example #15
0
void
TEnclosuresView::MessageReceived(BMessage *msg)
{
	switch (msg->what)
	{
		case LIST_INVOKED:
		{
			BListView *list;
			msg->FindPointer("source", (void **)&list);
			if (list)
			{
				TListItem *item = (TListItem *) (list->ItemAt(msg->FindInt32("index")));
				if (item)
				{
					BMessenger tracker("application/x-vnd.Be-TRAK");
					if (tracker.IsValid())
					{
						BMessage message(B_REFS_RECEIVED);
						message.AddRef("refs", item->Ref());

						tracker.SendMessage(&message);
					}
				}
			}
			break;
		}

		case M_REMOVE:
		{
			int32 index;
			while ((index = fList->CurrentSelection()) >= 0)
			{
				TListItem *item = (TListItem *) fList->ItemAt(index);
				fList->RemoveItem(index);

				if (item->Component())
				{
					TMailWindow *window = dynamic_cast<TMailWindow *>(Window());
					if (window && window->Mail())
						window->Mail()->RemoveComponent(item->Component());

					(new BAlert("", TR(
						"Removing attachments from a forwarded mail is not yet "
						"implemented!\nIt will not yet work correctly."),
						TR("OK")))->Go();
				}
				else
					watch_node(item->NodeRef(), B_STOP_WATCHING, this);
				delete item;
			}
			break;
		}

		case M_SELECT:
			fList->Select(0, fList->CountItems() - 1, true);
			break;

		case B_SIMPLE_DATA:
		case B_REFS_RECEIVED:
		case REFS_RECEIVED:
			if (msg->HasRef("refs"))
			{
				bool badType = false;

				int32 index = 0;
				entry_ref ref;
				while (msg->FindRef("refs", index++, &ref) == B_NO_ERROR)
				{
					BFile file(&ref, O_RDONLY);
					if (file.InitCheck() == B_OK && file.IsFile())
					{
						TListItem *item;
						for (int16 loop = 0; loop < fList->CountItems(); loop++)
						{
							item = (TListItem *) fList->ItemAt(loop);
							if (ref == *(item->Ref()))
							{
								fList->Select(loop);
								fList->ScrollToSelection();
								continue;
							}
						}
						fList->AddItem(item = new TListItem(&ref));
						fList->Select(fList->CountItems() - 1);
						fList->ScrollToSelection();
						
						watch_node(item->NodeRef(), B_WATCH_NAME, this);
					}
					else
						badType = true;
				}
				if (badType)
				{
					beep();
					(new BAlert("",
						TR("Only files can be added as attachments."),
						TR("OK")))->Go();
				}
			}
			break;

		case B_NODE_MONITOR:
		{
			int32 opcode;
			if (msg->FindInt32("opcode", &opcode) == B_NO_ERROR)
			{
				dev_t device;
				if (msg->FindInt32("device", &device) < B_OK)
					break;
				ino_t inode;
				if (msg->FindInt64("node", &inode) < B_OK)
					break;

				for (int32 index = fList->CountItems();index-- > 0;)
				{
					TListItem *item = static_cast<TListItem *>(fList->ItemAt(index));

					if (device == item->NodeRef()->device
						&& inode == item->NodeRef()->node)
					{
						if (opcode == B_ENTRY_REMOVED)
						{
							// don't hide the <missing attachment> item

							//fList->RemoveItem(index);
							//
							//watch_node(item->NodeRef(), B_STOP_WATCHING, this);
							//delete item;
						}
						else if (opcode == B_ENTRY_MOVED)
						{
							item->Ref()->device = device;
							msg->FindInt64("to directory", &item->Ref()->directory);

							const char *name;
							msg->FindString("name", &name);
							item->Ref()->set_name(name);
						}

						fList->InvalidateItem(index);
						break;
					}
				}
			}
			break;
		}

		default:
			BView::MessageReceived(msg);
	}
}
Example #16
0
void TfrmLayer::onRegen()
{
	if(!this->Showing)
    	return;

	for(int i=0;i< _Colors.size();i++) {
		if(_Colors[i]->Showing) _Colors[i]->Hide();
		delete _Colors[i];
	}
	_Colors.clear();

	for(int i=0;i< _alphas.size();i++) {
		if(_alphas[i]->Showing) _alphas[i]->Hide();
		delete _alphas[i];
	}
	_alphas.clear();

	ListView1->Clear();

	ListView1->Visible = false;

	if(_fview==NULL) {
		this->Caption = "Layers < Nothing >";
		popupMenu->AutoPopup = false;
		StatusBar1->Panels->operator [](1)->Text = "0";
		StatusBar1->Panels->operator [](3)->Text = "0";
	}

	else {
		popupMenu->AutoPopup = true;
		this->Caption = _fview->Caption ;
		NewLayer1->Enabled = true;

		_layers = _fview->view()->layers();

		for(int i=0 ; i < _layers->size() ;i++) {
			TListItem *item;
			item = ListView1->Items->Add();

			TCHAR* str = _layers->at(i)->getName();

			item->Caption = str;
			item->Checked = _layers->at(i)->visible();

			RGBA color;
            color.r = color.g = color.b = 0;
			color.a = 255;

			TRect rect = item->DisplayRect(drSelectBounds);

			////--
			TColorBox *lc = new TColorBox(this);
			lc->Top = rect.top;
			lc->Left = 100; // 102;
			lc->Width = 100;
			lc->ItemHeight = 11;

			lc->BevelOuter = bvNone;

			lc->Selected = clWindow;
			char name[255];
			sprintf(name,"N%05d%d",i,1);
			lc->Name = name;
			if(_layers->at(i)->getLineColor(color))
				lc->Selected = (TColor)RGB(color.r,color.g,color.b);

			lc->OnSelect = ColorBox1Select;
			lc->OnDropDown = ColorBox1DropDown;

			lc->Parent = ListView1;

			TColorBoxStyle style;
			//style << cbStandardColors << cbIncludeNone << cbIncludeDefault << cbPrettyNames << cbSystemColors << cbCustomColor;
			style << cbIncludeDefault << cbPrettyNames << cbCustomColor;
			lc->Style = style ;

			for(int i=0 ; i<256; i++) {
				char str[255];
				sprintf(str,"%d",i);
				lc->AddItem(str,(TObject*)(TColor)RGB(dxfColors[i][0]*255,dxfColors[i][1]*255,dxfColors[i][2]*255));
			}

			_Colors.push_back(lc);

			//
			TTrackBar *la = new TTrackBar(this);
			la->Top = rect.top;
			la->Left = 160;
			la->Width = 60;
			la->Height = 16;
			la->Max = 255;
			la->ShowSelRange = false;
 			la->TabOrder = 1;
 			la->TabStop = false;
			la->ThumbLength = 14;

			la->Parent = ListView1;

			la->TickMarks = tmBoth;
			la->TickStyle = tsNone;
			sprintf(name,"T%05d%d",i,1);
			la->Name = name;
			la->Position = 255;
			la->Brush->Color = clWhite;
			if(_layers->at(i)->getLineColor(color)) la->Position = color.a;

			la->OnChange = TrackBar1Change;
			_alphas.push_back(la);


			////
			TColorBox *fc = new TColorBox(this);
			fc->Top = rect.top;
			fc->Left = 200;
			fc->Width = 100;
			fc->ItemHeight = 11;
			fc->BevelOuter = bvNone;
			fc->Selected = clBackground;
			sprintf(name,"N%05d%d",i,2);
			fc->Name = name;
			if(_layers->at(i)->getFillColor(color))
				fc->Selected = (TColor)RGB(color.r,color.g,color.b);

			fc->OnSelect = ColorBox1Select;
			fc->OnDropDown = ColorBox1DropDown;

			fc->Parent = ListView1;
			fc->Style = style;

			for(int i=0 ; i<256; i++) {
				char str[255];
				sprintf(str,"%d",i);
				fc->AddItem(str,(TObject*)(TColor)RGB(dxfColors[i][0]*255,dxfColors[i][1]*255,dxfColors[i][2]*255));
			}


			_Colors.push_back(fc);

			//
			TTrackBar *fa = new TTrackBar(this);

			fa->Top = rect.top;
			fa->Left = 260;
			fa->Width = 60;
			fa->Height = 16;
			fa->Max = 255;
			fa->ShowSelRange = false;
			fa->TabOrder = 1;
			fa->TabStop = false;
			fa->ThumbLength = 14;

			fa->Parent = ListView1;

			fa->TickMarks = tmBoth;
			fa->TickStyle = tsNone;
			sprintf(name,"T%05d%d",i,2);
			fa->Name = name;
			fa->Position = 255;
			fa->Brush->Color = clWhite;
			if(_layers->at(i)->getFillColor(color)) fa->Position = color.a;

			fa->OnChange = TrackBar1Change;


			_alphas.push_back(fa);

            ////--

		}

		char str[MAX_PATH];
		sprintf(str,"%d",_layers->size());
		StatusBar1->Panels->operator [](1)->Text = str;
	}
	ListView1->Visible = true;



}
Example #17
0
//---------------------------------------------------------------------------
void __fastcall TGetTrackThread::CarStatDetect()
{
//更改為與LIS相容方式
//由資料庫讀取Event
    TQuery* pQEvent = new TQuery(Form_ManageState);         //Free before catch
    pQEvent->DatabaseName = "DB_DCH";
    pQEvent->SQL->Add("SELECT * FROM tEvent");
    try
    {
        //由資料庫中把問題找出來,然後進行問題觸發
        pQEvent->Active = false;
        pQEvent->Active = true;
        for(pQEvent->First(); !pQEvent->Eof; pQEvent->Next())
        {
            if(Terminated)
            {
                delete pQEvent;
                return;
            }
            Application->ProcessMessages();     //2002.7.15 added
            AnsiString CarID = pQEvent->FieldByName("CarID")->AsString;
            int EventType = pQEvent->FieldByName("EventType")->AsInteger;
            AnsiString Descript = pQEvent->FieldByName("Descript")->AsString;
            int CarSN = pQEvent->FieldByName("CarSN")->AsInteger;
            AnsiString Handler = pQEvent->FieldByName("Handler")->AsString;
            AnsiString SendDate = pQEvent->FieldByName("SendDate")->AsString;
            AnsiString SendTime = pQEvent->FieldByName("SendTime")->AsString;
            Form_ManageState->ImportEvent(CarSN,CarID,EventType,Descript,Handler,SendDate,SendTime);
        }
        pQEvent->Active = false;
        //將列表中的問題與資料庫中的問題拿出來比較,把已解決的問題刪除
        for(int i=0; i<Form_ManageState->ListView1->Items->Count;i++)
        {  //假如已經解決的問題就將該筆資料刪除
            if(Terminated)
            {
                delete pQEvent;
                return;
            }
            Application->ProcessMessages();     //2002.7.15 added
            TListItem* pListItem = Form_ManageState->ListView1->Items->Item[i];
            AnsiString CarID = pListItem->Caption;
            int EventType = pListItem->SubItems->Strings[0].ToInt();
            pQEvent->SQL->Clear();
            pQEvent->SQL->Add("SELECT * FROM tEvent");
            pQEvent->SQL->Add("WHERE CarID = :CarID");
            pQEvent->SQL->Add("AND EventType = :EventType");
            pQEvent->ParamByName("CarID")->AsString = CarID;
            pQEvent->ParamByName("EventType")->AsInteger = EventType;
            pQEvent->Active = false;
            pQEvent->Active = true;
            if(pQEvent->RecordCount == 0)        //此車輛已沒有進行監控,刪除
            {
                pListItem->Delete();
                i--;
            }
            pQEvent->Active = false;
        }
    }
    catch(EDBEngineError &E)
    {
        DataModule1->EstablishConnect(1);
    }
    catch(...)
    {}
    //將就資料刪除,
    delete pQEvent;
    //處理警告聲音
    ProcessSound();
}
Example #18
0
void
RocketView::MouseDown(BPoint where)
{
	// focus the list for scrolling
	MakeFocus(true);	
	
	uint32 buttons;
	
	// retrieve the button state from the MouseDown message
	if (Window()->CurrentMessage()->FindInt32("buttons", (int32 *)&buttons) == B_NO_ERROR) 
	{
		// find item at the mouse location
		int32 item = IndexOf(where);
		// make sure item is valid
		if ((item >= 0) && (item < CountItems())) 
		{
			// if clicked with second mouse button, let's do a context-sensitive menu
			if (buttons & B_SECONDARY_MOUSE_BUTTON) 
			{
				BPoint	point = where;
				ConvertToScreen(&point);
				// select this item
				Select(item);
				
				//see if we need to enable some features
				//mark as source
				int32		index;
				entry_ref	*ref = NULL;
				TListItem	*item;
				
				//finds selected item	
				index = CurrentSelection();
				item = dynamic_cast<TListItem *>(ItemAt(index));
				if (item)
					ref = item->Ref();
  
				BNode node(ref);
				BNodeInfo nodeInfo(&node);
				char type[256];
				nodeInfo.GetType(type);
				BString t;
				t << type;
/*				
				if (t == "text/x-source-code")
					mnuLeft->ItemAt(0)->SetEnabled(false);
				else
					mnuLeft->ItemAt(0)->SetEnabled(true);
*/				
				mnuLeft->Go(point, true,true,(BRect(point.x,point.y,point.x + 1,point.y + 1)),true);
				return;
				
			}
			else if (buttons & B_PRIMARY_MOUSE_BUTTON) 
			{
				if (CurrentSelection() == item)
					Invoke();
				else
					Select(item);
			}
			 
		}
	}
}