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 » Selection changes before LostFocus() is called
icon5.gif  Selection changes before LostFocus() is called [message #13226] Sun, 23 December 2007 19:12 Go to next message
loki is currently offline  loki
Messages: 36
Registered: October 2007
Member
Hello.

Situation:
- ArrayCtrl <-- No Focus
- LineEdit <-- Has Focus

Now selecting an other row in the ArrayCtrl results in changing the selection before LineEdit::LostFocus() is called.

Is this normal behaviour?

Using a TreeCtrl LineEdit::LostFocus() is called before the selection changes.

Testcase will follow...

greetings
loki
Re: Selection changes before LostFocus() is called [message #13227 is a reply to message #13226] Sun, 23 December 2007 19:28 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
loki wrote on Sun, 23 December 2007 13:12

Hello.

Situation:
- ArrayCtrl <-- No Focus
- LineEdit <-- Has Focus

Now selecting an other row in the ArrayCtrl results in changing the selection before LineEdit::LostFocus() is called.

Is this normal behaviour?

Using a TreeCtrl LineEdit::LostFocus() is called before the selection changes.

Testcase will follow...

greetings
loki


LostFocus is invoked by CtrlCore, it is very unlikely (alhough not impossible) that it would behave differently for different derived classes...

Mirek
Re: Selection changes before LostFocus() is called [message #13230 is a reply to message #13226] Sun, 23 December 2007 22:16 Go to previous messageGo to next message
loki is currently offline  loki
Messages: 36
Registered: October 2007
Member
Ok. For me it looks logical that LostFocus() should get called before any other changes are done.(In my situation the selectionchange resets the LineEdit before I could save the data.)

I will look up the source later (for now a mousehook will do it) and check if I could change it for ArrayCtrl. Or are there points against this?

greetings and happy xmas
loki
Re: Selection changes before LostFocus() is called [message #13234 is a reply to message #13226] Mon, 24 December 2007 00:32 Go to previous messageGo to next message
loki is currently offline  loki
Messages: 36
Registered: October 2007
Member
Yeah. I am getting better. Very Happy

This one should fix it. But please have a look on it.

void ArrayCtrl::DoPoint(Point p, bool dosel) {
	if(!HasFocusDeep())
		SetWantFocus();
	
	p.y += sb;
	if(p.y >= GetTotalCy() && IsAppendLine())
		KillCursor();
	clickpos.y = GetLineAt(p.y);
	if(!IsNull(clickpos.y))
		SetCursor0(clickpos.y, dosel);
	else
	if(IsCursor())
		AcceptRow();
}


Tomorrow I will check the one when in RowEdit-Mode.

greetings
loki

[Updated on: Mon, 24 December 2007 00:37]

Report message to a moderator

Re: Selection changes before LostFocus() is called [message #13255 is a reply to message #13234] Wed, 26 December 2007 11:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
loki wrote on Sun, 23 December 2007 18:32

Yeah. I am getting better. Very Happy

This one should fix it. But please have a look on it.

void ArrayCtrl::DoPoint(Point p, bool dosel) {
	if(!HasFocusDeep())
		SetWantFocus();
	
	p.y += sb;
	if(p.y >= GetTotalCy() && IsAppendLine())
		KillCursor();
	clickpos.y = GetLineAt(p.y);
	if(!IsNull(clickpos.y))
		SetCursor0(clickpos.y, dosel);
	else
	if(IsCursor())
		AcceptRow();
}


Tomorrow I will check the one when in RowEdit-Mode.

greetings
loki


Well, you are right that the behaviour should be consistent.

The problem is that SetWantFocus was moved from the place you suggest to the end of DoPoint in 2005.

The motivation in ArrayCtrl is that sometimes you want to know the previous focus placement when doing WhenSel.

Therefore, maybe, we should rather fix TreeCtrl(?)

Mirek
Re: Selection changes before LostFocus() is called [message #13264 is a reply to message #13255] Wed, 26 December 2007 21:02 Go to previous message
loki is currently offline  loki
Messages: 36
Registered: October 2007
Member
Quote:

The motivation in ArrayCtrl is that sometimes you want to know the previous focus placement when doing WhenSel.

Therefore, maybe, we should rather fix TreeCtrl(?)


This shows me that thinking twice is better...
I agree. It's better to have the option to find out the previous focus. For my problem mouse- and keyhook will work.

I will check the TreeCtrl next weekend.

greetings
loki
Previous Topic: mouse-event on arrayctrl-header
Next Topic: ArrayCtrl sorting
Goto Forum:
  


Current Time: Thu Mar 28 09:09:58 CET 2024

Total time taken to generate the page: 0.01309 seconds