void insertTextCB(AtkEditableText *aText, const gchar *aString, gint aLength, gint *aPosition) { nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); if (!accWrap) return; nsCOMPtr<nsIAccessibleEditableText> accText; accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText), getter_AddRefs(accText)); if (!accText) return; NS_ConvertUTF8toUTF16 strContent(aString); // interface changed in nsIAccessibleEditableText.idl ??? // // PRInt32 pos = *aPosition; // nsresult rv = accText->InsertText(strContent, aLength, &pos); // *aPosition = pos; accText->InsertText(strContent, *aPosition); MAI_LOG_DEBUG(("EditableText: insert aString=%s, aLength=%d, aPosition=%d", aString, aLength, *aPosition)); }
static void setTextContentsCB(AtkEditableText *aText, const gchar *aString) { AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); if (!accWrap) return; HyperTextAccessible* text = accWrap->AsHyperText(); if (!text || !text->IsTextRole()) return; MAI_LOG_DEBUG(("EditableText: setTextContentsCB, aString=%s", aString)); NS_ConvertUTF8toUTF16 strContent(aString); text->SetTextContents(strContent); }
void CBatchTextDlg::OnBnStartClicked() { if (m_VarTbl.empty()) { return; } //处理文件内容模式 CString str; m_ctrlPattern.GetWindowText(str); CStringW strContent(str); m_ContPat.clear(); ParsePattern(strContent, m_ContPat); //处理文件名模式 m_ctrlFileName.GetWindowText(str); CStringW strFileName(str); m_FilePat.clear(); ParsePattern(strFileName, m_FilePat); //处理目标文件夹 CString strFolder; m_ctrlFolder.GetWindowText(strFolder); if (FALSE == PathFileExists(strFolder)) { CreateDirectory(strFolder, NULL); } if (strFolder[strFolder.GetLength() - 1] != _T('\\')) { strFolder.AppendChar(_T('\\')); } if (m_FilePat.size() == 1) { CString strPathName = strFolder + m_FilePat.front(); DeleteFile(strPathName); } //开始生成 for (STRTABLE::iterator i = m_VarTbl.begin(); i != m_VarTbl.end(); ++i) { GenTextFromPat(m_ContPat, *i, strContent); GenTextFromPat(m_FilePat, *i, strFileName); CString strPathName = strFolder + CString(strFileName); SaveTextFile(strPathName, strContent); } }
void setTextContentsCB(AtkEditableText *aText, const gchar *aString) { nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); if (!accWrap) return; nsCOMPtr<nsIAccessibleEditableText> accText; accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText), getter_AddRefs(accText)); if (!accText) return; MAI_LOG_DEBUG(("EditableText: setTextContentsCB, aString=%s", aString)); NS_ConvertUTF8toUTF16 strContent(aString); accText->SetTextContents(strContent); }
static void insertTextCB(AtkEditableText *aText, const gchar *aString, gint aLength, gint *aPosition) { AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText)); if (!accWrap) return; HyperTextAccessible* text = accWrap->AsHyperText(); if (!text || !text->IsTextRole()) return; NS_ConvertUTF8toUTF16 strContent(aString, aLength); text->InsertText(strContent, *aPosition); MAI_LOG_DEBUG(("EditableText: insert aString=%s, aLength=%d, aPosition=%d", aString, aLength, *aPosition)); }
void CDataParser::ProcessLedRequest( QByteArray& byStream ) { QByteArray byBody = GetBody( byStream ); if ( 1 > byBody.length( ) ) { return; } quint8 nAddress = ( quint8 ) byBody.at( 0 ); QByteArray byData = byBody.right( byBody.length( ) - 1 ); QString strContent( byData ); //F5 C2 FF 01 0B 08 FF FF 26 4E 30 34 26 48 30 34 24 31 QByteArray byTmp; char cCmd [ ] = { 0xF5, 0xC2, 0xFF, 0x01, 0x0B, 0x08, 0xFF, 0xFF, 0x26, 0x4E, 0x30, 0x34, 0x26, 0x48, 0x30, 0x34, 0x24, 0x31 }; byTmp.append( cCmd, sizeof ( cCmd ) ); byTmp.append( CCommonFunction::GetTextCodec( )->fromUnicode( strContent ) ); byTmp.append( char ( 0x1A ) ); WriteSerial( pWineSerialPort, byTmp.data( ), byTmp.length( ) ); }
void Member::OnBnClickedButton1() { CString strName,strMoney; GetDlgItem(IDC_EDIT1)->GetWindowText(strName); if (strName.IsEmpty()) { CString ss = _T("Name is Empty"); MessageBox(ss); return; } GetDlgItem(IDC_EDIT2)->GetWindowText(strMoney); if (strMoney.IsEmpty()) { CString ss = _T("Money is Empty"); MessageBox(ss); return; } float fMoney = atof(strMoney); ////////////////////////////////////////// sqlite3_stmt* ppStmt = NULL; CString strSql; strSql.Format("select id, money from member where name = '%s'",strName); int ret = sqlite3_prepare(conn, strSql, -1, &ppStmt, /*&tail*/0); ret = sqlite3_step(ppStmt); int id = -1; if(ret!=SQLITE_DONE) { id = sqlite3_column_double(ppStmt,0); double dMoney = sqlite3_column_double(ppStmt,1); dMoney += fMoney; sqlite3_finalize(ppStmt); strSql.Format("UPDATE member SET money = %f WHERE name='%s'",dMoney,strName); ret = sqlite3_prepare(conn, strSql, -1, &ppStmt, /*&tail*/0); ret = sqlite3_step(ppStmt); for(int i=1;i<m_Grid.GetRowCount();i++) { CString str = m_Grid.GetItemText(i,0); int n = atoi(str); if(n == id) { CString strNum; strNum.Format("%f",dMoney); m_Grid.SetItemText(i,2,strNum); m_Grid.SetItemBkColour(i,2,0X00F0F0); break;; } } m_Grid.UpdateData(); m_Grid.Invalidate(); if(ret != SQLITE_DONE) MessageBox("充值成功,请查看高亮处是否准确"); sqlite3_finalize(ppStmt); } else { strSql.Format("INSERT INTO member ([name],[money]) VALUES('%s',%f)",strName,fMoney); char *pSql; pSql=strSql.GetBuffer(); char *err_msg = NULL; sqlite3_stmt *stmt; // Create a prepared statement. if (SQLITE_OK != sqlite3_exec(conn, pSql, 0, 0, &err_msg)) { CString strContent(err_msg); MessageBox(strContent); } else { GetDlgItem(IDC_EDIT1)->SetWindowText(_T("")); GetDlgItem(IDC_EDIT2)->SetWindowText(_T("")); } FillGrid(); } //////////////////////////////////////////// //delete pSql; CString strResult; CTime time = CTime::GetCurrentTime(); CString date = time.Format("%Y-%m-%d %H:%M:%S %W-%A"); strResult.Format("%d:%s add money %s at %s",id,strName,strMoney,date); strSql.Format("INSERT INTO change ([des]) VALUES('%s')",strResult); char* pSql=strSql.GetBuffer(); char* err_msg; // Create a prepared statement. sqlite3_exec(conn, pSql, 0, 0, &err_msg); }