Cast in OnGridNotify() method |
Post Reply |
Author | |
Gorkystreet
Newbie Joined: 04 July 2007 Location: Ukraine Status: Offline Points: 6 |
Post Options
Thanks(0)
Posted: 10 July 2007 at 7:42pm |
Hi all,
I encountered the following problem: I created my custom control derived from CXTPPropertyGridItemEnum-class. I use it in grid (use the toolkit ver. 10.3.1). In OnGridNotify() method I need to spy for some events. In appropriate event I have to perform a cast from 'lParam' parameter just like this: CXTPPropertyGridItem* pItem = (CXTPPropertyGridItem*)lParam; But when I look at pItem internals, I can see that some members have wrong values, but it looks like that my object was created successfully in AddChildItem method. In general all my steps on working with grid amd creation/using custom controls are very similar to steps provided in sample 'PropertyGrid' project. What can source similar problem? And how is better to fix/overcome such terrible situation? I can provide additional information if needed. Thanx in advance. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
lParam in OnGridNotify is not always CXTPPropertyGridItem.
you need check wParam first. What wParam you need ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Gorkystreet
Newbie Joined: 04 July 2007 Location: Ukraine Status: Offline Points: 6 |
Post Options
Thanks(0)
|
Hmm, it is very interesting. I use some codes, such as XTP_PGN_EDIT_CHANGED,
XTP_PGN_SELECTION_CHANGED,
XTP_PGN_ITEMVALUE_CHANGED,
can you say to what lParam points for each of these codes,
and for those codes which are defined but not listed here? thank you.
It is possible that I will have to add some more custom codes to work
on grid events. How can I do this? and if I will use this code what object reference will be pointed by lParam?
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
in XTP_PGN_EDIT_CHANGED lParam is
CXTPPropertyGridInplaceEdit* pEdit = DYNAMIC_DOWNCAST(CXTPPropertyGridInplaceEdit, (CWnd*)lParam);
for XTP_PGN_SELECTION_CHANGED, XTP_PGN_ITEMVALUE_CHANGED
CXTPPropertyGridItem* pItem = (CXTPPropertyGridItem*)lParam;
for XTP_PGN_INPLACEBUTTONDOWN
CXTPPropertyGridInplaceButton* pButton = (CXTPPropertyGridInplaceButton*)lParam;
please copy this code from our sample - Samples\PropertyGrid\GridSample\PropertyGridDlg.cpp |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Gorkystreet
Newbie Joined: 04 July 2007 Location: Ukraine Status: Offline Points: 6 |
Post Options
Thanks(0)
|
Thank you Oleg,
this information is right what I need. |
|
Gorkystreet
Newbie Joined: 04 July 2007 Location: Ukraine Status: Offline Points: 6 |
Post Options
Thanks(0)
|
Excuse me Oleg,
I made some additional testing on my custom control and one problem is still having place. As I mentioned it is CXTPPropertyGridItemEnum-derived control with a check-box in it. I need obtain a pointer on it in XTP_PGN_EDIT_CHANGED notif. event. I'm failing the following method: CCustomItemCheckBox* pItem = DYNAMIC_DOWNCAST(CCustomItemCheckBox, (CWnd*)lParam); pItem is NULL in such case. What cast should I perform to obtain the proper pointer? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Just wrote that lParam is CXTPPropertyGridInplaceEdit... You need
CXTPPropertyGridInplaceEdit* pEdit = DYNAMIC_DOWNCAST(CXTPPropertyGridInplaceEdit, (CWnd*)lParam);
CCustomItemCheckBox* pItem = DYNAMIC_DOWNCAST(CCustomItemCheckBox, pEdit ->GetItem());
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Gorkystreet
Newbie Joined: 04 July 2007 Location: Ukraine Status: Offline Points: 6 |
Post Options
Thanks(0)
|
Great!
Oleg, thank you very much!!! Now everything is fine! How do you think - maybe it is worth to include such sample cast into the some sample application with grid in it? I guess it would be very useful for such new toolkit users like me ;) Anyway thanks again! |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |