![]() |
Enable-Disable Menu |
Post Reply ![]() |
Author | |
Smucker ![]() Senior Member ![]() ![]() Joined: 02 February 2008 Status: Offline Points: 156 |
![]() ![]() ![]() ![]() ![]() 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) |
|
![]() |
|
Pariksh*t ![]() Groupie ![]() ![]() Joined: 26 June 2008 Location: India Status: Offline Points: 77 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() |
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 |
![]() ![]() ![]() ![]() ![]() |
oleg what about dynamic menus? how will you handle event handling of that? |
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Almost all.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
jjqin ![]() Newbie ![]() Joined: 18 October 2007 Location: United States Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Which example show Update handlers trick?
Regards,
-JianJing
|
|
![]() |
|
KumarCJ ![]() Groupie ![]() ![]() Joined: 02 April 2007 Location: India Status: Offline Points: 96 |
![]() ![]() ![]() ![]() ![]() |
Thanks alot jimmy / Oleg :)
|
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
jimmy ![]() Senior Member ![]() Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Use FindControl instead of your own 'for loop'. Jimmy |
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
KumarCJ ![]() Groupie ![]() ![]() Joined: 02 April 2007 Location: India Status: Offline Points: 96 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
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 |