Newbie question:
I have made some custom buttons in a plugin. I enable/disable them depending on whether the user selects a radio button or not.
The problem is, whenever I click in the editor all the buttons become enabled again. I don't know how to detect the state and keep it if I'm not creating the buttons.
Any help would be appreciated.
Code for plugin buttons:
Javascript code for radio button
Any help is appreciated.
Thanks,
biff
I have made some custom buttons in a plugin. I enable/disable them depending on whether the user selects a radio button or not.
The problem is, whenever I click in the editor all the buttons become enabled again. I don't know how to detect the state and keep it if I'm not creating the buttons.
Any help would be appreciated.
Code for plugin buttons:
var AddMyButton=function() {this.name = 'MyButton';}
AddMyButton.prototype.Execute=function()
{
var oEditor = FCKeditorAPI.GetInstance('fcksequence') ;
oEditor.InsertHtml('<b>Wow bold text! Who would have thought this is possible?</b>');
}
AddMyButton.prototype.GetState=function()
{
return FCK_TRISTATE_ON;
}
var oMyButton=new FCKToolbarButton('MyButton', 'MyButton', 'MyButton does cool stuff', FCK_TOOLBARITEM_ONLYTEXT,false,true);
FCKToolbarItems.RegisterItem('MyButton', oMyButton);
FCKCommands.RegisterCommand('MyButton', new AddMyButton());Javascript code for radio button
var oEditor = FCKeditorAPI.GetInstance('fcksequence') ;
var idx = whichSequence();
switch(idx)
{
case '1':
oEditor.EditorWindow.parent.FCKToolbarItems.LoadedItems['MyButton'].Enable();
break;
case '2':
oEditor.EditorWindow.parent.FCKToolbarItems.LoadedItems['MyButton'].Disable();
break;
}Any help is appreciated.
Thanks,
biff

Re: I am not maintaining button state in my plugin
You must return the proper state in that method, checking there if they are enabled or not.
Re: I am not maintaining button state in my plugin
That makes sense, so I guess my question is really; how do I check to see if a button is enabled?
Thanks much,
biff
Re: I am not maintaining button state in my plugin
Re: I am not maintaining button state in my plugin
Thanks