Print Page | Close Window

Update-handler for gallery-items?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=13920
Printed Date: 22 November 2024 at 1:49am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Update-handler for gallery-items?
Posted By: znakeeye
Subject: Update-handler for gallery-items?
Date 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/



Replies:
Posted By: znakeeye
Date Posted: 04 April 2009 at 7:34am
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/


Posted By: znakeeye
Date Posted: 06 April 2009 at 3:25pm
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/


Posted By: Oleg
Date Posted: 07 April 2009 at 1:22am
Hi,
 
in same Draw method you can set bPressed to False if IsEnabled() is false.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: znakeeye
Date Posted: 07 April 2009 at 9:57am

Of course :P. Thanks!



-------------
PokerMemento - http://www.pokermemento.com/


Posted By: znakeeye
Date Posted: 09 April 2009 at 5:28pm

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/


Posted By: Oleg
Date Posted: 10 April 2009 at 1:25am
 
You can click it but visually you don't see it ?


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: znakeeye
Date Posted: 14 April 2009 at 4:29am
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/


Posted By: znakeeye
Date Posted: 23 April 2009 at 5:58pm
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/


Posted By: znakeeye
Date Posted: 07 May 2009 at 6:15am
I hope you realize this is indeed a flaw in the gallery code. Any improvements planned for 13.1?

-------------
PokerMemento - http://www.pokermemento.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net