![]() |
Property Grid. Getting direct access to controls |
Post Reply ![]() |
Author | |||||
Tomas ![]() Newbie ![]() ![]() Joined: 21 July 2006 Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() Posted: 24 July 2006 at 5:28pm |
||||
|
|||||
![]() |
|||||
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
||||
Hi,
It is not possible :(
|
|||||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||||
![]() |
|||||
Tomas ![]() Newbie ![]() ![]() Joined: 21 July 2006 Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() |
||||
However I notice that in one of your examples exhibits this desirable behavior.
The example name is "Property Grid Sample". Ones running you can
check in the grid under the "Dynamic options". There the bool item
is able to be toggle without the need of selecting the it first. Which contrast
with the other type of bool found under: "Standard Items" which you
need to click 3 times to make a change. |
|||||
![]() |
|||||
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
||||
:) Added to wish list for 10.4.
|
|||||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||||
![]() |
|||||
Tomas ![]() Newbie ![]() ![]() Joined: 21 July 2006 Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() |
||||
Ho man 10.4 and in a wish list? That doesn't sound very promissing... ![]() Tomas |
|||||
![]() |
|||||
Tomasz ![]() Senior Member ![]() Joined: 05 August 2006 Status: Offline Points: 109 |
![]() ![]() ![]() ![]() ![]() |
||||
I place my vote for this too!
2+ clicks or more for changing property value is way too much for user-friendly application. My customers are complaining about having to click twice.
So please, pretty please with sugar on top, give us an option for one-click property change.
|
|||||
![]() |
|||||
JohnCrenshaw ![]() Groupie ![]() ![]() Joined: 08 September 2006 Status: Offline Points: 65 |
![]() ![]() ![]() ![]() ![]() |
||||
Are you sure? C'mon, you don't strike me as a defeatist
![]() There is a function CXTPPropertyGridItem::SetFocusToInplaceControl() that is designed for setting this editable state.
Inside CXTPPropertyGrid::OnNavigate() we find this snippet, suggesting that the item must be selected prior to focusing the control but I havn't checked this for sure.
Finally, the CXTPPropertyGrid class has the following function declaration:
To get what you want, declare a new class based on the grid, then override the selection changed function. Call SetFocusToInplaceControl() for the control recieving the focus in the override. I make this call AFTER calling the base OnSelectionChanged() since it is for the user's convenience only. See the following snippet:
This is probably incomplete, for example, you may want to do something similar when the control is activated. Also, the edit control is fully highlighted at this point. This may or may not be the behavior you want but can be fixed.
This is the code responsible for highlighting everything:
Since the above is a virtual function, you can change the behavior on a case by case basis.
Hope this helps!
|
|||||
![]() |
|||||
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
||||
btw.. In 10.4 added property to show all inplace buttons.
|
|||||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||||
![]() |
|||||
Tomas ![]() Newbie ![]() ![]() Joined: 21 July 2006 Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() |
||||
That is a cool first step. What I really need to display are ALL the buttons not just the in-place buttons. That means that things like the sliders (User controls) and such should display as well. This is very important for us. As the user can be tweaking their properties and they don’t want to be selecting them first. Do you think it will be a hard feature to add for you guys? Tomas |
|||||
![]() |
|||||
Tomas ![]() Newbie ![]() ![]() Joined: 21 July 2006 Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() |
||||
In 10.4.2 ones you are drawing your own grid using XTP_PGS_OWNERDRAW the inplace buttons don't show any more.
|
|||||
![]() |
|||||
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
||||
Hello, Yes, buttons now drawn in Drawitem method. Add this call:
if (bSelected || m_pGrid->GetShowInplaceButtonsAlways()) pPaintManager->DrawInplaceButtons(&dc, pItem, rcValue);
|
|||||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||||
![]() |
|||||
Tomas ![]() Newbie ![]() ![]() Joined: 21 July 2006 Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() |
||||
DrawInplaceButtons is a protected member of CXTPPropertyGridPaintManager so I dont have access to it. Do you have an example of this?
|
|||||
![]() |
|||||
JohnCrenshaw ![]() Groupie ![]() ![]() Joined: 08 September 2006 Status: Offline Points: 65 |
![]() ![]() ![]() ![]() ![]() |
||||
When I have a problem like this, where a member is protected that ought not be, I cheat. Derived classes can access protected members so I create a derived class with a static "access" function that takes a pointer to the other class and the parameters. For example:
class CSomeHelper : publid CClassWithStupidProtectedMember
{
public:
static int DoProtectedFunction(CClassWithStupidProtectedMember* p, UINT param)
{
return ((CSomeHelper*)p)->ProtectedFunction(param);
}
};
Then, in places where I really am sure that I should call the protected function, and have the right to, I can do so via CSomeHelper::DoProtectedFunction(p, param);
This is technically bad, but it is a lot more clean than changing the protected status of things or adding a friend. If you change the CodeJock code, then when the next update comes out, your program breaks. If you use my nasty hack,
![]() ![]() The way I see it, this hack is far from clean code, but it is much cleaner and maintainable than any alternative.
|
|||||
![]() |
|||||
Tomas ![]() Newbie ![]() ![]() Joined: 21 July 2006 Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() |
||||
Thanks you so much guys. The new property system rocks!!!
|
|||||
![]() |
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 |