Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » LineEdit, EditFields, DocEdit » DocEdit call RemoveLines make Assertion failed.
icon9.gif  DocEdit call RemoveLines make Assertion failed. [message #14358] Sat, 23 February 2008 17:17 Go to previous message
HenryXin is currently offline  HenryXin
Messages: 10
Registered: February 2008
Promising Member
Hi,
I am a newbie about upp. I inherit from DocEdit to display this filesystem content, insert filenames, when beyond 200 line, remove lines as following:

#define MAX_CACHE_LINE 200
class MyDocEdit : public DocEdit
{
String inputString;
static String tipString;
String dir;
public:
virtual bool Key(dword key, int count);
MyDocEdit()
{
ShowTip();
}
void ShowTip();
int RunCommand(String user_input);
};

String MyDocEdit::tipString(">");
void MyDocEdit::ShowTip()
{
dir = GetCurrentDirectory();
Insert(cursor, dir+tipString);
this->SetCursor(cursor+(dir+tipString).GetLength());
inputString.Clear();
}

bool MyDocEdit::Key(dword key, int count)
{
switch(key & ~(K_CTRL | K_ALT | K_SHIFT)) {
case K_ENTER:
RunCommand(inputString);
inputString.Clear();
if(this->GetLineCount() > MAX_CACHE_LINE) {

this->RemoveLines(0, this->GetLineCount() - MAX_CACHE_LINE);
ClearLines();
sprintf(str, "%d %d", this->GetLineCount(), (this->GetLineCount() - MAX_CACHE_LINE));
}
ShowTip();

return true;
default:
if(!(key & 0x10000) && !(key & 0x110000)) {
inputString +=(char)key;
}
break;
}

return DocEdit::Key(key, count);
}

int MyDocEdit::RunCommand(String user_input)
{
FindFile ff;
Insert(GetCursor(), "\n");
cursor++;
if(!ff.Search(AppendFileName(dir, "*")))
return false;
do {

Insert(GetCursor(), ff.GetName()+"\n");

SetCursor(GetCursor()+ff.GetName().GetLength()+1);
}
while(ff.Next());
return 0;
}

When lines are beyond 200, Assert failed in C:\upp\uppsrc\CtrlLib\DocEdit.cpp, line 25
this->line.GetCount() == para.GetCount().

I don't find the reason now.
Thanks.

[Updated on: Sat, 23 February 2008 17:20]

Report message to a moderator

 
Read Message icon9.gif
Read Message icon7.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon14.gif
Previous Topic: Best way to implement a two-way LineEdit
Next Topic: Enter time as duration
Goto Forum:
  


Current Time: Fri Mar 29 11:48:51 CET 2024

Total time taken to generate the page: 0.01183 seconds