Update-handler for gallery-items? |
Post Reply |
Author | |
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Posted: 04 April 2009 at 7:16am |
XTP 13.0.0.
I'm trying to enable/disable certain gallery items in an update-handler. I can't get it working.
ON_UPDATE_COMMAND_UI_RANGE(ID_ITEM1, ID_ITEM10, OnUpdateGalleryItems) // Never called!
Can it be done? So far I have only been able to enable/disable the whole gallery... :(
Thanks.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
I solved it!
void CControlGalleryItem::Draw(CDC* pDC, CXTPControlGallery* pGallery, CRect rcItem,
BOOL bEnabled, BOOL bSelected, BOOL bPressed, BOOL bChecked) { CXTPControlGalleryItem::Draw(pDC, pGallery, rcItem, bEnabled && IsEnabled(), bSelected, bPressed, bChecked); } Then I call SetEnabled() in my gallery-update-handler!
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Actually, this doesn't solve it completely. The item is still clickable...
This is due to CXTPControlGallery::OnClick() where there is only a check for the enable-state of the gallery itself:
if (!GetEnabled())
return; Any ideas?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
in same Draw method you can set bPressed to False if IsEnabled() is false.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Of course :P. Thanks! |
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Sorry, but that doesn't work either... bPressed &= IsEnabled();
The click is handled in the parent class, so I can click the item even if it's disabled/unpressed or whatever... This is definitely a bug in the parent class!
Next idea? :P
|
|
PokerMemento - http://www.pokermemento.com/
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
You can click it but visually you don't see it ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
I see it, but it's disabled (grayed out). Then when I click it, the command-handler is fired! The click should be eaten in this case! :(
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
This is still a problem :(. Any disabled items are clickable since CXTPGallery does NOT handle such states in OnClick()!
What should I do to disable clicking on certain items?! The items are drawn correctly...
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
I hope you realize this is indeed a flaw in the gallery code. Any improvements planned for 13.1?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
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 |