本文整理汇总了C++中FXString::text方法的典型用法代码示例。如果您正苦于以下问题:C++ FXString::text方法的具体用法?C++ FXString::text怎么用?C++ FXString::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FXString
的用法示例。
在下文中一共展示了FXString::text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
long
MembersFrame::onApplyChanges(FXObject*,FXSelector,void*)
{
FXFoldingItem *mitem = memberslist->findItemByData((void*)editedmember);
FXString newname = nametf->getText();
FXString newlogin = logintf->getText();
if (mitem) {
newname.trim();
newlogin.trim();
CCL_member_tarif_set(editedmember,tarifset);
if (!newname.empty() && -1 == CCL_member_find(newname.text()))
CCL_member_name_set(editedmember,nametf->getText().text());
CCL_member_email_set(editedmember,emailtf->getText().text());
CCL_member_other_set(editedmember,phonetf->getText().text());
if (newlogin.empty() && CCL_data_key_exists(CCL_DATA_MEMBER,editedmember,
"login_name"))
CCL_data_key_delete(CCL_DATA_MEMBER,editedmember,"login_name");
else if (-1 == CCL_data_find_by_key_sval(CCL_DATA_MEMBER,"login_name",
newlogin.text()))
CCL_data_set_string(CCL_DATA_MEMBER,editedmember,"login_name",
newlogin.text());
mitem->setText(FXStringVal((FXint)editedmember) + "\t" + CCL_member_name_get(editedmember));
memberslist->updateItem(mitem);
}
#ifdef DEBUG
printf("onApplyChanges(): Apply Changes Button was pressed\n");
#endif
return 1;
}
示例2: getSUMOTime
long
GNETLSEditorFrame::onCmdPhaseEdit(FXObject*, FXSelector, void* ptr) {
/* @note: there is a bug when copying/pasting rows: when this handler is
* called the value of the cell is not yet updated. This means you have to
* click inside the cell and hit enter to actually update the value */
FXTablePos* tp = (FXTablePos*)ptr;
FXString value = myPhaseTable->getItemText(tp->row, tp->col);
if (tp->col == 0) {
// duration edited
if (GNEAttributeCarrier::canParse<SUMOReal>(value.text())) {
SUMOTime duration = getSUMOTime(value);
if (duration > 0) {
myEditedDef->getLogic()->setPhaseDuration(tp->row, duration);
myHaveModifications = true;
updateCycleDuration();
return 1;
}
}
// input error, reset value
myPhaseTable->setItemText(tp->row, 0, toString(STEPS2TIME(getPhases()[tp->row].duration)).c_str());
} else {
// state edited
try {
// insert phase with new step and delete the old phase
myEditedDef->getLogic()->addStep(getPhases()[tp->row].duration, value.text(), tp->row);
myEditedDef->getLogic()->deletePhase(tp->row + 1);
myHaveModifications = true;
onCmdPhaseSwitch(0, 0, 0);
} catch (ProcessError) {
// input error, reset value
myPhaseTable->setItemText(tp->row, 1, getPhases()[tp->row].state.c_str());
}
}
return 1;
}
示例3: ctrl_open_input
void InputThread::ctrl_open_input(const FXString & uri) {
GM_DEBUG_PRINT("[input] ctrl_open_input %s\n",uri.text());
if (uri.empty()) {
goto failed;
}
/// Open Input
input=open_input(uri);
if (input==NULL) {
engine->post(new ErrorMessage(FXString::value("Unable to open %s",uri.text())));
goto failed;
}
reader = open_reader();
if (reader==NULL) {
engine->post(new ErrorMessage(FXString::value("No input plugin available for %s",uri.text())));
goto failed;
}
if (!reader->init(input)) {
engine->post(new ErrorMessage(FXString::value("Failed to initialize plugin")));
goto failed;
}
streamid++;
set_state(StateProcessing,true);
return;
failed:
ctrl_close_input();
set_state(StateIdle,true);
}
示例4: open
// Open directory to path, return true if ok.
FXbool FXDir::open(const FXString& path){
if(!path.empty()){
#ifdef WIN32
#ifdef UNICODE
FXnchar buffer[MAXPATHLEN];
utf2ncs(buffer,MAXPATHLEN,path.text(),path.length()+1);
wcsncat(buffer,TEXT("\\*"),MAXPATHLEN);
#else
FXchar buffer[MAXPATHLEN];
strncpy(buffer,path.text(),MAXPATHLEN);
strncat(buffer,"\\*",MAXPATHLEN);
#endif
((SPACE*)space)->handle=FindFirstFile(buffer,&((SPACE*)space)->result);
if(((SPACE*)space)->handle!=INVALID_HANDLE_VALUE){
((SPACE*)space)->first=true;
return true;
}
#else
((SPACE*)space)->handle=opendir(path.text());
if(((SPACE*)space)->handle!=NULL){
return true;
}
#endif
}
return false;
}
示例5: FixupShortcuts
/*
Fox doesn't automatically handle MS-Windows shortcut files, so...
Iterate through each filename in the file dialog's getFilenames() list,
if any of them are shortcut (*.lnk) files, dereference the link and
make the string point to the "real" disk file. If we have multiple files,
remove any links that point to a directory. But if we only have one string
in the list, and the string is a link pointing to a directory, we will
dereference it so the dialog can change into that folder.
*/
static void FixupShortcuts(FXWindow*w, FXString* filenames)
{
if (!filenames) return;
FXString* fn;
FXString* tail=filenames;
FXuint count=0;
for (fn=filenames; !fn->empty(); fn++) {
if (IsLinkExt(*fn)) {
char*tmp=NULL;
if (ReadShortcut(&tmp, fn->text())) {
*fn=tmp;
} else {
FXMessageBox::error(w,MBOX_OK,_("Error in shortcut"),"%s\n%s",fn->text(),tmp);
}
free(tmp);
}
tail=fn;
count++;
}
if (count>1) {
for (fn=filenames; !fn->empty(); fn++) {
if (FXStat::isDirectory(*fn)) {
*fn=tail->text();
*tail="";
tail--;
}
}
}
}
示例6: getUserDirectory
// Get home directory for a given user
FXString FXSystem::getUserDirectory(const FXString& user){
#ifndef WIN32
#if defined(FOX_THREAD_SAFE) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
struct passwd pwdresult,*pwd;
char buffer[1024];
if(user.empty()){
register const FXchar* str;
if((str=getenv("HOME"))!=NULL) return str;
if((str=getenv("USER"))!=NULL || (str=getenv("LOGNAME"))!=NULL){
if(getpwnam_r(str,&pwdresult,buffer,sizeof(buffer),&pwd)==0 && pwd) return pwd->pw_dir;
}
if(getpwuid_r(getuid(),&pwdresult,buffer,sizeof(buffer),&pwd)==0 && pwd) return pwd->pw_dir;
return PATHSEPSTRING;
}
if(getpwnam_r(user.text(),&pwdresult,buffer,sizeof(buffer),&pwd)==0 && pwd) return pwd->pw_dir;
return PATHSEPSTRING;
#else
register struct passwd *pwd;
if(user.empty()){
register const FXchar* str;
if((str=getenv("HOME"))!=NULL) return str;
if((str=getenv("USER"))!=NULL || (str=getenv("LOGNAME"))!=NULL){
if((pwd=getpwnam(str))!=NULL) return pwd->pw_dir;
}
if((pwd=getpwuid(getuid()))!=NULL) return pwd->pw_dir;
return PATHSEPSTRING;
}
if((pwd=getpwnam(user.text()))!=NULL) return pwd->pw_dir;
return PATHSEPSTRING;
#endif
#else
if(user.empty()){
register const FXchar *str1,*str2;
FXchar home[MAXPATHLEN];
DWORD size=MAXPATHLEN;
HKEY hKey;
LONG result;
if((str1=getenv("USERPROFILE"))!=NULL) return str1; // Daniël Hörchner <[email protected]>
if((str1=getenv("HOME"))!=NULL) return str1;
if((str2=getenv("HOMEPATH"))!=NULL){ // This should be good for WinNT, Win2K according to MSDN
if((str1=getenv("HOMEDRIVE"))==NULL) str1="c:";
strncpy(home,str1,MAXPATHLEN);
strncat(home,str2,MAXPATHLEN);
return home;
}
// FXchar buffer[MAX_PATH]
// if(SHGetFolderPath(NULL,CSIDL_PERSONAL|CSIDL_FLAG_CREATE,NULL,O,buffer)==S_OK){
// return buffer;
// }
if(RegOpenKeyExA(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",0,KEY_READ,&hKey)==ERROR_SUCCESS){
result=RegQueryValueExA(hKey,"Personal",NULL,NULL,(LPBYTE)home,&size); // Change "Personal" to "Desktop" if you want...
RegCloseKey(hKey);
if(result==ERROR_SUCCESS) return home;
}
return "c:" PATHSEPSTRING;
}
return "c:" PATHSEPSTRING;
#endif
}
示例7: copyfile
// Copy ordinary file
static FXbool copyfile (const FXString & oldfile, const FXString & newfile, thread_elem * te)
{
unsigned char buffer[4096];
struct stat status;
long nread, nwritten;
int src, dst;
FXbool ok = FALSE;
if ((src = open (oldfile.text (), O_RDONLY)) >= 0)
{
if (::stat (oldfile.text (), &status) == 0)
{
te->act_file_name = oldfile.text ();
te->act_file_size = 1;
te->file_size = status.st_size;
if ((dst = open (newfile.text (), O_WRONLY | O_CREAT | O_TRUNC, status.st_mode)) >= 0)
{
while (1)
{
nread = fullread (src, buffer, sizeof (buffer));
if (nread < 0)
goto err;
if (nread == 0)
break;
if (te->cancel == true)
{
fxmessage ("CANCEL CANCEL CANCEL CANCEL !!!\n\n\n\n\n");
close (dst);
close (src);
return FALSE;
}
te->act_file_size += nread;
te->act_total_size += nread;
nwritten = fullwrite (dst, buffer, nread);
if (nwritten < 0)
goto err;
}
ok = TRUE;
err:close (dst);
}
}
close (src);
}
return ok;
}
示例8: identical
// Return true if files are identical
// Compare file names and inodes for case insensitive filesystems
FXbool identical(const FXString& file1,const FXString& file2)
{
if(file1!=file2)
{
struct stat linfo1, linfo2;
return !::lstatrep(file1.text(),&linfo1) && !::lstatrep(file2.text(),&linfo2) && linfo1.st_ino==linfo2.st_ino && linfo1.st_dev==linfo2.st_dev;
}
return TRUE;
}
示例9: InsertFile
bool SciDocUtils::InsertFile(SciDoc *sci, const FXString &filename)
{
if (sci->InsertFile(filename.text())) {
sci->ScrollWrappedInsert();
return true;
} else {
FXMessageBox::error(sci->getShell(), MBOX_OK, _("Error opening file"), "%s:\n%s\n%s",
_("Could not open file"), filename.text(), sci->GetLastError().text());
}
return false;
}
示例10: getEnvironment
// Return value of environment variable name
FXString FXSystem::getEnvironment(const FXString& name){
if(!name.empty()){
#ifndef WIN32
return FXString(getenv(name.text()));
#else
FXchar value[1024];
DWORD len=GetEnvironmentVariableA(name.text(),value,1024);
return FXString(value,len);
#endif
}
return FXString::null;
}
示例11: buscarSIM
tDato FXTabSim::buscarSIM(char *id) {
FXint i, j, num, fin;
FXString nomTipo;
FXString strAux;
FXint *tipo;
FXchar clave[20];
j = tope;
while ( j > 0 ) {
// Los parametros formales NO sirven
fin = 0;
do {
strAux = getItemText(j, COL_TIPOTS);
if ( strcmp(strAux.text(), "PAR_FORMAL") != 0 )
fin = 1;
else
j--;
} while ( fin == 0 );
strAux = getItemText(j, COL_LEXEMA);
if ( strcmp(strAux.text(), id) == 0 ) {
nomTipo = getItemText(j, COL_TDATO);
for ( i = 0
; strcmp(nomTipo.text(), nomTiposDato[i]) != 0
; i++ );
printf("Encontrado %s tipo: %d\n", id, i);
// Seleccionamos el item encontrado en la TS
setSelTextColor(colores[SIM_FG]);
setSelBackColor(colores[SIM_BG]);
// selectRange(j, j, COL_LEXEMA, COL_TDATO);
selectRange(j, j, COL_LEXEMA, COL_ETQ_ELSE);
itemSelMin = j;
itemSelMax = j+1;
return (tDato)i;
} else {
j--;
}
}
return DESC;
}
示例12: SetKeywordList
void SetKeywordList(LangStyle*lang, int index, const FXString &keywords)
{
FXuint flag=1<<index;
if (!lang) { return; }
if ((index<0)||(index>=KeywordListsCount(lang))) { return; }
if (strcmp(keywords.text(),lang->words[index])==0) { return; }
if ( lang->mallocs & flag ) {
free(lang->words[index]);
lang->words[index]=NULL;
}
lang->words[index]=strdup(keywords.text());
lang->mallocs |= flag;
}
示例13: ReadShortcut
/*
Read the Windows shortcut (*.lnk) file passed in as "filename".
If the filename does not end with the *.lnk extension, returns
true, the filename parameter is unchanged.
If the link cannot be read (e.g. corrupted file) it displays an
error dialog describing the reason for the failure and returns
false, the filename parameter is unchanged.
If reading of the link is successful, it returns true and the
"filename" parameter is modified and will contain the name of
the file that the shortcut points to.
*/
bool FileDlg::ReadShortcut(FXWindow*w, FXString &filename)
{
bool rv=true;
if (IsLinkExt(filename)) {
char*tmp=NULL;
if (::ReadShortcut(&tmp, filename.text())) {
filename=FXPath::simplify(FXPath::absolute(tmp));
} else {
FXMessageBox::error(w,MBOX_OK,_("Error in shortcut"),"%s\n%s",filename.text(),tmp);
rv=false;
}
free(tmp);
}
return rv;
}
示例14: OpenLocalIncludeFile
// Look for file: first in active document's directory; then in current working directory
static bool OpenLocalIncludeFile(SciDoc*sci, const FXString &filename, const FXString &line)
{
if (!sci->Filename().empty()) {
FXString fullpath=FXPath::directory(sci->Filename())+PATHSEPSTRING+filename;
if (FXStat::exists(fullpath)) {
TopWinPub::OpenFile(fullpath.text(),line.text(),false,true);
return true;
}
}
if (FXStat::exists(filename)) {
TopWinPub::OpenFile(filename.text(),line.text(),false,true);
return true;
}
return false;
}
示例15: loadSettings
void GMSourceView::loadSettings(const FXString & key) {
FXbool sort_reverse,view;
sort_reverse = getApp()->reg().readBoolEntry(key.text(),"source-list-sort-reverse",false);
if (sort_reverse)
sourcelist->setSortFunc(source_list_sort_reverse);
else
sourcelist->setSortFunc(source_list_sort);
view = getApp()->reg().readBoolEntry(key.text(),"source-list",true);
if (view)
getParent()->show();
else
getParent()->hide();
}