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 » Newbie question: ArrayCtrl::IsModified(int ii) not work at expected.
Newbie question: ArrayCtrl::IsModified(int ii) not work at expected. [message #31555] Mon, 14 March 2011 06:07 Go to next message
Lance is currently offline  Lance
Messages: 347
Registered: March 2007
Senior Member
I need to keep track of the edit status of the current row in a ArrayCtrl. I connected a callback to its WhenUpdateRow event.

void TransactionCtrl::TransactionUpdateRow()
{

	int i;
	if(trans.IsCursor() )
	{
		i=trans.GetCursor();
		msgs.Insert(-1, String().Cat()<<"Cursor at "<<i<<"\n");
	}else
		return;
	if( trans.IsModified(i))
	{
		changed=true;
		msgs.Insert(-1, "MODIFIED - IN Update Row\n");
	}
}


It never worked as I had expected. By the way, the column I tested is using
trans.AddColumn("Name").Edit(AnEditStringObject);


Any idea?

Thanks,

Lance
Re: Newbie question: ArrayCtrl::IsModified(int ii) not work at expected. [message #31557 is a reply to message #31555] Mon, 14 March 2011 06:45 Go to previous messageGo to next message
Lance is currently offline  Lance
Messages: 347
Registered: March 2007
Senior Member
Not actually related, I just saw this code in Callback.cpp

bool Gate::Execute() const
{
	return (void *)action == (void *)1 ? true : action ? action->Execute() : false;
}


Would something like this be overly smart ? Smile

bool Gate::Execute() const
{
    return (void *)action<(void*)2? (void*)action==(void*)1 :action->Execute();
}
    // or even
    //return (void *)action<(void*)2 ? (bool)action : action->Execute();
}



[Updated on: Mon, 14 March 2011 06:46]

Report message to a moderator

Re: Newbie question: ArrayCtrl::IsModified(int ii) not work at expected. [message #31561 is a reply to message #31557] Mon, 14 March 2011 14:43 Go to previous messageGo to next message
Lance is currently offline  Lance
Messages: 347
Registered: March 2007
Senior Member
U++ is a great product but it seems not many people are using it.

Anyway, for now, I will just do without using library built-in edit status tracking facilities (which is a great idea), but compare with an original copy regardless. Good thing is U++ is fast enough to afford this waste.

Re: Newbie question: ArrayCtrl::IsModified(int ii) not work at expected. [message #31566 is a reply to message #31561] Mon, 14 March 2011 22:51 Go to previous messageGo to next message
Lance is currently offline  Lance
Messages: 347
Registered: March 2007
Senior Member
Chatting:

U++ is great. The more I use it, the more I like it. It's from C++ programmers and for C++ programmers.

I just learned how to view logfile which demonstrates the power of the DUMP macro. This should be pointed out to new comers of Upp in some of the tutorial or introduction. It's very handy!

BTW: I miss the BLOCK COMMENT function, doesn't TheIDE provide something like that?
Re: Newbie question: ArrayCtrl::IsModified(int ii) not work at expected. [message #31568 is a reply to message #31566] Tue, 15 March 2011 02:17 Go to previous messageGo to next message
Lance is currently offline  Lance
Messages: 347
Registered: March 2007
Senior Member

I just spend couple of hours to find out how to set value for newly insert rows in ArrayCtrl. It's through the Column class' InsertVal method. You specify a fixed Value or a generator.
Re: Newbie question: ArrayCtrl::IsModified(int ii) not work at expected. [message #31652 is a reply to message #31555] Fri, 18 March 2011 20:40 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12096
Registered: November 2005
Ultimate Member
Lance wrote on Mon, 14 March 2011 01:07

I need to keep track of the edit status of the current row in a ArrayCtrl. I connected a callback to its WhenUpdateRow event.

void TransactionCtrl::TransactionUpdateRow()
{

	int i;
	if(trans.IsCursor() )
	{
		i=trans.GetCursor();
		msgs.Insert(-1, String().Cat()<<"Cursor at "<<i<<"\n");
	}else
		return;
	if( trans.IsModified(i))
	{
		changed=true;
		msgs.Insert(-1, "MODIFIED - IN Update Row\n");
	}
}


It never worked as I had expected.

Lance


Well, I know for sure it works. So I guess something else is wrong; hard to say without seeing more of your code.
Re: Newbie question: ArrayCtrl::IsModified(int ii) not work at expected. [message #31666 is a reply to message #31652] Sat, 19 March 2011 03:14 Go to previous message
Lance is currently offline  Lance
Messages: 347
Registered: March 2007
Senior Member
Thank you, Mirek.

OK. I'll try it again sometime.

so when any cell in a row row_index is Edited, the ArrayCtrl's IsModified(row_index) will return true. Am I right?

By the way, how to clear the Modified flag for the row after saving?
Previous Topic: Wrapping text in ArrayCtrl cells
Next Topic: GridCtrl questions
Goto Forum:
  


Current Time: Tue Nov 12 01:48:43 CET 2019

Total time taken to generate the page: 0.01595 seconds