Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ToolStripButton problem , iconClick

    A too strip button is in essence a BUTTON , if i click in any place of the button at least one event is required , in this case click event.

    The problem is , what happened when i need to stop the action under some circunstances , well i found iconClick , have sense.

    BUT the problem is that it works only inside THE ICON IMAGE , outside the icon image nothing happens.

    Its absurd , its the only way that exist (based on documentation) to stop the action.

    I use as example the same example in the documentation and put the handlers for iconClick and click in the button alignCenter , and put 2 messages ,
    you can check there the problem , or exist another way to do that.


    Code:
    isc.Menu.create({
        ID: "menu",
        autoDraw: false,
        showShadow: true,
        shadowDepth: 10,
        data: [
            {title: "New", keyTitle: "Ctrl+N", icon: "icons/16/document_plain_new.png"},
            {title: "Open", keyTitle: "Ctrl+O", icon: "icons/16/folder_out.png"},
            {isSeparator: true},
            {title: "Save", keyTitle: "Ctrl+S", icon: "icons/16/disk_blue.png"},
            {title: "Save As", icon: "icons/16/save_as.png"},
            {isSeparator: true},
            {title: "Recent Documents", icon: "icons/16/folder_document.png", submenu: [
                {title: "data.xml", checked: true},
                {title: "Component Guide.doc"},
                {title: "SmartClient.doc", checked: true},
                {title: "AJAX.doc"}
            ]},
            {isSeparator: true},
            {title: "Export as...", icon: "icons/16/export1.png", submenu: [
                {title: "XML"},
                {title: "CSV"},
                {title: "Plain text"}
            ]},
            {isSeparator: true},
            {title: "Print", enabled: false, keyTitle: "Ctrl+P", icon: "icons/16/printer3.png"}
        ]
    });
    
    isc.ToolStripMenuButton.create({
        ID: "menuButton",
        title: "File",   
        menu: menu
    });
    
    isc.ToolStripButton.create({
        ID: "printButton",    
        icon: "other/printer.png",  
        title: "print"
        
    });
    isc.ToolStripButton.create({
        ID: "alignLeft",   
        icon: "[SKIN]/RichTextEditor/text_align_left.png",    
        actionType: "radio",
        radioGroup: "textAlign"
    });
    isc.ToolStripButton.create({
        ID: "alignRight",   
        icon: "[SKIN]/RichTextEditor/text_align_right.png", 
        actionType: "radio",
        radioGroup: "textAlign"
    });
    isc.ToolStripButton.create({
        ID: "alignCenter",   
        icon: "[SKIN]/RichTextEditor/text_align_center.png", 
        actionType: "radio",
        radioGroup: "textAlign",
        iconClick: function() {
          console.log('ICON CLICK'+this.isSelected()) ;
        },
        click: function() {
          console.log('CLICK '+this.isSelected());
        }
    });
    isc.ToolStripButton.create({
        ID: "bold",    
        icon: "[SKIN]/RichTextEditor/text_bold.png",    
        actionType: "checkbox"
    });
    isc.ToolStripButton.create({
        ID: "italics",    
        icon: "[SKIN]/RichTextEditor/text_italic.png",
        actionType: "checkbox"
    });
    isc.ToolStripButton.create({
        ID: "underlined",    
        icon: "[SKIN]/RichTextEditor/text_underline.png", 
        actionType: "checkbox"
    });
    
    isc.DynamicForm.create({
        ID: "fontSelector",
        showResizeBar:true,
        width:100, minWidth:50,
        numCols:1,
        fields: [
            {name: "selectFont", showTitle: false, width:"*",
             valueMap: {
                "courier": "<span style='font-family:courier'>Courier</span>",
                "verdana": "<span style='font-family:verdana'>Verdana</span>",
                "times": "<span style='font-family:times'>Times</span>"
             }, defaultValue:"courier" }
        ]    
    });
    
    isc.DynamicForm.create({
        ID: "zoomSelector",
        width:100, minWidth:50,
        numCols:1,
        fields: [
            {name: "selectZoom", showTitle: false, width:"*",
             valueMap: ["50%", "75%", "100%", "150%", "200%", "Fit"],
             defaultValue:"100%" }
        ]
    });
    
    isc.ToolStrip.create({
        width: 450, height:24, 
        members: [menuButton, "separator", printButton, 
                  "resizer", bold, italics, underlined, 
                  "separator",
                  alignLeft, alignRight, alignCenter,
                  "separator",
                  fontSelector, "resizer", zoomSelector]
    });

    #2
    Sorry, we don't follow.

    ToolStripButton is indeed a subclass of Button, as the docs say.

    iconClick fires if you click on the icon, click fires for a click anywhere on the button.

    This is all as documented.. what is surprising?

    Comment


      #3
      ok , how i cancel the action if the click its outside the icon image , near the border by example.
      Its weird i can only cancel the action if i click inside the image

      Comment

      Working...
      X