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 » FileSel&FileList, Path » Problem with FileSel called from menu
Problem with FileSel called from menu [message #19775] Fri, 16 January 2009 22:06 Go to next message
sbtilden is currently offline  sbtilden
Messages: 1
Registered: January 2009
Location: U of Arizona
Junior Member
I am new to UPP and so far my experience has been very positive; I am currently working on a scientific application to display complex scientific data and perform complex data manipulations such as wavelet lifting on the data. However I am working on a 'bug' (probably a logic error on my part) that I can't seem to solve. I use FileSel initially to select a data file for processing and everything works okay. The application displays the data on a Drawing object and so far so good. I have several menu applications (wavelet lifting; invwavelet lift; printing data graph...etc) that properly manipulate the data and I must say the UPP Vector and BiVector objects work very fast indeed. I can do the complete wavelet lifting on a 65536 pt double float data set in under a second. However, I have a menu option to read in another data file and when I do that it crashes (panic ASSERT) the system when processing at line 77 of the Win32Proc.cpp. My suspicion in looking at the Ctrl code being manipulated is that the problem is related somehow to modal loop processing between my core application and the FileSel modal loop. The code snippet is as follows:

FileSel fs;
fs.ActiveDir("C:/Documents and Settings/Scott Tilden/Desktop/");
fs.Type("Data file", "*.dat;");

if(!fs.ExecuteOpen("Choose the data file to import..."))
{

PromptOK("File is already open or does not exist...");
return;

}
String fn = ~fs;
FileIn myfile(fn);
//have a valid file...
int i,val,cnt;
cnt = 0;
bool tst;
while (!myfile.IsEof()){
Vector<String> field = Split(myfile.GetLine(),',');
for (i =0;i<field.GetCount();i++)
{
val = ScanInt(field[i]);
tst = IsNumber(val);
if (!tst)
{
PromptOK("Field containing non-valid number found");

}
else
{
vals.AddTail(val);
wavelet.Add(val);

}
cnt++;
}
//above gets field as string vector...separated by comma
}

Please note that the code works fine for the initial data load but bombs the next time through...any suggestions on what I am doing wrong.

PS - I would be glad to post my complete code when finished since basic scientific data display manipulate, wavelet processing, etc. is probably of interest to some...
Re: Problem with FileSel called from menu [message #19779 is a reply to message #19775] Sat, 17 January 2009 09:58 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Quote:


77 of the Win32Proc.cpp



That ASSERT basically means that you are doing weird stuff in Paint routine. Paint routine should just paint, not e.g. open windows or menus. (That, BTW, is rather Win32 API limitation).

One common bug is to call "PromptOK" in Paint.

Mirek
Re: Problem with FileSel called from menu [message #19780 is a reply to message #19779] Sat, 17 January 2009 10:01 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
BTW, for parsing texts, you can use CParser:

while (!myfile.IsEof()) {
     String l = myfile.GetLine();
     CParser p(l);
     while(!p.IsEof()) {
        double val;
        if(!p.IsNumber()) {
            PromptOK("Field containing non-valid number found");
            return;
        }
        double val = p.ReadDouble();
        vals.AddTail(val);
        wavelet.Add(val);
        p.Char(',');
     }
}

Previous Topic: FileSel and international files problem when getting icon image
Next Topic: FileSel.Type Problem
Goto Forum:
  


Current Time: Thu Mar 28 23:11:45 CET 2024

Total time taken to generate the page: 0.00902 seconds