The cmd.tool.hand-icon stays highlighted/activated SOLVED
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
The cmd.tool.hand-icon stays highlighted/activated
Hey guys!
I've inserted an custom command with an icon to the cmdbar.standard. I'd like to get the behavior like the cmd.tool.hand. I mean, I'd like to switch between the cmd.tool.hand and my cmd.tool.myCustom.
The problem is, it does not switch. The cmd.tool.hand-icon stays highlighted/activated. Is there any flag or something I need to add to my command? I cannot find any solution in this forum neither.
Thanks
mbz
I've inserted an custom command with an icon to the cmdbar.standard. I'd like to get the behavior like the cmd.tool.hand. I mean, I'd like to switch between the cmd.tool.hand and my cmd.tool.myCustom.
The problem is, it does not switch. The cmd.tool.hand-icon stays highlighted/activated. Is there any flag or something I need to add to my command? I cannot find any solution in this forum neither.
Thanks
mbz
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: The cmd.tool.hand-icon stays highlighted/activated
Hello mbz,
Well the selected state of the Hand Tool is indicated by the UIX_CmdItemState_Checked flag of the UIX_CmdItemState enum. The unselected state is a normal state of the command UIX_CmdItemState_Normal. Basically, when you check your item, you must set the Hand Tool's state to UIX_CmdItemState_Normal and visa versa.
All of this should be done in the custom command handler:
https://gist.github.com/Polaringu/16bb2 ... 7cbe36f4e6
Cheers,
Alex
Well the selected state of the Hand Tool is indicated by the UIX_CmdItemState_Checked flag of the UIX_CmdItemState enum. The unselected state is a normal state of the command UIX_CmdItemState_Normal. Basically, when you check your item, you must set the Hand Tool's state to UIX_CmdItemState_Normal and visa versa.
All of this should be done in the custom command handler:
https://gist.github.com/Polaringu/16bb2 ... 7cbe36f4e6
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: The cmd.tool.hand-icon stays highlighted/activated
Hi Alex,
Thank you for your reply.
Unfortunately that solution doesn't work for me. I need to change the CmdItem.State in OnNotify (when my button is pressed). Something like that:
and visa versa.
But pItem.State is readonly. I need the same behavior for my CmdItem, like cmd.tool.hand and e.g. cmd.tool.selectText have, only one of them can be checked.
Maybe my way of thinking is wrong.
Thanks,
mbz
Thank you for your reply.
Unfortunately that solution doesn't work for me. I need to change the CmdItem.State in OnNotify (when my button is pressed). Something like that:
Code: Select all
public void OnNotify(int nCode, IUIX_Cmd pCmd, IUIX_CmdItem pItem, IUIX_Obj pOwner, uint nNotifyData)
{
var handCmdId = _inst.Str2ID("cmd.tool.hand", false);
var customCmdId = _inst.Str2ID("cmd.tool.myCustom", false);
if (pCmd.ID.Equals(handCmdId))
pItem.State = (int) UIX_CmdItemState.UIX_CmdItemState_Checked;
else if (pCmd.ID.Equals(customCmdId))
pItem.State = (int) UIX_CmdItemState.UIX_CmdItemState_Checked;
}
But pItem.State is readonly. I need the same behavior for my CmdItem, like cmd.tool.hand and e.g. cmd.tool.selectText have, only one of them can be checked.
Maybe my way of thinking is wrong.
Thanks,
mbz
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: The cmd.tool.hand-icon stays highlighted/activated
Hello mbz,
The state of the command item should be modified in the OnGetItemState method.
Cheers,
Alex
The state of the command item should be modified in the OnGetItemState method.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: The cmd.tool.hand-icon stays highlighted/activated
Hi Alex,
Well, I did understand that. The problem is, OnGetItemState is only called, when the cmdbar is drawn. Never after the OnNotify was raised.
So, maybe you can tell me when this method is called.
Thanks,
mbz
Well, I did understand that. The problem is, OnGetItemState is only called, when the cmdbar is drawn. Never after the OnNotify was raised.
So, maybe you can tell me when this method is called.
Thanks,
mbz
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: The cmd.tool.hand-icon stays highlighted/activated
Hello mbz,
The state of the command item can only be updated from the OnGetItemState method. This means that you'll need to know the state for each separate item in that point. You can try to redraw the command items so that their state will refresh:
https://sdkhelp.pdf-xchange.com/vie ... tem_Redraw
Cheers,
Alex
The state of the command item can only be updated from the OnGetItemState method. This means that you'll need to know the state for each separate item in that point. You can try to redraw the command items so that their state will refresh:
https://sdkhelp.pdf-xchange.com/vie ... tem_Redraw
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: The cmd.tool.hand-icon stays highlighted/activated
Hi Alex,
Well, the pItem.Redraw() doesn't raise OnGetItemState neither.
Maybe you can show me how it is done in your code. It shouldn't be such a big problem to change the item state to inform the user, which tool is activated right now.
If switching between Hand Tool and Select Text is working fine, why is it such a trouble with an custom item then?
Thank you for your help,
mbz
Well, the pItem.Redraw() doesn't raise OnGetItemState neither.
Maybe you can show me how it is done in your code. It shouldn't be such a big problem to change the item state to inform the user, which tool is activated right now.
If switching between Hand Tool and Select Text is working fine, why is it such a trouble with an custom item then?
Thank you for your help,
mbz
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: The cmd.tool.hand-icon stays highlighted/activated
Hello mbz,
I will try to do this and will write back whether it's possible.
Cheers,
Alex
I will try to do this and will write back whether it's possible.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: The cmd.tool.hand-icon stays highlighted/activated SOLVED
Hi, mbz.
HTH
To update states of command-items on toolbars, use:Well, the pItem.Redraw() doesn't raise OnGetItemState neither.
Code: Select all
PDFXEdit.IPXV_Inst Inst = pdfCtl.Inst;
PDFXEdit.IUIX_Inst uiInst = (PDFXEdit.IUIX_Inst)Inst.GetExtension("UIX");
...
int flag = (int)PDFXEdit.UIX_CmdItemUpdateFlags.UIX_CmdItemUpdate_State;
uiInst.CmdManager.UpdateCmdItems(flag, Inst.Str2ID("cmd.tool.hand"));
uiInst.CmdManager.UpdateCmdItems(flag, Inst.Str2ID("cmd.tool.myCustom"));
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Re: The cmd.tool.hand-icon stays highlighted/activated
Hi Vasyl,
thank your for your reply!
That worked for me!
Thank you,
mbz
thank your for your reply!
That worked for me!
Thank you,
mbz
- Tracker Supp-Stefan
- Site Admin
- Posts: 17910
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact: