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 » ArrayCtrl, HeaderCtrl & GridCtrl » whanaction whenarrayaction
whanaction whenarrayaction [message #17685] Mon, 25 August 2008 23:15 Go to next message
TeCNoYoTTa is currently offline  TeCNoYoTTa
Messages: 138
Registered: July 2008
Location: Egypt
Experienced Member

i have a simple question

what i knew from documention is that WhenArrayAction calls the callback when there is row add /deleted / edited

but i did that and added rows but the function never called

but when i used WhenAction ....the function was called but i think it was called more than time for the same row :S :S

here is the code
List_Download.WhenAction = THISBACK(Download_File);


void Download_Manager_Window::Download_File()
{
	PromptOK("called");
	if (Downloading)
		return;//If Function Is Already Working
	else
		Downloading = true;// If Function Not Working Mark it as Working
	if (!List_Download.IsCursor())
	{
		// If No Downloads Was Found To be Done
		Downloading = false;
		return;
	}
	int FileKey = List_Download.Get(0,0);

	//SqlId FILESID = "FILES.ID"; // Id Column in Files Table
	int ItemId; // To know from which Item This File is
	String file_download_path;
	String file_name;
	String file_link;
	SQL*Select(SqlAll()).From(FILES).Where(FILE_ID == FileKey); // Get data of File
	if (SQL.Fetch())
	{
		ItemId = SQL[ITEM_ID];
		file_link = SQL[FILE_LINK];
		file_name = SQL[FILE_NAME];

		SQL*Select(DOWNLOAD_PATH).From(ITEMS,DEFAULT_DOWNLOAD_PATHS).Where((ITEM_ID == ItemId) && (DOWNLOAD_PATHS_SUBJECT_ID == ITEM_SUBJECT) && (DOWNLOAD_PATHS_TYPE_ID == ITEM_TYPE));
		if (SQL.Fetch())
		{
			file_download_path = SQL[DOWNLOAD_PATH];
		}
		else
		{
			int user_click = PromptOKCancel("ERROR : Cannot Find Default Download Path&Click Ok To Set Download Path Manualy&Or Cancel to Cancel Download");
			if (user_click == IDCANCEL)
			{
				PromptOK("return");
				return;
				PromptOK("Strange");
			}
			else
				if (user_click == IDOK)
				{
					FileSel path;
					path.ExecuteSelectDir("Please Select Download Path");
					file_download_path = path.GetFile(0);

				}

		}
	}
	else
	{
		PromptOK("ERROR : Program Can't Find LINK ID in Database !!!!");
		return;
	}
	PromptOK("Downloading");
	client.URL(file_link);
	label_File.SetText(file_name);
	label_DownloadDirectory.SetText(file_download_path);
	//label_DownloadSpeed.SetText("Downloading");
	client.TimeoutMsecs(1000*60*60*60);
	String file_data = client.ExecuteRedirect(HttpClient::DEFAULT_MAX_REDIRECT, HttpClient::DEFAULT_RETRIES,THISBACK(progress_indecator));

	label_DownloadSpeed.SetText("Downloaded");

	RealizePath(file_download_path);
	SaveFile(file_download_path+"\\"+file_name, file_data);

	SQL*SqlUpdate(FILES)(FILE_DOWNLOAD_PATH,file_download_path).Where(FILE_ID == FileKey);

	List_Download.Remove(0);
	Download_File();

}

when i add row

this function shows a message that it returned

but also it completes and show a message that it's downloading

please help me
Re: whanaction whenarrayaction [message #18401 is a reply to message #17685] Fri, 26 September 2008 09:42 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
IMO, the code you have posted is unrelated to the problem.

Mirek
Previous Topic: Hiding in GridCtrl. Special case.
Next Topic: ArrayCtrl: Why editing row still needs Ctrl+Enter?
Goto Forum:
  


Current Time: Sun Apr 28 04:24:40 CEST 2024

Total time taken to generate the page: 0.89694 seconds