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 » ArrayCtrl Clear function
ArrayCtrl Clear function [message #17486] Sun, 17 August 2008 14:41 Go to next message
TeCNoYoTTa is currently offline  TeCNoYoTTa
Messages: 138
Registered: July 2008
Location: Egypt
Experienced Member

i have a proplem when my program want to clear array ctrl in a funcion

this is the function

void Two_B_DN::Update_list() {
	list_items.GoEnd();
	client.URL("http://www.cisclub.com/tecno/2BDN/data.xml");
	pro.SetText("Please Wait Loading Data...");
	client.Method(HttpClient::METHOD_GET);
	client.AddHeaders("Cache-Control: max-age=0\r\n");
	String respond = client.Execute(pro);
	//String respond = LoadFile("data.xml");
	my_xml = ParseXML(respond)("root");
	//PromptOK("ana hena");
	list_items.Clear();
	//PromptOK("ana hena");
	for (int i=0;i<my_xml.GetCount();i++) {

		String title = my_xml[i]["title"][0].GetText();
		//PromptOK("ana hena");
		int status_index = StrInt(my_xml[i]["status"][0].GetText());
		int priorty_index =StrInt(my_xml[i]["priorty"][0].GetText());
		int person_index = StrInt(my_xml[i]["person"][0].GetText());
		//PromptOK("ana hena");
		String status = droplist_status.GetValue(status_index);

		String priorty = droplist_priorty.GetValue(priorty_index);
		String person = droplist_persons.GetValue(person_index);
		/*
		PromptOK(title);
		PromptOK(status);
		PromptOK(priorty);
		PromptOK(person);
		*/
		list_items.Add(title,status,priorty,person);

	}
	client.Close();
	pro.Close();
	list_items.SetCursor(0);
}


the first time i call it it works ok but the second time this error appears
http://img504.imageshack.us/img504/91/errorja7.jpg
this error happens

Re: ArrayCtrl Clear function [message #17487 is a reply to message #17486] Sun, 17 August 2008 16:07 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I do not see a problem in the code you have posted.

The error you have encountered is a result of retrieving value (using ArrayCtrl::Get) from *current* row when there is no current row ("IsCursor").

Of course, immediately after Clear there cannot be any cursor... but there is no Get in your code either Wink

Mirek
Re: ArrayCtrl Clear function [message #17490 is a reply to message #17487] Sun, 17 August 2008 21:14 Go to previous messageGo to next message
TeCNoYoTTa is currently offline  TeCNoYoTTa
Messages: 138
Registered: July 2008
Location: Egypt
Experienced Member

may be the error in this code

void Two_B_DN::Send_list() {
	list_items.GoEnd();
	String xmlfile = "<root>";
	PromptOK(IntStr(list_items.GetCount()));
	for (int i=0;i<list_items.GetCount();i++) {
		xmlfile += "<item>";
		xmlfile += AddTag(list_items.Get(i,0).ToString(),"title");
		xmlfile += AddTag(IntStr(droplist_status.Find(list_items.Get(i,1))),"status");
		xmlfile += AddTag(IntStr(droplist_priorty.Find(list_items.Get(i,2))),"priorty");
		xmlfile += AddTag(IntStr(droplist_persons.Find(list_items.Get(i,3))),"person");
		xmlfile += "</item>";
	}
	xmlfile += "</root>";
	//SaveFile("data.xml",xmlfile);
	client.URL("http://www.cisclub.com/tecno/");
	client.Method(HttpClient::METHOD_POST);
	client.AddHeaders("Content-Type: application/x-www-form-urlencoded\r\n");
	HttpQuery message;
	message.SetString("data",xmlfile);
	client.PostData(message.GetQuery(true));
	pro.SetText("please wait ....Sending");
	String respond = client.Execute(pro);
	client.Close();
	pro.Close();
	
	//SaveFile("respond.html",respond);
}

[Updated on: Sun, 17 August 2008 21:15]

Report message to a moderator

Re: ArrayCtrl Clear function [message #17498 is a reply to message #17490] Mon, 18 August 2008 09:44 Go to previous message
TeCNoYoTTa is currently offline  TeCNoYoTTa
Messages: 138
Registered: July 2008
Location: Egypt
Experienced Member

thx .......the proplem was that there is callback that make it crash

i edited the code of the function that is called and now it works fine
Previous Topic: Remove column of arrayCtrl? ok!
Next Topic: empty array ctrl
Goto Forum:
  


Current Time: Sat Apr 27 23:58:08 CEST 2024

Total time taken to generate the page: 0.02417 seconds