Hi,
im trying to create a image editor and Im currently working on a "history/reopen" image part in my menu.
ive read loads into dynamicly creating menu items but have always failed when it has come to adding a function to it, but that is a differnt story all together (maybe a different thread ;))
well currently what i have is working, and my program opens up a "history" file and reads the last 5 images opend and adds them to the menu list. they all open well through this.
my problem comes when i use the my normal open function. the openpicturedialog seems to "kill" my loadfromfile and it cant read from the history text file.
This is my open image code (ive removed some parts due to length, but this is the "guts")
if(!OpenPictureDialog1->Execute()) return;
AnsiString FilePath = OpenPictureDialog1->FileName;
AnsiString FileType = ExtractFileExt(FilePath);
AnsiString FileLoc = ExtractFileDir(FilePath);
AnsiString FileName = ExtractFileName(FilePath);
if(FileType.LowerCase() == ".jpg")
{
TJPEGImage *jpgImage = new TJPEGImage();
jpgImage->LoadFromFile(FilePath);
jpgImage->DIBNeeded(); // Decompress to Device Indepandant Bitmap
BackBuffer->Assign(jpgImage); // Deep copy
delete jpgImage;
img_mainimg->Picture->Bitmap->Assign(BackBuffer);
img_mainimg->Width = img_mainimg->Picture->Width;
img_mainimg->Height = img_mainimg->Picture->Height;
AddFileDetails = true;
}
else
if(FileType.LowerCase() == ".bmp")
{
BackBuffer->LoadFromFile(FilePath);
img_mainimg->Picture->Bitmap->Assign(BackBuffer);
img_mainimg->Width = img_mainimg->Picture->Bitmap->Width;
img_mainimg->Height = img_mainimg->Picture->Bitmap->Height;
AddFileDetails = true;
};
this is my reopen code
TMemo *mem_RecentFiles = new TMemo(this);//creates a new memo to store file names
mem_RecentFiles->Visible = false;
mem_RecentFiles->Parent = this;
mem_RecentFiles->ScrollBars = ssHorizontal;
History();
mem_RecentFiles->Lines->LoadFromFile("history.pix");
AnsiString File = mem_RecentFiles->Lines->operator [](1);
PFileHandles.FileReopen(File, img_mainimg, BackBuffer, PImgFileData, ImageArray, OriginalArray, imgcount);
Caption = PROGRAM_TITLE + " " + PROGRAM_VERSION + " - " + PImgFileData[imgcount].F_Name;
its on the LoadFromFile where my problem then starts to occur - it acts as if nothing is in the history file.
ive attached a zip file of all the full code if anyone could care to have alook since ive spent hours commenting things out to investigate and have come down to somthing with the opendialog interfears with the loadfile stream after its been opend.