Rollover image for custom button not working.

Last post 08-08-2008, 5:20 PM by miliscent. 3 replies.
Sort Posts: Previous Next
  •  08-08-2008, 3:12 PM 42854

    Rollover image for custom button not working.

    I've added a custom button to my tool bar but when I rollover the image it doesn't change like the other buttons do.  Here's the code I'm using:
     

    tc = Editor1.ToolControls["tokenspersonal"];

    if (tc != null)

    {

    // personal tokens

    Image1 = new System.Web.UI.WebControls.Image();

    Image1.ToolTip = "Insert Personalization Tokens";

    Image1.ImageUrl = "~/Editor/Images/mycustombuttonimage.gif";

    Image1.CssClass = "CuteEditorButton";

    Image1.Attributes["onclick"] = "ShowTokensPersonal(this)";

    tc.Control.Controls.Add(Image1);

    }
     
     
    Is there a different CssClass I should be using?  Thanks!
  •  08-08-2008, 3:48 PM 42855 in reply to 42854

    Re: Rollover image for custom button not working.


     void SetMouseEvents(WebControl control)
     {
      control.Attributes["onmouseover"]="CuteEditor_ButtonCommandOver(this)";
      control.Attributes["onmouseout"]="CuteEditor_ButtonCommandOut(this)";
      control.Attributes["onmousedown"]="CuteEditor_ButtonCommandDown(this)";
      control.Attributes["onmouseup"]="CuteEditor_ButtonCommandUp(this)";
      control.Attributes["ondragstart"]="CuteEditor_CancelEvent()";
     }
     
     
     

    tc = Editor1.ToolControls["tokenspersonal"];

    if (tc != null)

    {
     

    // personal tokens

    Image1 = new System.Web.UI.WebControls.Image();

    Image1.ToolTip = "Insert Personalization Tokens";

    Image1.ImageUrl = "~/Editor/Images/mycustombuttonimage.gif";

    Image1.CssClass = "CuteEditorButton";

    Image1.Attributes["onclick"] = "ShowTokensPersonal(this)";

    tc.Control.Controls.Add(Image1);
    SetMouseEvents(Image1);

    }

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  08-08-2008, 4:10 PM 42856 in reply to 42855

    Re: Rollover image for custom button not working.

    Thanks Adam.  I remember removing that SetMouseEvents() method from the sample documentation because the method was not found.  I see now I have to add this in myself.
     
    After adding the above code, when rolling over, my custom buttons have a border around them which is not quite the effect I was hoping for.  I'm using the outlook 2007 theme and when rolling over the other icons I get the dark gray background.  My icons just have the black border.  Do I need to make a second image file to be displayed or is there something else I'm missing?
  •  08-08-2008, 5:20 PM 42857 in reply to 42856

    Re: Rollover image for custom button not working.

    Adam - I thought my gif icons were transparent but they weren't, DOH!  I exported them as transparent and now the gray background appears.  Thanks again for your help.  Hopefully you'll have time to look at my previous post about the scrollbars in a custom button showdialog window.
     
    Thanks again!
View as RSS news feed in XML