focus in wxGrid cell Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
michel
In need of some credit
In need of some credit
Posts: 4
Joined: Fri Jun 20, 2008 9:45 am

focus in wxGrid cell

Post by michel » Fri Jun 20, 2008 10:09 am

Hello,

I have the following trouble :

In a dialogbox , when I edit a cell in a wxGrid and then clic a button, the button handler is not called.

After code analysing, I found that when button try to get the focus, it sent a KillFocus to the the control text, but unfortunality, a SetFocus is called to the grid. (see wxGrid::HideCellEditControl()

I guess that why the button does not have the focus and command notification is not sent to the dialog ...

does anybody know a workaround for this issue?

Thanks

Michel

bloodlee
Experienced Solver
Experienced Solver
Posts: 77
Joined: Thu Nov 30, 2006 10:49 am
Location: Shenzhen, CHN

Post by bloodlee » Wed Jun 25, 2008 9:34 am

Do you mean you click the button during you are editing the cell?

It's better to post your code maybe. :)

michel
In need of some credit
In need of some credit
Posts: 4
Joined: Fri Jun 20, 2008 9:45 am

Post by michel » Wed Jun 25, 2008 12:55 pm

Yes it is correct : clic button when a cell is currently edited.

I have attached an example.

Michel
Attachments
test_gridMain.h
(1021 Bytes) Downloaded 20 times
test_gridMain.cpp
(2 KiB) Downloaded 34 times

bloodlee
Experienced Solver
Experienced Solver
Posts: 77
Joined: Thu Nov 30, 2006 10:49 am
Location: Shenzhen, CHN

Post by bloodlee » Thu Jun 26, 2008 6:18 am

Hi, michel.
Your code is quite clear, and I've read and compiled it on my machine. But I think the behavior is reasonable.

When I am editing a cell, I click the button. I think the mouse event will be sent to that cell editor. So then the editor hide. And if you click the "Close" button again, the mouse event will be sent to the dialog you defined, so your handler function will be called.

If you readlly think this behavior is un-acceptable, you can try to write your own cell editor.

Regards.

michel
In need of some credit
In need of some credit
Posts: 4
Joined: Fri Jun 20, 2008 9:45 am

Post by michel » Fri Jun 27, 2008 9:33 am

Hello bloodlee,

The behavior is not correct : when user click on a button , the associated action must be called !

I will search a way to force the call...

Michel

JeffD
In need of some credit
In need of some credit
Posts: 5
Joined: Sat Aug 01, 2009 2:51 pm

Post by JeffD » Sat Aug 01, 2009 3:12 pm

Hi Michel,

I also believe that this behavior is not correct. By the way if the user selects a menu item or a toolbar item it works. Have you come up with a workaround?

Thanks,

Jeff Downs

JeffD
In need of some credit
In need of some credit
Posts: 5
Joined: Sat Aug 01, 2009 2:51 pm

Post by JeffD » Tue Aug 04, 2009 5:58 pm

It looks like this has been fixed in version 2.8.9 of wxWidgets.

wxWidgets 2.8.9 changes
----------------------------------------

- wxGrid doesn't steal focus when hiding editor any more (Tom Eckert).


I just upgraded from 2.8.4 to 2.8.10 and it is now working correctly.

Thanks

Post Reply