Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Update-handler for gallery-items?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Update-handler for gallery-items?

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: Update-handler for gallery-items?
    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/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2009 at 9:57am

Of course :P. Thanks!

PokerMemento - http://www.pokermemento.com/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 10 April 2009 at 1:25am
 
You can click it but visually you don't see it ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.218 seconds.