![]() |
Enable-Disable Menu |
Post Reply
|
| Author | |
KumarCJ
Groupie
Joined: 02 April 2007 Location: India Status: Offline Points: 96 |
Post Options
Thanks(0)
Quote Reply
Topic: Enable-Disable MenuPosted: 19 September 2007 at 8:25am |
|
Hi,
For enabling/disabling menu item I am using below code:
CXTPPopupBar* pCommandBar;
int nCount = pCommandBar->GetControls()->GetCount(); In this case every time searching for menu id in "for" loop.
Is there any other way to get the menu id directly(without using "for" loop) for enable/disable the menu item.
Thanks,
KumarCJ.
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 19 September 2007 at 1:53pm |
|
Hello, Why you so don't like update handlers??? Please check how our sample Enable/Disable commands.
Don't use this loops, use Update handlers.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
jimmy
Senior Member
Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
Post Options
Thanks(0)
Quote Reply
Posted: 20 September 2007 at 3:55am |
|
Hi,
Use FindControl instead of your own 'for loop'. Jimmy |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 21 September 2007 at 1:06am |
|
Hello,
FindControl and all these loops are very bad designed solutions. User can remove control, can copy to another toolbar, can move it etc. FindControl can failed or don't update copied controls.
Use Actions or Update handlers.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
KumarCJ
Groupie
Joined: 02 April 2007 Location: India Status: Offline Points: 96 |
Post Options
Thanks(0)
Quote Reply
Posted: 29 September 2007 at 12:58am |
|
Thanks alot jimmy / Oleg :)
|
|
![]() |
|
jjqin
Newbie
Joined: 18 October 2007 Location: United States Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 December 2007 at 5:46pm |
|
Hi,
Which example show Update handlers trick?
Regards,
-JianJing
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 19 December 2007 at 10:57am |
|
Almost all.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Pariksh*t
Groupie
Joined: 26 June 2008 Location: India Status: Offline Points: 77 |
Post Options
Thanks(0)
Quote Reply
Posted: 08 July 2008 at 2:59am |
|
oleg what about dynamic menus? how will you handle event handling of that? |
|
![]() |
|
znakeeye
Senior Member
Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Quote Reply
Posted: 08 July 2008 at 6:32am |
|
Pariksh*t, update-handlers rocks. If you mean dynamic menus as in "I don't know how many items I will add here", then you need a command-range and an UPDATE_UI_COMMAND_RANGE-handler. A common sample is to add all IE-favorites to a menu. The trick is to say "there will be at most 1000 items":
#define ID_FIRST_ITEM 20000
#define ID_LAST_ITEM (ID_FIRST_ITEM + 999)
UPDATE_UI_COMMAND_RANGE(ID_FIRST_ITEM, ID_LAST_ITEM, OnItem)
... not sure if this is what you were asking. But at least I got the opportunity to code a bit :)
|
|
![]() |
|
Pariksh*t
Groupie
Joined: 26 June 2008 Location: India Status: Offline Points: 77 |
Post Options
Thanks(0)
Quote Reply
Posted: 08 July 2008 at 6:38am |
|
thanx a lot....
but this is the problem with me at compile time we have no idea about no of ids to be generated......otherwise this idea will work for sure my friend
do reply
bye
|
|
![]() |
|
Smucker
Senior Member
Joined: 02 February 2008 Status: Offline Points: 156 |
Post Options
Thanks(0)
Quote Reply
Posted: 08 July 2008 at 8:22am |
|
How do you assign ids? Random numbers?
As long as you have a starting point and a max, use the range functions. |
|
|
Product: Xtreme Toolkit Pro version 13.2 (Unicode, static build)
Platform: Windows 200x/XP/Vista/Win7 (32/64 bit) Language: Visual C++ 9.0 (Studio 2008) |
|
![]() |
|
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 |